-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Dependencies Windows
Configure a mingw-w64
cross-compilation environment for building Windows binaries in Linux.
# add PPA with dependency libs
sudo add-apt-repository ppa:tobydox/mingw-w64
sudo apt-get update
# add dependencies
sudo apt-get install \
git cmake nsis libxml-parser-perl liblist-moreutils-perl mingw-w64-tools \
gcc-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64-i686 g++-mingw-w64-x86-64 \
sdl-mingw-w64 sdl2-mingw-w64 libvorbis-mingw-w64 lame-mingw-w64 \
fluidsynth-mingw-w64 stk-mingw-w64 glib2-mingw-w64 portaudio-mingw-w64 \
libsndfile-mingw-w64 fftw-mingw-w64 flac-mingw-w64 fltk-mingw-w64 \
libgig-mingw-w64 libsamplerate-mingw-w64 libz-mingw-w64-dev \
binutils-mingw-w64 gcc-mingw-w64 libsoundio-mingw-w64 \
qt5base-mingw-w64 qttools5-dev-tools
# configure to use POSIX MinGW libs
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
git clone https://github.com/lmms/lmms
cd lmms
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="./cmake/toolchains/MinGW-W64-64.cmake"
cmake --build build
cmake --build build --target package
... see more compiling options here.
Warning, MSVC building is still experimental. Some plugins aren't available when compiling with MSVC.
Use the master
branch, MSVC is not supported on stable-1.2
.
git clone -b master https://github.com/LMMS/lmms.git --recurse-submodules
- Install Visual Studio Community (if you don't already have it) from here: https://www.visualstudio.com/downloads/
- Make sure to download the
Desktop Development with C++
tools. If you already have Visual Studio downloaded, you can 'modify' it with the Visual Studio Installer. - Alternatively, you can use Visual Studio build tools (which includes the compiler and the other stuff but without the ide).
- Make sure to download the
- Install Qt Open Source version from here: https://www.qt.io/download-qt-installer-oss.
- Follow the installer and create a free account if you do not have one already.
- When you get to the 'Select Components' stage, select version 5.15.x and just select 'MSVC 2019 64-bit' and 'MSVC 2019 32-bit'.
- If you only want to build for 32-bit, you can just select the 32-bit option.
- If you want to build for 64-bit, you need to also install the 32-bit package as well to support 32-bit VSTs.
- Expand the 'Developer and Designer Tools' section and unselect 'CMake 64-bit' (we will install this manually in the next step) and 'Ninja' (this comes by default with Visual Studio). Only 'Qt Creator CDB Debugger Support' and 'Debugging Tools for Windows' should be left selected, along with the mandatory 'Qt Creator'.
- Install CMake from here: https://cmake.org/download/
- This is included in visual studio but we can't use the visual studio one. So we need to manually install it.
- When prompted to add CMake to your
PATH
, answer yes.
- Install Git (if you don't already have it) from here: https://git-scm.com/download/win
- Install Vcpkg at C:\
cd C:\ git clone https://github.com/Microsoft/vcpkg cd vcpkg .\bootstrap-vcpkg.bat
- Install LMMS dependencies using Vcpkg
Replace
.\vcpkg install --triplet=x64-windows fftw3 libsamplerate libsndfile lilv lv2 sdl2 fluidsynth fltk portaudio libstk vulkan
x64-windows
withx86-windows
if you want to build 32-bit version instead of 64-bit.
Skip to the next section if you want to use the command line instead.
-
Open up Qt Creator
-
Go to
Edit
->Preferences
->Kits
. Qt Creator should have detected your Qt installation automatically. We need to make adjustments to it so that CMake finds the libraries installed using Vcpkg. -
Go to
Cmake
->Vcpkg
and add your Vcpkg path to Qt. Click apply.
-
Exit the options and open
CMakeLists.txt
in the Qt creator window. -
In the bottom left corner, choose your configuration and click build.
Configure using CMake. Pass in Visual Studio 17 2022
(or the version you have in your machine) as the build tool. Also pass in the path to Qt 5.15.2 MSVC 2019 64bit using -DCMAKE_PREFIX_PATH
and installed Vcpkg toolchain file using -DCMAKE_TOOLCHAIN_FILE=<path to vcpkg>/scripts/buildsystems/vcpkg.cmake
. Change paths accordingly. For 32 bit qt, we use another argument -DQT_32_PREFIX=<path to qt install>/msvc2019
cd lmms
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -DCMAKE_PREFIX_PATH=C:/Qt/5.15.2/msvc2019_64 -DQT_32_PREFIX=C:/Qt/5.15.2/msvc2019 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake
If you've built and installed qt5 in vcpkg, you don't need to specify CMAKE_PREFIX_PATH. CMake will find the version inside vcpkg
If configuring succeeded, compile using
cmake --build . --config "Release"
:: or Debug if you want to build in debug mode
The building part is over but LMMS fails to run at this stage. You might get "qt5 dlls missing" errors. To fix that, you need to install LMMS using cmake. I am installing LMMS at C:/lmms
for this tutorial.
cmake --install . --config Release --prefix=C:/lmms
If LMMS still gives a "dlls missing" error, or if you saw a "cannot analyze prerequisites" error in the previous two steps, you may need to switch to the VS Developer Command Prompt in Visual Studio 2022 to run the commands.
If you completed the first cmake command in the section above, it will have also created lmms.sln in your build directory.
By default when you generate an msvc solution file, cmake will be configured for release. This means the release version of the libraries in vcpkg will be used even if you choose debug in visual studio. You can use a utility like cmake-gui to change the build type from release to debug and then configure and generate again.
You can also use cmake-gui to create the initial solution file. When you configure for the first time, select your compiler and select the option: Select toolchain file for cross-compiling. The file you should be using is <vcpkg-install-path>\scripts\buildsystems\vcpkg.cmake
Alternately, Visual Studio should automatically detect that you are running a CMAKE project if you open the root LMMS folder. You will however need to set the QT path in CMakeSettings.json
. This can easily be managed by right clicking on CMakeSettings.json
and selecting Edit CMake Settings
. Then scroll down to the Qt5_DIR
variable and browser for the QT installation folder, then go into the version you have downloaded and navigate to msvc2019_64/lib/cmake
. You will also need to set the CMake toolchain file to your vcpkg/cmake (i.e C:/vcpkg/scripts/buildsystems/vcpkg.cmake
). This should automatically populate the rest of the environment variables regarding the locations for the libraries you downloaded through vcpkg, which can be found in the packages
folder of wherever you installed vcpkg. If that doesn't work, you'll need to set the variables yourself, but its a bit of a pain, so try restarting VS. Click 'Show advanced variables' to ensure you always see the variables you need. Try and populate all the missing _DIR
(root folder), _INCLUDE_DIR
('include' folder), and _LIBRARY
(the .lib file in 'library'). When inputting paths, use \
in the paths and not /
(the 'browse' button seems to use /
which don't seem to save/properly).
Note: Visual Studio can be very strange, and sometimes you may have to do some fudging around with saving the CMakeSettings.json file, cleaning, rebuilding, restarting visual studio etc to get lmms building…
When building, select the 'lmms.exe (Install)' option. It may complain about Perl being missing. If so, you can install Perl and set the appropriate environment variable.
If you have WSL installed, you can use the Linux commands instead.
NOTE: You have to type bash
into Command Prompt in order to use Linux commands.
...nothing here yet, want to add something?