From 98ccfb5ee1ba4285503ec83e65acdf39a4d4bd76 Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Fri, 12 Aug 2016 19:15:19 -0500 Subject: [PATCH] Fixing cmake build scripts to support 64bit on Windows. Also refactoring some pointer handling to support 64bit on Windows (Linux and Mac have always supported it). Adding instructions for setting up a Windows 64 bit build environment using MSYS2. --- cmake/Windows/README | 59 +++++++++++++++++++++++++++++++------- include/Qt/VideoRenderer.h | 2 +- include/QtPlayer.h | 4 +-- include/RendererBase.h | 2 +- src/CMakeLists.txt | 2 +- src/Qt/VideoRenderer.cpp | 2 +- src/QtPlayer.cpp | 6 ++-- tests/CMakeLists.txt | 2 +- 8 files changed, 59 insertions(+), 20 deletions(-) diff --git a/cmake/Windows/README b/cmake/Windows/README index d07674d5..70d29c27 100644 --- a/cmake/Windows/README +++ b/cmake/Windows/README @@ -1,12 +1,51 @@ -Installing ImageMagick on Windows using Qt's version of MinGW: +#################################################################### + Install Dependencies for Windows +#################################################################### -Step 1) Copy these files into your local MSYS environment -Step 2) Run MSYS Shell -Step 3) Install wget command (this requires your c:\mingw folder to be at the end of your PATH) - $ mingw-get install msys-wget -Step 4) Execute this command (this requires the C:\Qt\Qt5.2.1\Tools\mingw48_32\bin at the beginning of your PATH) - $ ./build-imagemagick.sh -Step 5) Copy the MSYS /local/bin/ DLLs to your PATH +Install MSYS2 (64 bit environment) +Append PATH: + $ PATH=$PATH:/c/msys64/mingw64/bin:/c/msys64/mingw64/lib -These ImageMagick DLL's need to be found by the libopenshot build process, -and linked and loaded at runtime. \ No newline at end of file +Sync pacman + $ pacman -Syu + +Install the following packages: + $ pacman -S mingw-w64-x86_64-toolchain + $ pacman -S mingw64/mingw-w64-x86_64-ffmpeg + $ pacman -S mingw64/mingw-w64-x86_64-python3-pyzmq + $ pacman -S mingw64/mingw-w64-x86_64-python3-pyqt5 + $ pacman -S mingw64/mingw-w64-x86_64-swig + $ pacman -S mingw64/mingw-w64-x86_64-cmake + $ pacman -S mingw64/mingw-w64-x86_64-doxygen + $ pacman -S mingw64/mingw-w64-x86_64-python3-pyzmq + $ pacman -S mingw64/mingw-w64-x86_64-python3-pip + $ pacman -S git + +Install ImageMagick if needed (OPTIONAL and NOT NEEDED) + $ pacman -S mingw64/mingw-w64-x86_64-imagemagick + +Install httplib2 for Python3 + $ pip3 install httplib2 + $ pip3 install slacker + $ pip3 install tinys3 + +Download Unittest++ into /c/home/jonathan/unittest-cpp-master/ +Configure Unittest++: + $ cmake -G "MSYS Makefiles" ../ -DCMAKE_MAKE_PROGRAM=mingw32-make +Build Unittest++ (as Administrator): + $ mingw32-make install (NOTE: This installs to C:\Program Files (x86)\UnitTest++) + +ZMQ++ Header + NOTE: Download and copy zmq.hpp into the /c/msys64/mingw64/include/ folder + + +#################################################################### + OPTIONAL: Installing ImageMagick on Windows +#################################################################### + +If you would rather install ImageMagick from source code yourself, follow these steps: + +Step 1) Copy [build-imagemagick.sh and urls.txt] into your local MSYS2 environment +Step 2) Run MSYS2 Shell +Step 3) Execute this command + $ ./build-imagemagick.sh \ No newline at end of file diff --git a/include/Qt/VideoRenderer.h b/include/Qt/VideoRenderer.h index 3101d3c1..8158c947 100644 --- a/include/Qt/VideoRenderer.h +++ b/include/Qt/VideoRenderer.h @@ -45,7 +45,7 @@ public: ~VideoRenderer(); /// Override QWidget which needs to be painted - void OverrideWidget(long qwidget_address); + void OverrideWidget(long long qwidget_address); signals: void present(const QImage &image); diff --git a/include/QtPlayer.h b/include/QtPlayer.h index 3fecd6cf..0d29b7fe 100644 --- a/include/QtPlayer.h +++ b/include/QtPlayer.h @@ -80,10 +80,10 @@ namespace openshot /// Set the QWidget which will be used as the display (note: QLabel works well). This does not take a /// normal pointer, but rather a LONG pointer id (and it re-casts the QWidget pointer inside libopenshot). /// This is required due to SIP and SWIG incompatibility in the Python bindings. - void SetQWidget(long qwidget_address); + void SetQWidget(long long qwidget_address); /// Get the Renderer pointer address (for Python to cast back into a QObject) - long GetRendererQObject(); + long long GetRendererQObject(); /// Get the Playback speed float Speed(); diff --git a/include/RendererBase.h b/include/RendererBase.h index 4544c696..b346436b 100644 --- a/include/RendererBase.h +++ b/include/RendererBase.h @@ -50,7 +50,7 @@ namespace openshot void paint(const std::tr1::shared_ptr & frame); /// Allow manual override of the QWidget that is used to display - virtual void OverrideWidget(long qwidget_address) = 0; + virtual void OverrideWidget(long long qwidget_address) = 0; protected: RendererBase(); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d69315a4..9457e238 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,7 +33,7 @@ OPTION(USE_SYSTEM_JSONCPP "Use system installed JsonCpp" OFF) # required for libopenshot-audio headers IF (WIN32) add_definitions( -DIGNORE_JUCE_HYPOT=1 ) - SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -march=i686 -include cmath -std=c++0x") + SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath -std=c++0x") ENDIF(WIN32) IF (APPLE) # If you still get errors compiling with GCC 4.8, mac headers need to be patched: http://hamelot.co.uk/programming/osx-gcc-dispatch_block_t-has-not-been-declared-invalid-typedef/ diff --git a/src/Qt/VideoRenderer.cpp b/src/Qt/VideoRenderer.cpp index 16160382..4eec8140 100644 --- a/src/Qt/VideoRenderer.cpp +++ b/src/Qt/VideoRenderer.cpp @@ -38,7 +38,7 @@ VideoRenderer::~VideoRenderer() } /// Override QWidget which needs to be painted -void VideoRenderer::OverrideWidget(long qwidget_address) +void VideoRenderer::OverrideWidget(long long qwidget_address) { // re-cast QWidget pointer (long) as an actual QWidget override_widget = reinterpret_cast(qwidget_address); diff --git a/src/QtPlayer.cpp b/src/QtPlayer.cpp index 1b420e8d..fa7f8b87 100644 --- a/src/QtPlayer.cpp +++ b/src/QtPlayer.cpp @@ -158,14 +158,14 @@ ReaderBase* QtPlayer::Reader() { } // Set the QWidget pointer to display the video on (as a LONG pointer id) -void QtPlayer::SetQWidget(long qwidget_address) { +void QtPlayer::SetQWidget(long long qwidget_address) { // Update override QWidget address on the video renderer p->renderer->OverrideWidget(qwidget_address); } // Get the Renderer pointer address (for Python to cast back into a QObject) -long QtPlayer::GetRendererQObject() { - return (long) (VideoRenderer*)p->renderer; +long long QtPlayer::GetRendererQObject() { + return (long long)(VideoRenderer*)p->renderer; } // Get the Playback speed diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d98587a1..2199c9b6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,7 +31,7 @@ IF (WIN32) STRING(REPLACE "/" "\\\\" TEST_MEDIA_PATH "${openshot_SOURCE_DIR}/src/examples/") add_definitions( -DIGNORE_JUCE_HYPOT=1 -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH}" ) - SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -march=i686 -include cmath -std=c++0x") + SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -include cmath -std=c++0x") ENDIF(WIN32) ################### UNITTEST++ #####################