diff options
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | README.md | 53 | ||||
-rw-r--r-- | tools/windows_buildenv.bat | 116 |
3 files changed, 153 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore index c21f958e1b..844f37b6ee 100644 --- a/.gitignore +++ b/.gitignore @@ -62,3 +62,13 @@ compile_commands.json # Exclude buildenv directory from our helper scripts /buildenv/ + +# CMake build configurations, generated by tools/windows_buildenv.bat +CMakeSettings.json + +# Build and distribution directories for various build configurations +/build/ +/install/ + +# VisualStudio project files +/.vs/ @@ -31,24 +31,42 @@ Have a bug or feature request? [File a bug on Launchpad][fileabug]. Want to get involved in Mixxx development? Assign yourself a bug from the [easy bug list][easybugs] and get started! -## Compiling - -* macOS [![Build Status](https://travis-ci.org/mixxxdj/mixxx.svg)](https://travis-ci.org/mixxxdj/mixxx) -* Ubuntu / Windows [![Build status](https://ci.appveyor.com/api/projects/status/j460rficblcaopwx?svg=true)](https://ci.appveyor.com/project/mixxxdj/mixxx) -* Jenkins [![Build status](https://img.shields.io/jenkins/s/https/builds.mixxx.org/job/master-release.svg)](https://builds.mixxx.org/job/master-release) - -First, you must install all of Mixxx's dependencies. To compile Mixxx using -[CMake], run: - +## Compiling on Linux $ mkdir build $ cd build $ cmake .. $ cmake --build . +Please see our helpful guide on the [wiki] for more information: [Compiling on Linux] -Please see our helpful guides on the [wiki] for more information: -- [Compiling on Linux] -- [Compiling on macOS] -- [Compiling on Windows] +## Compiling on MacOS + $ mkdir build + $ cd build + $ cmake .. + $ cmake --build . +Please see our helpful guide on the [wiki] for more information: [Compiling on MacOS] + +## Compiling on Windows +### Build Requirements +- Windows 7 or later +- MS Visual Studio 2019 (Community Edition is free of charge) +- At least 10G free diskspace +- To create an .msi installer, you need to install the WiX toolkit from https://wixtoolset.org/releases/ +### Setup your build environment +1. Download these sources (using git checkout as described in [Using Git]) +2. Run the batch file `tools\windows_buildenv.bat` + - This file downloads the prebuild Mixxx environment, defined in `cmake\windows_build_environment_name` from https://downloads.mixxx.org/builds/buildserver/2.3.x-windows/ + - Generates the `CMakeSettings.json` with the matching build configurations for Visual Studio +3. Start Visual Studio, choose "Open a local folder" select the `mixxx` directory containing `CMakeSettings.json` +4. Menu "Project" -> "Generate Cache for mixxx" +5. Select the build configuration in the toolbar (`x64__fastbuild` is recommended) +6. Menu "Build" -> "Build All" +### Creating an .msi installer (optional) +7. Than open the Visual Studio 'Developer Command Prompt' by Menu -> "Tools" -> "Command line" -> "Developer Command Prompt" +8. Go to your build directory, e.g. by "cd .\build\x64-fastbuild" +9. Run "cpack -G WIX" + + +Please see also our helpful guide on the [wiki] for more information: [Compiling on Windows] ## Documentation @@ -94,12 +112,13 @@ license. [facebook]: https://www.facebook.com/pages/Mixxx-DJ-Software/21723485212 [blog]: https://mixxxblog.blogspot.com [manual]: https://www.mixxx.org/manual/latest/ -[wiki]: https://www.mixxx.org/wiki/ +[wiki]: https://github.com/mixxxdj/mixxx/wiki [faq]: https://mixxx.org/wiki/doku.php/faq [forums]: https://www.mixxx.org/forums/ -[compiling on linux]: https://mixxx.org/wiki/doku.php/compiling_on_linux -[compiling on macOS]: https://mixxx.org/wiki/doku.php/compiling_on_os_x -[compiling on windows]: https://mixxx.org/wiki/doku.php/compiling_on_windows +[Compiling on Linux]: https://github.com/mixxxdj/mixxx/wiki/Compiling%20on%20Linux +[Compiling on MacOS]: https://github.com/mixxxdj/mixxx/wiki/Compiling%20on%20macOS +[Compiling on Windows]: https://github.com/mixxxdj/mixxx/wiki/compiling-on-windows +[Using Git]: https://github.com/mixxxdj/mixxx/wiki/Using-Git [mailing list]: https://lists.sourceforge.net/lists/listinfo/mixxx-devel [CMake]: https://cmake.org/ [launchpad 2.3.0]: https://launchpad.net/mixxx/+milestone/2.3.0 diff --git a/tools/windows_buildenv.bat b/tools/windows_buildenv.bat index e27ff8bfd6..1f1960a79b 100644 --- a/tools/windows_buildenv.bat +++ b/tools/windows_buildenv.bat @@ -16,12 +16,26 @@ IF NOT DEFINED BUILDENV_BASEPATH ( SET BUILDENV_BASEPATH=%MIXXX_ROOT%\buildenv ) -CALL :COMMAND_%1 +IF NOT DEFINED BUILD_ROOT ( + SET BUILD_ROOT=%MIXXX_ROOT%\build +) + +IF NOT DEFINED INSTALL_ROOT ( + SET INSTALL_ROOT=%MIXXX_ROOT%\install +) + +IF "%~1"=="" ( + REM In case of manual start by double click no arguments are specified: Default to COMMAND_setup + CALL :COMMAND_setup + PAUSE +) ELSE ( + CALL :COMMAND_%1 +) + EXIT /B 0 :COMMAND_name CALL :READ_ENVNAME - ECHO "%RETVAL%" IF DEFINED GITHUB_ENV ( ECHO BUILDENV_NAME=!RETVAL! >> !GITHUB_ENV! ) @@ -32,24 +46,40 @@ EXIT /B 0 SET BUILDENV_NAME=%RETVAL% SET BUILDENV_PATH=%BUILDENV_BASEPATH%\%BUILDENV_NAME% - IF NOT EXIST %BUILDENV_BASEPATH% ( - MD %BUILDENV_BASEPATH% + IF NOT DEFINED GITHUB_ENV ( + CALL :GENERATE_CMakeSettings_JSON + + IF NOT EXIST %BUILDENV_BASEPATH% ( + ECHO ### Create subdirectory buildenv ### + MD %BUILDENV_BASEPATH% + ) + + IF NOT EXIST %BUILD_ROOT% ( + ECHO ### Create subdirectory build ### + MD %BUILD_ROOT% + ) + + IF NOT EXIST %INSTALL_ROOT% ( + ECHO ### Create subdirectory install ### + MD %INSTALL_ROOT% + ) ) IF NOT EXIST %BUILDENV_PATH% ( - SET BUILDENV_URL=https://downloads.mixxx.org/builds/buildserver/2.3.x-windows/%BUILDENV_NAME%.zip + ECHO ### Download prebuild build environment ### + SET BUILDENV_URL=https://downloads.mixxx.org/builds/buildserver/2.3.x-windows/!BUILDENV_NAME!.zip IF NOT EXIST !BUILDENV_PATH!.zip ( - ECHO Downloading !BUILDENV_URL! + ECHO ### Download prebuild build environment from !BUILDENV_URL! to !BUILDENV_PATH!.zip ### BITSADMIN /transfer buildenvjob /download /priority normal !BUILDENV_URL! !BUILDENV_PATH!.zip REM TODO: verify download using sha256sum? ) - ECHO Unpacking !BUILDENV_PATH!.zip + ECHO ### Unpacking !BUILDENV_PATH!.zip ### CALL :UNZIP "!BUILDENV_PATH!.zip" "!BUILDENV_BASEPATH!" - ECHO Unpacking complete. + ECHO ### Unpacking complete. ### DEL /f /q %BUILDENV_PATH%.zip ) - ECHO Using build environment: !BUILDENV_PATH! + ECHO ### Build environment path: !BUILDENV_PATH! ### ENDLOCAL SET PATH=!BUILDENV_PATH!\bin;!PATH! @@ -92,8 +122,76 @@ EXIT /B 0 :READ_ENVNAME + ECHO ### Read name of prebuild environment from: %MIXXX_ROOT%\packaging\windows\build_environment ### SET /P BUILDENV_NAME=<%MIXXX_ROOT%\packaging\windows\build_environment SET BUILDENV_NAME=!BUILDENV_NAME:PLATFORM=%PLATFORM%! SET BUILDENV_NAME=!BUILDENV_NAME:CONFIGURATION=%CONFIGURATION%! SET RETVAL=%BUILDENV_NAME% + ECHO "%RETVAL%" + GOTO :EOF + +:GENERATE_CMakeSettings_JSON +REM Generate CMakeSettings.json which is read by MS Visual Studio to determine the supported CMake build environments + SET CMakeSettings=%MIXXX_ROOT%\CMakeSettings.json + IF EXIST %CMakeSettings% ( + ECHO ### CMakeSettings.json exist: Rename old file to CMakeSettings__YYYY-MM-DD_HH-MM-SS.json ### + FOR /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set DateTime=%%a + REN %CMakeSettings% CMakeSettings__!DateTime:~0,4!-!DateTime:~4,2!-!DateTime:~6,2!_!DateTime:~8,2!-!DateTime:~10,2!-!DateTime:~12,2!.json + ) + ECHO ### Create new CMakeSettings.json ### + >>%CMakeSettings% echo { + >>%CMakeSettings% echo "configurations": [ + SET configElementTermination=, + CALL :Configuration2CMakeSettings_JSON off Debug + CALL :Configuration2CMakeSettings_JSON legacy RelWithDebInfo + CALL :Configuration2CMakeSettings_JSON portable RelWithDebInfo + CALL :Configuration2CMakeSettings_JSON fastbuild RelWithDebInfo + SET configElementTermination= + CALL :Configuration2CMakeSettings_JSON native Release + >>%CMakeSettings% echo ] + >>%CMakeSettings% echo } GOTO :EOF + +:Configuration2CMakeSettings_JSON <optimize> <configurationtype> + >>%CMakeSettings% echo { + >>%CMakeSettings% echo "buildRoot": "${projectDir}\\build\\!PLATFORM!__%1", + >>%CMakeSettings% echo "configurationType": "%2", + >>%CMakeSettings% echo "enableClangTidyCodeAnalysis": true, + >>%CMakeSettings% echo "generator": "Ninja", + >>%CMakeSettings% echo "inheritEnvironments": [ "msvc_!PLATFORM!_!PLATFORM!" ], + >>%CMakeSettings% echo "installRoot": "${projectDir}\\install\\!PLATFORM!__%1", + >>%CMakeSettings% echo "intelliSenseMode": "windows-msvc-!PLATFORM!", + >>%CMakeSettings% echo "name": "!PLATFORM!__%1", + >>%CMakeSettings% echo "variables": [ + SET variableElementTermination=, + CALL :AddCMakeVar2CMakeSettings_JSON "BATTERY" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "BROADCAST" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "BULK" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "CMAKE_EXPORT_COMPILE_COMMANDS" "BOOL" "true" + REM Replace all \ by \\ in CMAKE_PREFIX_PATH + CALL :AddCMakeVar2CMakeSettings_JSON "CMAKE_PREFIX_PATH" "PATH" "!CMAKE_PREFIX_PATH:\=\\!" + CALL :AddCMakeVar2CMakeSettings_JSON "DEBUG_ASSERTIONS_FATAL" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "HID" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "HSS1394" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "KEYFINDER" "BOOL" "false" + CALL :AddCMakeVar2CMakeSettings_JSON "LOCALECOMPARE" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "LILV" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "MAD" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "MEDIAFOUNDATION" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "OPUS" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "OPTIMIZE" "STRING" "%1" + CALL :AddCMakeVar2CMakeSettings_JSON "QTKEYCHAIN" "BOOL" "true" + CALL :AddCMakeVar2CMakeSettings_JSON "STATIC_DEPS" "BOOL" "true" + SET variableElementTermination= + CALL :AddCMakeVar2CMakeSettings_JSON "VINYLCONTROL" "BOOL" "true" + >>%CMakeSettings% echo ] + >>%CMakeSettings% echo }!configElementTermination! + GOTO :EOF + +:AddCMakeVar2CMakeSettings_JSON <varname> <vartype> <value> + >>%CMakeSettings% echo { + >>%CMakeSettings% echo "name": %1, + >>%CMakeSettings% echo "type": %2, + >>%CMakeSettings% echo "value": %3 + >>%CMakeSettings% echo }!variableElementTermination! + GOTO :EOF |