-
Notifications
You must be signed in to change notification settings - Fork 278
Windows Build Instructions
The best way to get started with libopenshot, is to learn about our build system, obtain all the source code, install a development IDE and tools, and better understand our dependencies. So, please read through the following sections, and follow the instructions. And keep in mind, that your computer is likely different than the one used when writing these instructions. Your file paths and versions of applications might be slightly different, so keep an eye out for subtle file path differences in the commands you type.
CMake is the backbone of our build system. It is a cross-platform build system, which checks for dependencies, locates header files and libraries, generates makefiles, and supports the cross-platform compiling of libopenshot and libopenshot-audio. CMake uses an out-of-source build concept, where all temporary build files, such as makefiles, object files, and even the final binaries, are created outside of the source code folder, inside a /build/ sub-folder. This prevents the build process from cluttering up the source code. These instructions have only been tested with the GNU compiler (including MSYS2/MinGW for Windows).
The following libraries are required to build libopenshot. Instructions on how to install these dependencies vary for each operating system. Libraries and Executables have been labeled in the list below to help distinguish between them.
-
-
http://www.ffmpeg.org/
(Library)
- This library is used to decode and encode video, audio, and image files. It is also used to obtain information about media files, such as frame rate, sample rate, aspect ratio, and other common attributes.
-
http://www.ffmpeg.org/
-
-
http://www.imagemagick.org/script/magick++.php
(Library)
- This library is optional, and used to decode and encode images.
-
http://www.imagemagick.org/script/magick++.php
-
-
https://github.com/OpenShot/libopenshot-audio/
(Library)
- This library is used to mix, resample, host plug-ins, and play audio. It is based on the JUCE project, which is an outstanding audio library used by many different applications
-
https://github.com/OpenShot/libopenshot-audio/
-
-
http://www.qt.io/qt5/
(Library)
- Qt5 is used to display video, store image data, composite images, apply image effects, and many other utility functions, such as file system manipulation, high resolution timers, etc...
-
http://www.qt.io/qt5/
-
-
http://www.cmake.org/
(Executable)
- This executable is used to automate the generation of Makefiles, check for dependencies, and is the backbone of libopenshot’s cross-platform build process.
-
http://www.cmake.org/
-
-
http://www.swig.org/
(Executable)
- This executable is used to generate the Python and Ruby bindings for libopenshot. It is a simple and powerful wrapper for C++ libraries, and supports many languages.
-
http://www.swig.org/
-
-
http://www.python.org/
(Executable and Library)
- This library is used by swig to create the Python (version 3+) bindings for libopenshot. This is also the official language used by OpenShot Video Editor (a graphical interface to libopenshot).
-
http://www.python.org/
-
-
http://www.doxygen.nl/download.html
(Executable)
- This executable is used to auto-generate the documentation used by libopenshot.
-
http://www.doxygen.nl/download.html
-
-
https://github.com/unittest-cpp/
(Library)
- This library is used to execute unit tests for libopenshot. It contains many macros used to keep our unit testing code very clean and simple.
-
https://github.com/unittest-cpp/
-
-
http://zeromq.org/
(Library)
- This library is used to communicate between libopenshot and other applications (publisher / subscriber). Primarily used to send debug data from libopenshot.
-
http://zeromq.org/
-
-
https://www.openmp.org/resources/openmp-compilers-tools/
(Compiler Flag)
- If your compiler supports this flag (GCC, Clang, and most other compilers have built-in support), it provides libopenshot with easy methods of using parallel programming techniques to improve performance and take advantage of multi-core processors.
-
https://www.openmp.org/resources/openmp-compilers-tools/
There are many different build flags that can be passed to cmake to adjust how libopenshot is compiled. Some of these flags might be required when compiling on certain OSes, just depending on how your build environment is setup. To add a build flag, follow this general syntax: $ cmake -DMAGICKCORE_HDRI_ENABLE=1 -DENABLE_TESTS=1 ../
- MAGICKCORE_HDRI_ENABLE (default 0)
- MAGICKCORE_QUANTUM_DEPTH (default 0)
- OPENSHOT_IMAGEMAGICK_COMPATIBILITY (default 0)
- DISABLE_TESTS (default 0)
- CMAKE_PREFIX_PATH (
/location/to/missing/library/
) - PYTHON_INCLUDE_DIR (
/location/to/python/include/
) - PYTHON_LIBRARY (
/location/to/python/lib.a
) - PYTHON_FRAMEWORKS (
/usr/local/Cellar/python3/3.3.2/Frameworks/Python.framework/
) - CMAKE_CXX_COMPILER (
/location/to/mingw/g++
) - CMAKE_C_COMPILER (
/location/to/mingw/gcc
)
Many environment variables will need to be set during this Windows installation guide. The command line will need to be closed and re-launched after any changes to your environment variables. Also, dependency libraries will not be found during linking or execution without being found in the PATH environment variable. So, if you get errors related to missing commands or libraries, double check the PATH variable.
The following environment variables need to be added to your “System Variables”. Be sure to check each folder path for accuracy, as your paths will likely be different than this list.
- LIBOPENSHOT_AUDIO_DIR (
C:\msys64\usr
) - UNITTEST_DIR (
C:\msys64\usr
) - RESVGDIR (
C:\msys64\usr
) - ASIO_SDK_DIR (
C:\asiosdk_2.3.3_2019-06-14\common
)
The first step in installing libopenshot is to obtain the most recent source code. The source code is available on GitHub. Use the following command to obtain the latest libopenshot source code.
git clone https://github.com/OpenShot/libopenshot.git
git clone https://github.com/OpenShot/libopenshot-audio.git
The source code is divided up into the following folders.
-
- This folder needs to be manually created, and is used by cmake to store the temporary build files, such as makefiles, as well as the final binaries (library and test executables).
-
- This folder contains custom modules not included by default in cmake, used to find dependency libraries and headers and determine if these libraries are installed.
-
- This folder contains documentation and related files, such as logos and images required by the doxygen auto-generated documentation.
-
- This folder contains all headers (*.h) used by libopenshot.
-
- This folder contains all source code (*.cpp) used by libopenshot.
-
- This folder contains all unit test code. Each class has it’s own test file (*.cpp), and uses UnitTest++ macros to keep the test code simple and manageable.
-
- This folder contains code not written by the OpenShot team. For example, jsoncpp, an open-source JSON parser.
Most Windows dependencies needed for libopenshot-audio, libopenshot, and openshot-qt can be installed easily with MSYS2 and the pacman package manager. Follow these directions to setup a Windows build environment for OpenShot.
-
Install MSYS2: http://www.msys2.org/
-
Run MSYS2 command prompt (for example:
C:\msys64\msys2_shell.cmd
) -
Append PATH (so MSYS2 can find executables and libraries). This only needs to be done when we are manually compiling things (such as libopenshot, libopenshot-audio, resvg, unittest++). If you find yourself repeating these commands, append them to the end of your .bashrc file located at /home/yourusername :
PATH=$PATH:/c/msys64/mingw64/bin:/c/msys64/mingw64/lib (64-bit PATH)
or
PATH=$PATH:/c/msys32/mingw32/bin:/c/msys32/mingw32/lib (32-bit PATH)
For permanent change from within msys2 shell:
cd ~
echo 'PATH=$PATH:/c/msys64/mingw64/bin:/c/msys64/mingw64/lib' >> .bashrc
or
echo 'PATH=$PATH:/c/msys32/mingw32/bin:/c/msys32/mingw32/lib' >> .bashrc
source .bashrc
- Update and upgrade all packages
pacman -Syu
- Install the following packages (64-Bit)
pacman -S --needed --disable-download-timeout \
base-devel git \
mingw-w64-x86_64-toolchain \
mingw64/mingw-w64-x86_64-ffmpeg \
mingw64/mingw-w64-x86_64-swig \
mingw64/mingw-w64-x86_64-cmake \
mingw64/mingw-w64-x86_64-doxygen \
mingw64/mingw-w64-x86_64-zeromq \
mingw64/mingw-w64-x86_64-python3-pyqt5 \
mingw64/mingw-w64-x86_64-python3-pip \
mingw64/mingw-w64-x86_64-python3-pyzmq \
mingw64/mingw-w64-x86_64-python3-cx_Freeze \
mingw64/mingw-w64-x86_64-rust
# Install ImageMagick if needed (OPTIONAL and NOT NEEDED)
pacman -S mingw64/mingw-w64-x86_64-imagemagick
Or Install the following packages (32-Bit)
pacman -S --needed --disable-download-timeout \
base-devel git \
mingw-w64-i686-toolchain \
mingw32/mingw-w64-i686-ffmpeg \
mingw32/mingw-w64-i686-swig \
mingw32/mingw-w64-i686-cmake \
mingw32/mingw-w64-i686-doxygen \
mingw32/mingw-w64-i686-zeromq \
mingw32/mingw-w64-i686-python3-pyqt5 \
mingw32/mingw-w64-i686-python3-pip \
mingw32/mingw-w64-i686-python3-pyzmq \
mingw32/mingw-w64-i686-python3-cx_Freeze \
mingw32/mingw-w64-i686-rust
# Install ImageMagick if needed (OPTIONAL and NOT NEEDED)
pacman -S --needed mingw32/mingw-w64-i686-imagemagick
Original OpenShot downloads provide Python 3.7, while MSYS2 provides Python 3.8. If it is intended to use the self-built libopenshot.dll
together with a prebuilt installation (e. g. an OpenShot nightly build) it is necessary to downgrade MSYS2's Python version from 3.8 to 3.7:
curl -O http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-python3-3.7.5-1-any.pkg.tar.xz
pacman -U mingw-w64-x86_64-python3-3.7.5-1-any.pkg.tar.xz
- Install Python PIP Dependencies
pip3 install httplib2 tinys3 github3.py==0.9.6 requests
- Download Unittest++ (https://github.com/unittest-cpp/unittest-cpp) into /MSYS2/[USER]/unittest-cpp-master/
git clone https://github.com/unittest-cpp/unittest-cpp.git
cd unittest-cpp/builds
cmake -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
make
make install
NOTE: Be sure to create a UNITTEST_DIR
system environment variable pointing to the install directory: C:\msys64\usr
.
- Download Resvg (https://github.com/RazrFalcon/resvg) into /MSYS2/[USER]/resvg/
git clone https://github.com/RazrFalcon/resvg
cd resvg/capi
QT_DIR="C:\\msys64\\mingw64\\" cargo build --verbose --release --features="qt-backend"
**OR**
QT_DIR="C:\\msys32\\mingw32\\" cargo build --verbose --release --features="qt-backend"
cd ../
# copy all required files into the system directories
cp target/release/resvg.dll /usr/lib/
mkdir -p /usr/include/resvg/
cp capi/include/*.h /usr/include/resvg/
NOTE: Be sure to create a RESVGDIR
system environment variable pointing to the install directory: C:\msys64\usr
.
-
- Windows 7: (DirectX SDK) http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=6812
- Windows 8: (Windows SDK)
- https://msdn.microsoft.com/en-us/windows/desktop/aa904949
- Download and Install the SDK Setup program. This is needed for the JUCE library to play audio on Windows. Create an environment variable called DXSDK_DIR and set the value to C:\Program Files\Microsoft DirectX SDK (June 2010)\ (your path might be different). This environment variable will be used by CMake to find the binaries and header files.
-
- https://www.steinberg.net/asiosdk
- Download and extract to a folder
- Create an environment variable called ASIO_SDK_DIR and set the value to C:\Program Files\asiosdk_233\common. This environment variable will be used by CMake to find the header files.
In order to compile libopenshot-audio, launch a command prompt and enter the following commands. This does not require the MSYS2 prompt, but it should work in both the Windows command prompt and the MSYS2 prompt.
cd [libopenshot-audio repo folder]
mkdir build
cd build
cmake -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX:PATH=/usr ../
make
make install
openshot-audio-test-sound (This should play a test sound)
NOTE: Be sure to create a LIBOPENSHOT_AUDIO_DIR
system environment variable pointing to the libopenshot-audio install directory: C:\msys64\usr
.
Run the following commands to build libopenshot:
cd [libopenshot repo folder]
mkdir build
cd build
cmake -G "MSYS Makefiles" -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX:PATH=/mingw64 ../
make
make install
If you are missing any dependencies for libopenshot, you will receive error messages at this point. Just install the missing dependencies, and run the above commands again. Repeat until no error messages are displayed and the build process completes.
Also, if you are having trouble building, please see the CMake Flags section above, as it might provide a solution for finding a missing folder path, missing Python 3 library, etc...
To run all unit tests (and verify everything is working correctly), launch a terminal, and enter:
make test
or (For CMake versions < 3.11)
make os_test
To auto-generate the documentation for libopenshot, launch a terminal, and enter:
make doc
This will use doxygen to generate a folder of HTML files, with all classes and methods documented. The folder is located at build/doc/html/. Once libopenshot has been successfully built, we need to install it (i.e. copy it to the correct folder, so other libraries can find it).
make install
This should copy the binary files to C:\msys64\mingw64\lib\python3.7\site-packages\
, and the header files to C:\msys64\mingw64\include\libopenshot
This is where other projects will look for the libopenshot files when building.. Python 3 bindings are also installed at this point. let's verify the python bindings work:
export PATH="$PROGRAMFILES/OpenShot Video Editor/lib":$PATH
python3
>>> import openshot
NOTE: $PROGRAMFILES/OpenShot Video Editor/lib
is needed to be on the search PATH
as it contains all the needed DLLs loaded by the built _openshot.pyd
and libopenshot.dll
files.
NOTE: This won't work from the MSYS2 prompt as that prompt's Python runtime is unable to load *.pyd
files, but it will work fine from MSYS2's MinGW64 prompt, as that prompt's Python variant is able to load *.pyd
files.
If no errors are displayed, you have successfully compiled and installed libopenshot on your system. Congratulations and be sure to read our wiki on Becoming an OpenShot Developer! Welcome to the OpenShot developer community! We look forward to meeting you!
Want to make some OpenShot friends and join our open-source team? Please send me an email ([email protected]) and introduce yourself! All volunteers are welcome, regardless of skills and/or skill level. Let's build something amazing!