diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 904e41b3dd95..fdd34a0e2e44 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,8 +10,12 @@ jobs: fail-fast: false matrix: include: - - name: Ubuntu 20.04 (gcc) + - name: Ubuntu 20.04 (gcc) Qt5 os: ubuntu-20.04 + workspace: /home/runner/mixxx + artifacts_path: /home/runner/mixxx/build/*.deb + artifacts_name: Ubuntu 20.04 DEB + artifacts_slug: ubuntu-focal cmake_args: >- -DWARNINGS_FATAL=ON -DBULK=ON @@ -21,18 +25,19 @@ jobs: -DMODPLUG=ON -DWAVPACK=ON -DINSTALL_USER_UDEV_RULES=OFF + cmake_generator: Unix Makefiles ctest_args: compiler_cache: ccache compiler_cache_path: ~/.ccache cpack_generator: DEB - buildenv_basepath: /home/runner/buildenv buildenv_script: tools/debian_buildenv.sh - artifacts_name: Ubuntu 20.04 DEB - artifacts_path: build/*.deb - artifacts_slug: ubuntu-focal qt_qpa_platform: offscreen - - name: macOS 10.15 + - name: macOS 10.15 Qt5 os: macos-10.15 + workspace: /Users/runner/mixxx + artifacts_path: /Users/runner/mixxx/build/*.dmg + artifacts_name: macOS DMG + artifacts_slug: macos-macosintel cmake_args: >- -DBULK=ON -DCOREAUDIO=ON @@ -40,23 +45,21 @@ jobs: -DMACOS_BUNDLE=ON -DMODPLUG=OFF -DWAVPACK=OFF + cmake_generator: Ninja # TODO: Fix this broken test on macOS ctest_args: --exclude-regex DirectoryDAOTest.relocateDirectory cpack_generator: DragNDrop compiler_cache: ccache compiler_cache_path: /Users/runner/Library/Caches/ccache - buildenv_basepath: /Users/runner/buildenv - buildenv_script: tools/macos_buildenv.sh - artifacts_name: macOS DMG - artifacts_path: build/*.dmg - artifacts_slug: macos-macosintel qt_qpa_platform: offscreen - - name: Windows 2019 (MSVC) + - name: Windows 2019 (MSVC) Qt5 os: windows-2019 + # The D drive runs out of space when building dependencies with vcpkg. + workspace: C:\mixxx + artifacts_path: C:/mixxx/build/*.msi + artifacts_name: Windows Installer + artifacts_slug: windows-win64 # TODO: Re-enable FFmpeg after licensing issues have been clarified - # Attention: If you change the cmake_args for the Windows CI build, - # also adjust the for the local Windows build setup in - # ./tools/windows_buildenv.bat cmake_args: >- -DBULK=OFF -DFFMPEG=OFF @@ -66,18 +69,15 @@ jobs: -DMEDIAFOUNDATION=ON -DMODPLUG=ON -DWAVPACK=ON + cmake_generator: Ninja cc: cl cxx: cl # TODO: Fix these broken tests on Windows ctest_args: --exclude-regex '^AutoDJProcessorTest.*$' cpack_generator: WIX + exe_suffix: .exe compiler_cache: sccache compiler_cache_path: C:\Users\runneradmin\AppData\Local\Mozilla\sccache\cache - buildenv_basepath: C:\buildenv - buildenv_script: tools/windows_buildenv.bat - artifacts_name: Windows Installer - artifacts_path: build/*.msi - artifacts_slug: windows-win64 qt_qpa_platform: windows env: @@ -114,8 +114,10 @@ jobs: run: cargo install --git https://github.com/mozilla/sccache.git --rev "${SCCACHE_COMMIT}" - name: "Check out repository" - uses: actions/checkout@v2 + uses: LebedevRI/checkout@issue197 with: + path: ${{ matrix.workspace }} + submodules: true # This is necessary for making `git describe` work. fetch-depth: 0 @@ -124,37 +126,33 @@ jobs: # workflow is triggered by a tag push event. # Possibly related: actions/checkout#290 run: git fetch origin --force --tags - - - name: "[macOS] Set up cmake" - uses: jwlawson/actions-setup-cmake@v1.9 - # Ubuntu 20.04 should use the CMake version from the repos, and Visual - # Studio on Windows comes with its own CMake version anyway. - if: runner.os == 'macOS' - with: - # This should always match the minimum required version in - # our CMakeLists.txt - cmake-version: '3.16.x' + working-directory: ${{ matrix.workspace }} - name: "[Windows] Set up MSVC Developer Command Prompt" if: runner.os == 'Windows' uses: seanmiddleditch/gha-setup-vsdevenv@v3 - - name: "[macOS] install ccache and make" + - name: "[macOS] install dependencies" if: runner.os == 'macOS' + # nasm is needed for building ffmpeg + # automake is needed for building libusb run: | - brew install ccache ninja - - - name: "[macOS/Windows] Get build environment name" - if: runner.os != 'Linux' - id: buildenv_name - run: ${{ matrix.buildenv_script }} name - - - name: "[macOS/Windows] Set up build environment cache" - if: runner.os != 'Linux' - uses: actions/cache@v2 - with: - path: ${{ matrix.buildenv_basepath }} - key: ${{ runner.os }}-buildenv-${{ env.BUILDENV_NAME }} + brew install ccache ninja nasm automake + + - name: "[Ubuntu] Install dependencies" + if: runner.os == 'Linux' + run: tools/debian_buildenv.sh + working-directory: ${{ matrix.workspace }} + + # GitHub Actions installs a recent version of CMake which is in + # $PATH before system packages from apt. This ensures that Mixxx + # builds with the version of CMake in the minimum supported + # Ubuntu LTS. Old versions of CMake should not be used on Windows + # or macOS because they may not work with vcpkg. + - name: "[Ubuntu] Use CMake version from apt" + if: startsWith(matrix.os, 'ubuntu') + run: sudo rm cmake cpack ctest + working-directory: /usr/local/bin - name: "[macOS] Import Apple code signing identity" id: apple_codesign @@ -163,7 +161,7 @@ jobs: # Decrypt the certificate openssl enc -aes-256-cbc -d -md sha512 \ -k "${MACOS_CODESIGN_OPENSSL_PASSWORD}" \ - -in /Users/runner/work/mixxx/mixxx/packaging/certificates/macos_developer_id_codesign_certificate.p12.enc \ + -in ${{ matrix.workspace }}/packaging/certificates/macos_developer_id_codesign_certificate.p12.enc \ -out ~/certificate.p12 # Create a temporary keychain for the certificate and import it. @@ -180,7 +178,7 @@ jobs: - name: "[Windows] Set up Windows code signing" env: - WINDOWS_CODESIGN_CERTIFICATE_PATH: ${{ github.workspace }}\packaging\certificates\windows_sectigo_codesign_certificate.pfx + WINDOWS_CODESIGN_CERTIFICATE_PATH: ${{ matrix.workspace }}\packaging\certificates\windows_sectigo_codesign_certificate.pfx WINDOWS_CODESIGN_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_CERTIFICATE_PASSWORD }} WINDOWS_CODESIGN_SECURE_FILE_SALT: ${{ secrets.WINDOWS_CODESIGN_SECURE_FILE_SALT }} WINDOWS_CODESIGN_SECURE_FILE_SECRET: ${{ secrets.WINDOWS_CODESIGN_SECURE_FILE_SECRET }} @@ -192,11 +190,31 @@ jobs: Add-Content -Path "$Env:GITHUB_ENV" -Value "WINDOWS_CODESIGN_CERTIFICATE_PASSWORD=$Env:WINDOWS_CODESIGN_CERTIFICATE_PASSWORD" Add-Content -Path "$Env:GITHUB_ENV" -Value "CMAKE_ARGS_EXTRA=-DWINDOWS_CODESIGN=ON" - - name: "Set up build environment" - id: buildenv - run: ${{ matrix.buildenv_script }} setup - env: - BUILDENV_BASEPATH: ${{ matrix.buildenv_basepath }} + - name: "Authenticate to GitHub Packages" + if: runner.os != 'Linux' && github.repository_owner == 'mixxxdj' + shell: bash + run: | + nuget sources add -Name mixxx-github-packages -Source https://nuget.pkg.github.com/mixxxdj/index.json -Username mixxxdj -Password ${{ secrets.GITHUB_TOKEN }} -NonInteractive + nuget setapikey ${{ secrets.GITHUB_TOKEN }} -Source mixxx-github-packages -NonInteractive + echo "VCPKG_BINARY_SOURCES=clear;nuget,mixxx-github-packages,readwrite;" >> "${GITHUB_ENV}" + + - name: Get Git commit of vcpkg submodule + if: runner.os != 'Linux' + shell: bash + run: echo VCPKG_COMMIT=$(git ls-tree HEAD vcpkg | awk '{print $3}') >> "${GITHUB_ENV}" + working-directory: ${{ matrix.workspace }} + + # Caching the vcpkg_installed directory is faster than downloading + # packages with NuGet each run. + # Cache the vcpkg executable to avoid bootstrapping each time. + - name: "Setup vcpkg cache" + uses: actions/cache@v2 + if: runner.os != 'Linux' + with: + path: | + ${{ matrix.workspace }}/build/vcpkg_installed + ${{ matrix.workspace }}/vcpkg/vcpkg${{ matrix.exe_suffix }} + key: vcpkg-${{ matrix.name }}-${{ env.VCPKG_COMMIT }} - name: "[Ubuntu/macOS] Set compiler cache size limit" # A full build without a cache fills the cache with about 300 MB. @@ -216,12 +234,10 @@ jobs: ${{ matrix.os }}-${{ matrix.compiler_cache }}-${{ github.head_ref }} ${{ matrix.os }}-${{ matrix.compiler_cache }} - - name: "Create build directory" - run: mkdir build - - name: "Configure" run: >- cmake ${{ matrix.cmake_args }} ${{ env.CMAKE_ARGS_EXTRA }} + -G "${{ matrix.cmake_generator }}" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_PREFIX_PATH="${{ env.CMAKE_PREFIX_PATH }}" -DDEBUG_ASSERTIONS_FATAL=OFF @@ -236,8 +252,9 @@ jobs: -DVINYLCONTROL=ON -DCMAKE_VERBOSE_MAKEFILE=OFF -L - .. - working-directory: build + -S . + -B build + working-directory: ${{ matrix.workspace }} env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} @@ -252,7 +269,7 @@ jobs: - name: "Build" run: cmake --build . --config RelWithDebInfo - working-directory: build + working-directory: ${{ matrix.workspace }}/build env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} @@ -266,7 +283,7 @@ jobs: - name: "Test" run: ctest --timeout 45 ${{ matrix.ctest_args }} - working-directory: build + working-directory: ${{ matrix.workspace }}/build env: # Render analyzer waveform tests to an offscreen buffer QT_QPA_PLATFORM: ${{ matrix.qt_qpa_platform }} @@ -277,14 +294,14 @@ jobs: - name: Benchmark run: cmake --build . --target mixxx-benchmark --config RelWithDebInfo - working-directory: build + working-directory: ${{ matrix.workspace }}/build env: # Render analyzer waveform tests to an offscreen buffer QT_QPA_PLATFORM: ${{ matrix.qt_qpa_platform }} - name: "Package" run: cpack -G ${{ matrix.cpack_generator }} -V - working-directory: build + working-directory: ${{ matrix.workspace }}/build - name: "[Ubuntu] Import PPA GPG key" if: startsWith(matrix.os, 'ubuntu') && env.RRYAN_AT_MIXXX_DOT_ORG_GPG_PRIVATE_KEY != null @@ -305,11 +322,12 @@ jobs: CPACK_ARGS="-D DEB_SOURCEPKG=ON" fi cpack -G External $CPACK_ARGS - working-directory: build + working-directory: ${{ matrix.workspace }}/build - name: "[macOS] Sign, Notarize, and Staple Package" if: runner.os == 'macOS' && env.MACOS_CODESIGN_OPENSSL_PASSWORD != null && env.MACOS_CODESIGN_CERTIFICATE_PASSWORD != null && env.APPLE_APP_SPECIFIC_PASSWORD != null run: packaging/macos/sign_notarize_staple.sh build/*.dmg + working-directory: ${{ matrix.workspace }} env: APPLE_ID_USERNAME: rryan@mixxx.org APPLE_BUNDLE_ID: org.mixxx.mixxx @@ -319,7 +337,7 @@ jobs: - name: "[Windows] Sign Package" if: runner.os == 'Windows' && env.WINDOWS_CODESIGN_CERTIFICATE_PATH != null && env.WINDOWS_CODESIGN_CERTIFICATE_PASSWORD != null run: signtool sign /f $Env:WINDOWS_CODESIGN_CERTIFICATE_PATH /p $Env:WINDOWS_CODESIGN_CERTIFICATE_PASSWORD *.msi - working-directory: build + working-directory: ${{ matrix.workspace }}/build - name: "Prepare for deployment" # Copy the desired directory structure to the deploy/ directory. This @@ -328,6 +346,7 @@ jobs: id: prepare_deploy if: github.event_name == 'push' shell: bash + working-directory: ${{ matrix.workspace }} run: > if [[ "${GITHUB_REF}" =~ ^refs/tags/.* ]]; then @@ -393,6 +412,7 @@ jobs: # skip deploying Ubuntu builds to downloads.mixxx.org because these are deployed to the PPA if: runner.os != 'Linux' && github.event_name == 'push' && env.SSH_AUTH_SOCK != null shell: bash --login -eo pipefail "{0}" + working-directory: ${{ matrix.workspace }} run: rsync --verbose --recursive --checksum --times --delay-updates "deploy/" "${SSH_USER}@${SSH_HOST}:${DESTDIR}/" env: DESTDIR: public_html/downloads @@ -412,6 +432,17 @@ jobs: name: ${{ matrix.artifacts_name }} path: ${{ matrix.artifacts_path }} + - name: Upload GitHub Actions artifacts of vcpkg logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: vcpkg-logs-${{ matrix.name }} + path: | + ${{ matrix.workspace }}/vcpkg/buildtrees/**/*.log + ${{ matrix.workspace }}/build/vcpkg-bootstrap.log + ${{ matrix.workspace }}/build/vcpkg-manifest-install.log + if-no-files-found: ignore + update_manifest: name: "Update manifest file on download server" runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index a494144787b9..f6d46800d9b8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,6 @@ compile_commands.json # Doxygen documentation /doxygen -# Exclude buildenv directory from our helper scripts -/buildenv - # CMake build configurations, generated by tools/windows_buildenv.bat /CMakeSettings*.json diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000000..9fc0d3683cee --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/mixxxdj/vcpkg.git diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 000000000000..d25a2b762186 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,178 @@ +# Mixxx Build Documentation + +## Download Mixxx source code + +First, if you do not have Git installed already, +[install Git](https://git-scm.com/downloads). Once you have Git +installed, run the following command in a terminal to download +the mixxx source code: + + git clone https://github.com/mixxxdj/mixxx.git + +Then, enter the mixxx code repository: + + cd mixxx + +## Install build tools + +### Debian, Ubuntu, and derived distributions + +On Debian, Ubuntu, and derived Linux distributions, there is a script +in the mixxx repository that will install the required packages: + + tools/debian_buildenv.sh + +### Fedora + +If you do not already have the [RPM Fusion](https://rpmfusion.org) free repository installed: + + sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm + +The RPM Fusion nonfree repository is not required. + +Then: + + sudo dnf builddep mixxx + sudo dnf install gcc-c++ ccache ninja-build qt5-qtdeclarative-devel qt5-qtquickcontrols qt5-qtquickcontrols2 + +### macOS + +First, install the XCode C++ toolchain: + + xcode-select --install + +Then install more development tools from [Homebrew](https://brew.sh): + + brew install cmake ccache ninja nasm automake mono + +Do *not* install Mixxx's dependencies from Homebrew; only install the build tools +listed above. CMake will automatically download Mixxx's dependencies with vcpkg. + +Mixxx does not support ARM macOS builds yet, but the build system will build x86-64 +executables from ARM macOS which run fine on ARM macOS. We will not be able to +build Mixxx for ARM macOS until we switch to Qt6. + +### Windows + +Using the [Visual Studio installer](https://visualstudio.microsoft.com/downloads/), +install the `Desktop development with C++` and `Python development` workloads +(Python is needed for +[pre-commit](https://github.com/mixxxdj/mixxx/wiki/Using%20Git#set-up-automatic-code-checking)). +If you have Windows set to a language other than English, you will also need +to install the English language pack from the `Language packs` tab in the +Visual Studio installer (this is +[required by vcpkg](https://github.com/microsoft/vcpkg/issues/2295)). + +CMake will automatically use vcpkg to download Mixxx's dependencies. + +We highly recommend to install sccache as well to speed up rebuilds. sccache requires +[installing a Rust toolchain](https://www.rust-lang.org/learn/get-started), then: + + cargo install --git https://github.com/mozilla/sccache.git --rev 3f318a8675e4c3de4f5e8ab2d086189f2ae5f5cf + +## Build Mixxx + +The instructions below are for building Mixxx from a command line shell. You +can use the CMake integration in the IDE of your choice instead of these +command line instructions if you prefer. + +On Windows, compiling must be done from a `x64 Native Tools Command Prompt for +VS 2019` shell. Opening a regular cmd or PowerShell prompt will not work. + +First, configure CMake (`-G Ninja` is required on Windows and recommended on +Linux and macOS): + + cmake -G Ninja -S . -B build + +This will create a directory called `build` where the build artifacts will be. +On Windows and macOS, vcpkg will automatically download Mixxx's dependencies +during the first CMake configure step, which will take a few minutes. + +To build Mixxx: + + cmake --build build + +Configuring CMake only needs to be done once, or when changing a CMake option. +If you reconfigure CMake, you will not need to wait for vcpkg to redownload +Mixxx's dependencies unless you delete the `vcpkg_installed` directory inside +the CMake build directory (or delete the whole CMake build directory). After +the initial configuration, when you edit the source code, you only need to +run the build step. + +If you want to switch between different CMake configurations frequently, you +can use separate build directories by replacing `build` in the steps above +with another directory. + +## Run Mixxx + + build/mixxx + +On Linux, if you use Wayland, to get the waveforms to show, you need to run: + + build/mixxx -platform xcb + +On Linux, if you use an ALSA device for Mixxx but otherwise use PulseAudio: + + pasuspender build/mixxx + +This is not necessary with PipeWire. PipeWire releases the ALSA device +so Mixxx can use it if no applications are using it through PipeWire, or +alternatively you can use PipeWire through the JACK API by selecting the JACK +backend in Mixxx's Sound Hardware preferences. + +## Contributing code + +If you want to contribute code to Mixxx, refer to +[Using Git](https://github.com/mixxxdj/mixxx/wiki/Using%20Git) for an overview +of our development workflow and how to set up our automatic code checking with +pre-commit. + +## Command line options + +For information about command line options: + + build/mixxx --help + +## Install Mixxx + +Installing Mixxx is not required to run it. Instead, we recommend running +Mixxx from the CMake build directory as described above. Nevertheless, if +you want to install Mixxx to the default /usr/local prefix, + + sudo cmake --install build + +If you want to install Mixxx elsewhere, you can specify +`-D CMAKE_INSTALL_PREFIX=/some/path` to the CMake configure step. + +If you want to uninstall Mixxx built without a package manager, you need +to keep the CMake build directory and run: + + xargs rm < build/install_manifest.txt + +## Running tests + + cd build + ctest + +## macOS packaging + +To create DMG app bundle installers for macOS, configure CMake with the `MACOS_BUNDLE` option: + + cmake -G Ninja -D MACOS_BUNDLE=ON -S . -B build + +To create a signed package: + + cmake -G Ninja -D MACOS_BUNDLE=ON -D APPLE_CODESIGN_IDENTITY= -S . -B build + +After building Mixxx: + + cd build + cpack -G DragNDrop + +## Windows packaging + +To create an .msi installer, you need to install the [WiX toolset](https://wixtoolset.org/releases/). +After building Mixxx: + + cd build + cpack -G WIX diff --git a/CMakeLists.txt b/CMakeLists.txt index bdecbafc0bbd..ca2c1409e41b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,20 +25,34 @@ if(POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") + +option(QT6 "Build with Qt6" OFF) + # Set up vcpkg -if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED VCPKG_ROOT) - set(VCPKG_ROOT "$ENV{VCPKG_ROOT}") +if(WIN32 OR APPLE) + option(VCPKG "Use vcpkg for dependencies" ON) +else() + option(VCPKG "Use vcpkg for dependencies" OFF) endif() -if(DEFINED VCPKG_ROOT) +if(VCPKG) + if(QT6) + set(VCPKG_MANIFEST_FEATURES "qt6") + else() + set(VCPKG_MANIFEST_FEATURES "qt5") + endif() + set(X_VCPKG_APPLOCAL_DEPS_INSTALL TRUE) + include(InitializeVcpkg) + if(NOT DEFINED VCPKG_OVERLAY_PORTS) set(VCPKG_OVERLAY_PORTS "${VCPKG_ROOT}/overlay/ports") - if(APPLE) - list(APPEND VCPKG_OVERLAY_PORTS "${VCPKG_ROOT}/overlay/osx") + if(APPLE AND NOT QT6) + list(APPEND VCPKG_OVERLAY_PORTS "${VCPKG_ROOT}/overlay/osx") elseif(WIN32) - list(APPEND VCPKG_OVERLAY_PORTS "${VCPKG_ROOT}/overlay/windows") + list(APPEND VCPKG_OVERLAY_PORTS "${VCPKG_ROOT}/overlay/windows") endif() endif() @@ -48,11 +62,80 @@ if(DEFINED VCPKG_ROOT) if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET}) set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}") + else() + if(APPLE) + if(QT6) + set(VCPKG_TARGET_TRIPLET "x64-osx-min10.14") + set(VCPKG_HOST_TRIPLET "x64-osx-min10.14") + else() + set(VCPKG_TARGET_TRIPLET "x64-osx-min10.12") + set(VCPKG_HOST_TRIPLET "x64-osx-min10.12") + endif() + endif() endif() - if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) - set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") + # These are required for binary caching to work reliably across machines. + set(VCPKG_FEATURE_FLAGS "-compilertracking") + set(VCPKG_INSTALL_OPTIONS "--x-abi-tools-use-exact-versions") + + if(NOT DEFINED ENV{VCPKG_BINARY_SOURCES}) + if(WIN32) + set(COMMAND_PREIFX "") + set(EXE_SUFFIX ".exe") + set(SCRIPT_SUFFIX ".bat") + set(DOTNET_RUNTIME "") + else() + set(COMMAND_PREFIX "./") + set(EXE_SUFFIX "") + set(SCRIPT_SUFFIX ".sh") + set(DOTNET_RUNTIME "mono") + endif() + + # vcpkg can download NuGet, so bootstrap vcpkg if the executable is not found. + if(NOT EXISTS "${VCPKG_ROOT}/vcpkg${EXE_SUFFIX}") + message(STATUS "Bootstrapping vcpkg") + execute_process( + COMMAND "${COMMAND_PREFIX}bootstrap-vcpkg${SCRIPT_SUFFIX}" + WORKING_DIRECTORY ${VCPKG_ROOT} + ) + endif() + + message(STATUS "Setting up vcpkg binary caching with read-only access to GitHub Packages NuGet source") + + execute_process( + COMMAND "${COMMAND_PREFIX}vcpkg${EXE_SUFFIX}" fetch nuget + WORKING_DIRECTORY ${VCPKG_ROOT} + OUTPUT_VARIABLE NUGET_FETCH_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REPLACE "\n" ";" NUGET_FETCH_OUTPUT "${NUGET_FETCH_OUTPUT}") + list(POP_BACK NUGET_FETCH_OUTPUT NUGET_EXECUTABLE) + + # NuGet will fail with an error when trying to add a source with the same name + # as one that already exists, so check that the NuGet source has not been added yet. + execute_process( + COMMAND ${DOTNET_RUNTIME} ${NUGET_EXECUTABLE} sources list + OUTPUT_VARIABLE NUGET_SOURCES_LIST + ) + string(FIND "${NUGET_SOURCES_LIST}" "mixxx-github-packages" SEARCH_RESULT) + if(SEARCH_RESULT EQUAL -1) + # GitHub will deactivate a personal access token that gets committed to the repository. + # Hack around this by splitting up the PAT. + # This is safe because this PAT only has read:packages permission. + set(GITHUB_PAT_READ_PACKAGES_SUFFIX Ehdy9eBvDcUjsnfGwXd0gFGmw72e9O2NVaqa) + execute_process( + COMMAND ${DOTNET_RUNTIME} ${NUGET_EXECUTABLE} sources add + -name mixxx-github-packages + -source https://nuget.pkg.github.com/mixxxdj/index.json + -username mixxxdj + -password ghp_${GITHUB_PAT_READ_PACKAGES_SUFFIX} + ) + endif() + + set(ENV{VCPKG_BINARY_SOURCES} "clear;default,readwrite;nuget,mixxx-github-packages,read;") endif() +else() + message(STATUS "Using dependencies from system without vcpkg") endif() # Set a default build type if none was specified @@ -75,8 +158,6 @@ if(NOT CMAKE_CONFIGURATION_TYPES) endif() endif() -option(QT6 "Build with Qt6" OFF) - if(APPLE) if(QT6) # Minimum macOS version supported by Qt 6 @@ -101,7 +182,6 @@ set(BUILD_COLORS "auto" CACHE STRING "Try to use colors auto/always/no") # Option to disable symlinks set(USE_SYMLINKS ON CACHE BOOL "Use symlinks in build directory when possible") -list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules") include(CMakeDependentOption) include(CheckSymbolExists) include(ExternalProject) @@ -1848,7 +1928,7 @@ find_package(SQLite3) if(NOT SQLite3_FOUND) set(LOCALECOMPARE_DEFAULT OFF) else() - is_static_library(SQLite3_IS_STATIC SQLite3::SQLite3) + is_static_library(SQLite3_IS_STATIC SQLite::SQLite3) if(SQLite3_IS_STATIC OR NOT APPLE) set(LOCALECOMPARE_DEFAULT ON) else() @@ -1861,10 +1941,10 @@ if(LOCALECOMPARE) message(FATAL_ERROR "Locale Aware Compare for SQLite requires libsqlite and its development headers.") endif() target_compile_definitions(mixxx-lib PUBLIC __SQLITE3__) - target_link_libraries(mixxx-lib PRIVATE SQLite3::SQLite3) + target_link_libraries(mixxx-lib PRIVATE SQLite::SQLite3) elseif(SQLite3_IS_STATIC) # in the static case we need to link SQLite3 uncoditionally - target_link_libraries(mixxx-lib PRIVATE SQLite3::SQLite3) + target_link_libraries(mixxx-lib PRIVATE SQLite::SQLite3) endif() # Denon Engine Prime library export support (using libdjinterop) @@ -2780,23 +2860,28 @@ if(HID) endif() # USB Bulk controller support -default_option(BULK "USB Bulk controller support" "LibUSB_FOUND") -if(BULK) - if(NOT LibUSB_FOUND) - message(FATAL_ERROR "USB Bulk controller support requires libusb 1.0 and its development headers.") - endif() - target_sources(mixxx-lib PRIVATE - src/controllers/bulk/bulkcontroller.cpp - src/controllers/bulk/bulkenumerator.cpp - ) - if(NOT HID) +# This is for a few old controllers that are not USB class +# compliant and work with proprietary drivers only for +# macOS or Windows. +if(NOT WIN32) + default_option(BULK "USB Bulk controller support" "LibUSB_FOUND") + if(BULK) + if(NOT LibUSB_FOUND) + message(FATAL_ERROR "USB Bulk controller support requires libusb 1.0 and its development headers.") + endif() target_sources(mixxx-lib PRIVATE - src/controllers/hid/legacyhidcontrollermapping.cpp - src/controllers/hid/legacyhidcontrollermappingfilehandler.cpp + src/controllers/bulk/bulkcontroller.cpp + src/controllers/bulk/bulkenumerator.cpp ) + if(NOT HID) + target_sources(mixxx-lib PRIVATE + src/controllers/hid/legacyhidcontrollermapping.cpp + src/controllers/hid/legacyhidcontrollermappingfilehandler.cpp + ) + endif() + target_compile_definitions(mixxx-lib PUBLIC __BULK__) + target_link_libraries(mixxx-lib PRIVATE LibUSB::LibUSB) endif() - target_compile_definitions(mixxx-lib PUBLIC __BULK__) - target_link_libraries(mixxx-lib PRIVATE LibUSB::LibUSB) endif() # Vinyl Control diff --git a/README.md b/README.md index 48369dbd84e8..98033dc023cb 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ To get started with Mixxx: 1. For live use, [download the latest stable version][download-stable]. 2. For experimentation and testing, [download a development release][download-testing]. -3. To live on the bleeding edge, clone the repo: `git clone https://github.com/mixxxdj/mixxx.git` +3. To build Mixxx yourself, refer to [BUILDING.md](BUILDING.md). ## Bug tracker @@ -27,33 +27,6 @@ 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! -## Building Mixxx - -First, open a terminal (on Windows, use "x64 Native Tools Command Prompt for -VS 2019"), download the mixxx source code and navigate to it: - - $ git clone https://github.com/mixxxdj/mixxx.git - $ cd mixxx - -Fetch the required dependencies and set up the build environment (on Windows, -macOS and Debian/Ubuntu, you can do that by running -`tools\windows_buildenv.bat`, `source tools/macos_buildenv.sh setup` or `source -tools/debian_buildenv.sh setup` respectively), then run: - - $ mkdir build - $ cd build - $ cmake .. - $ cmake --build . - -There should now be a `mixxx` executable in the current directory that you can -run. Alternatively, can generate a package using `cpack`. - -More Information can be found on the [wiki]: - -- [Compiling on Linux] -- [Compiling on macOS] -- [Compiling on Windows] - ## Documentation For help using Mixxx, there are a variety of options: diff --git a/cmake/modules/FindSQLite3.cmake b/cmake/modules/FindSQLite3.cmake deleted file mode 100644 index b3b9a959f1ed..000000000000 --- a/cmake/modules/FindSQLite3.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# This file is part of Mixxx, Digital DJ'ing software. -# Copyright (C) 2001-2020 Mixxx Development Team -# Distributed under the GNU General Public Licence (GPL) version 2 or any later -# later version. See the LICENSE file for details. - -#[=======================================================================[.rst: -FindSQLite3 ------------ - -Finds the SQLite3 library. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module provides the following imported targets, if found: - -``SQLite3::SQLite3`` - The SQLite3 library - -Result Variables -^^^^^^^^^^^^^^^^ - -This will define the following variables: - -``SQLite3_FOUND`` - True if the system has the SQLite3 library. -``SQLite3_INCLUDE_DIRS`` - Include directories needed to use SQLite3. -``SQLite3_LIBRARIES`` - Libraries needed to link to SQLite3. -``SQLite3_DEFINITIONS`` - Compile definitions needed to use SQLite3. - -Cache Variables -^^^^^^^^^^^^^^^ - -The following cache variables may also be set: - -``SQLite3_INCLUDE_DIR`` - The directory containing ``sqlite3.h``. -``SQLite3_LIBRARY`` - The path to the SQLite3 library. - -#]=======================================================================] - -find_package(PkgConfig QUIET) -if(PkgConfig_FOUND) - pkg_check_modules(PC_SQLite3 QUIET sqlite3) -endif() - -find_path(SQLite3_INCLUDE_DIR - NAMES sqlite3.h - PATHS ${PC_SQLite3_INCLUDE_DIRS} - PATH_SUFFIXES sqlite sqlite3 - DOC "SQLite3 include directory") -mark_as_advanced(SQLite3_INCLUDE_DIR) - -find_library(SQLite3_LIBRARY - NAMES sqlite3 - PATHS ${PC_SQLite3_LIBRARY_DIRS} - DOC "SQLite3 library" -) -mark_as_advanced(SQLite3_LIBRARY) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - SQLite3 - DEFAULT_MSG - SQLite3_LIBRARY - SQLite3_INCLUDE_DIR -) - -if(SQLite3_FOUND) - set(SQLite3_LIBRARIES "${SQLite3_LIBRARY}") - set(SQLite3_INCLUDE_DIRS "${SQLite3_INCLUDE_DIR}") - set(SQLite3_DEFINITIONS ${PC_SQLite3_CFLAGS_OTHER}) - - if(NOT TARGET SQLite3::SQLite3) - add_library(SQLite3::SQLite3 UNKNOWN IMPORTED) - set_target_properties(SQLite3::SQLite3 - PROPERTIES - IMPORTED_LOCATION "${SQLite3_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_SQLite3_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIR}" - ) - endif() -endif() diff --git a/cmake/modules/InitializeVcpkg.cmake b/cmake/modules/InitializeVcpkg.cmake new file mode 100644 index 000000000000..e3cf34e0a82b --- /dev/null +++ b/cmake/modules/InitializeVcpkg.cmake @@ -0,0 +1,48 @@ +#[=======================================================================[.rst: +InitializeVcpkg +--------------- + +Initialize a vcpkg Git submodule, or alternatively use a vcpkg repository +at a path specified by ``VCPKG_ROOT``. Whether vcpkg is used is controlled +by the ``VCPKG`` option, which defaults to `ON`. + +This module must be included before the first call to `project()`. + +#]=======================================================================] + +option(VCPKG "Use vcpkg for dependencies" ON) +set(VCPKG_ROOT "${CMAKE_SOURCE_DIR}/vcpkg" CACHE STRING "Path to the vcpkg Git repository") + +if(VCPKG) + if(NOT VCPKG_ROOT STREQUAL "${CMAKE_SOURCE_DIR}/vcpkg") + message(STATUS "Using dependencies from vcpkg repository at ${VCPKG_ROOT}") + + if(NOT EXISTS "${VCPKG_ROOT}/.vcpkg-root") + message(FATAL_ERROR "${VCPKG_ROOT} is not a valid vcpkg root directory. Set VCPKG_ROOT to a root directory of a vcpkg Git repository.") + endif() + else() + message(STATUS "Using dependencies from vcpkg Git submodule") + set(VCPKG_ROOT "${CMAKE_SOURCE_DIR}/vcpkg") + + if(NOT EXISTS "${VCPKG_ROOT}/.vcpkg-root") + find_package(Git) + if(NOT GIT_FOUND) + message(FATAL_ERROR "Unable to initialize vcpkg Git submodule because CMake was unable to find a git executable.") + endif() + + message(STATUS "Initializing vcpkg Git submodule") + execute_process( + COMMAND ${GIT_EXECUTABLE} submodule init + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + ) + execute_process( + COMMAND ${GIT_EXECUTABLE} submodule update + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + ) + endif() + endif() + + set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake") +else() + message(STATUS "Using dependencies from system") +endif() diff --git a/packaging/macos/build_environment b/packaging/macos/build_environment deleted file mode 100644 index 0abbc386f60a..000000000000 --- a/packaging/macos/build_environment +++ /dev/null @@ -1,2 +0,0 @@ -mixxx-deps-2.4-x64-osx-058063e -4ebfc80e20031bfe52589416a8465a07ef09ef8546a8d41b43c57e2c764a7545 diff --git a/packaging/windows/build_environment b/packaging/windows/build_environment deleted file mode 100644 index 8afcbecc26e6..000000000000 --- a/packaging/windows/build_environment +++ /dev/null @@ -1 +0,0 @@ -mixxx-deps-2.4-x64-windows-058063e diff --git a/tools/debian_buildenv.sh b/tools/debian_buildenv.sh index d478cb0bd730..a48f34fd8d36 100755 --- a/tools/debian_buildenv.sh +++ b/tools/debian_buildenv.sh @@ -3,99 +3,67 @@ # shellcheck disable=SC1091 set -o pipefail -case "$1" in - name) - echo "No build environment name required for Debian based distros." >&2 - echo "This script installs the build dependencies via apt using the \"setup\" option." >&2 - ;; +sudo apt-get update - setup) - source /etc/lsb-release 2>/dev/null - case "${DISTRIB_CODENAME}" in - bionic) # Ubuntu 18.04 LTS - PACKAGES_EXTRA=( - libmp4v2-dev - ) - ;; - *) # libmp4v2 was removed from Debian 10 & Ubuntu 20.04 due to lack of maintenance, so use FFMPEG instead - PACKAGES_EXTRA=( - libavformat-dev - ) - esac +# If jackd2 is installed as per dpkg database, install libjack-jackd2-dev. +# This avoids a package deadlock, resulting in jackd2 being removed, and jackd1 being installed, +# to satisfy portaudio19-dev's need for a jackd dev package. In short, portaudio19-dev needs a +# jackd dev library, so let's give it one.. +if [ "$(dpkg-query -W -f='${Status}' jackd2 2>/dev/null | grep -c "ok installed")" -eq 1 ]; then + sudo apt-get install libjack-jackd2-dev; +fi - sudo apt-get update - - # If jackd2 is installed as per dpkg database, install libjack-jackd2-dev. - # This avoids a package deadlock, resulting in jackd2 being removed, and jackd1 being installed, - # to satisfy portaudio19-dev's need for a jackd dev package. In short, portaudio19-dev needs a - # jackd dev library, so let's give it one.. - if [ "$(dpkg-query -W -f='${Status}' jackd2 2>/dev/null | grep -c "ok installed")" -eq 1 ]; - then - sudo apt-get install libjack-jackd2-dev; - fi - - - sudo apt-get install -y --no-install-recommends -- \ - ccache \ - cmake \ - clazy \ - clang-tidy \ - debhelper \ - devscripts \ - docbook-to-man \ - dput \ - fonts-open-sans \ - fonts-ubuntu \ - g++ \ - lcov \ - libchromaprint-dev \ - libdistro-info-perl \ - libebur128-dev \ - libfaad-dev \ - libfftw3-dev \ - libflac-dev \ - libhidapi-dev \ - libid3tag0-dev \ - liblilv-dev \ - libmad0-dev \ - libmodplug-dev \ - libmp3lame-dev \ - libopus-dev \ - libopusfile-dev \ - libportmidi-dev \ - libprotobuf-dev \ - libqt5opengl5-dev \ - libqt5sql5-sqlite \ - libqt5svg5-dev \ - libqt5x11extras5-dev \ - librubberband-dev \ - libshout-idjc-dev \ - libsndfile1-dev \ - libsoundtouch-dev \ - libsqlite3-dev \ - libssl-dev \ - libtag1-dev \ - libudev-dev \ - libupower-glib-dev \ - libusb-1.0-0-dev \ - libwavpack-dev \ - markdown \ - portaudio19-dev \ - protobuf-compiler \ - qt5keychain-dev \ - qtdeclarative5-dev \ - qml-module-qtquick-controls \ - qml-module-qtquick-controls2 \ - qml-module-qt-labs-qmlmodels \ - qml-module-qtquick-shapes \ - "${PACKAGES_EXTRA[@]}" - ;; - *) - echo "Usage: $0 [options]" - echo "" - echo "options:" - echo " help Displays this help." - echo " name Displays the name of the required build environment." - echo " setup Installs the build environment." - ;; -esac +sudo apt-get install -y --no-install-recommends -- \ +ccache \ +cmake \ +clazy \ +clang-tidy \ +debhelper \ +devscripts \ +docbook-to-man \ +dput \ +fonts-open-sans \ +fonts-ubuntu \ +g++ \ +lcov \ +libavformat-dev \ +libchromaprint-dev \ +libdistro-info-perl \ +libebur128-dev \ +libfaad-dev \ +libfftw3-dev \ +libflac-dev \ +libhidapi-dev \ +libid3tag0-dev \ +liblilv-dev \ +libmad0-dev \ +libmodplug-dev \ +libmp3lame-dev \ +libopus-dev \ +libopusfile-dev \ +libportmidi-dev \ +libprotobuf-dev \ +libqt5opengl5-dev \ +libqt5sql5-sqlite \ +libqt5svg5-dev \ +libqt5x11extras5-dev \ +librubberband-dev \ +libshout-idjc-dev \ +libsndfile1-dev \ +libsoundtouch-dev \ +libsqlite3-dev \ +libssl-dev \ +libtag1-dev \ +libudev-dev \ +libupower-glib-dev \ +libusb-1.0-0-dev \ +libwavpack-dev \ +markdown \ +portaudio19-dev \ +protobuf-compiler \ +qt5keychain-dev \ +qtdeclarative5-dev \ +qml-module-qtquick-controls \ +qml-module-qtquick-controls2 \ +qml-module-qt-labs-qmlmodels \ +qml-module-qtquick-shapes diff --git a/tools/macos_buildenv.sh b/tools/macos_buildenv.sh deleted file mode 100755 index 82a9a1391b2f..000000000000 --- a/tools/macos_buildenv.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/bash -set -o pipefail - -# shellcheck disable=SC2091 -if [ -z "${GITHUB_ENV}" ] && ! $(return 0 2>/dev/null); then - echo "This script must be run by sourcing it:" - echo "source $0 $*" - exit 1 -fi - -realpath() { - OLDPWD="${PWD}" - cd "$1" || exit 1 - pwd - cd "${OLDPWD}" || exit 1 -} - -# some hackery is required to be compatible with both bash and zsh -THIS_SCRIPT_NAME=${BASH_SOURCE[0]} -[ -z "$THIS_SCRIPT_NAME" ] && THIS_SCRIPT_NAME=$0 - -MIXXX_ROOT="$(realpath "$(dirname "$THIS_SCRIPT_NAME")/..")" - -read -r -d'\n' BUILDENV_NAME BUILDENV_SHA256 < "${MIXXX_ROOT}/packaging/macos/build_environment" - -[ -z "$BUILDENV_BASEPATH" ] && BUILDENV_BASEPATH="${MIXXX_ROOT}/buildenv" - -case "$1" in - name) - if [ -n "${GITHUB_ENV}" ]; then - echo "BUILDENV_NAME=$BUILDENV_NAME" >> "${GITHUB_ENV}" - else - echo "$BUILDENV_NAME" - fi - ;; - - setup) - BUILDENV_PATH="${BUILDENV_BASEPATH}/${BUILDENV_NAME}" - mkdir -p "${BUILDENV_BASEPATH}" - if [ ! -d "${BUILDENV_PATH}" ]; then - if [ "$1" != "--profile" ]; then - echo "Build environment $BUILDENV_NAME not found in mixxx repository, downloading it..." - curl "https://downloads.mixxx.org/dependencies/2.4/macOS/${BUILDENV_NAME}.zip" -o "${BUILDENV_PATH}.zip" - OBSERVED_SHA256=$(shasum -a 256 "${BUILDENV_PATH}.zip"|cut -f 1 -d' ') - if [[ "$OBSERVED_SHA256" == "$BUILDENV_SHA256" ]]; then - echo "Download matched expected SHA256 sum $BUILDENV_SHA256" - else - echo "ERROR: Download did not match expected SHA256 checksum!" - echo "Expected $BUILDENV_SHA256" - echo "Got $OBSERVED_SHA256" - exit 1 - fi - echo "" - echo "Extracting ${BUILDENV_NAME}.zip..." - unzip "${BUILDENV_PATH}.zip" -d "${BUILDENV_BASEPATH}" && \ - echo "Successfully extracted ${BUILDENV_NAME}.zip" && \ - rm "${BUILDENV_PATH}.zip" - else - echo "Build environment $BUILDENV_NAME not found in mixxx repository, run the command below to download it." - echo "source ${THIS_SCRIPT_NAME} setup" - return # exit would quit the shell being started - fi - elif [ "$1" != "--profile" ]; then - echo "Build environment found: ${BUILDENV_PATH}" - fi - - export VCPKG_ROOT="${BUILDENV_PATH}" - export CMAKE_GENERATOR=Ninja - - echo_exported_variables() { - echo "VCPKG_ROOT=${VCPKG_ROOT}" - echo "CMAKE_GENERATOR=${CMAKE_GENERATOR}" - } - - if [ -n "${GITHUB_ENV}" ]; then - echo_exported_variables >> "${GITHUB_ENV}" - elif [ "$1" != "--profile" ]; then - echo "" - echo "Exported environment variables:" - echo_exported_variables - fi - ;; - *) - echo "Usage: source macos_buildenv.sh [options]" - echo "" - echo "options:" - echo " help Displays this help." - echo " name Displays the name of the required build environment." - echo " setup Installs the build environment." - ;; -esac diff --git a/tools/windows_buildenv.bat b/tools/windows_buildenv.bat deleted file mode 100644 index cae5ff098ecb..000000000000 --- a/tools/windows_buildenv.bat +++ /dev/null @@ -1,254 +0,0 @@ -@ECHO OFF -SETLOCAL ENABLEDELAYEDEXPANSION -REM this í is just to force some editors to recognize this file as ANSI, not UTF8. - -CALL :REALPATH %~dp0\.. -SET MIXXX_ROOT=%RETVAL% - -IF NOT DEFINED PLATFORM ( - SET PLATFORM=x64 -) - -IF NOT DEFINED CONFIGURATION ( - SET CONFIGURATION=release-fastbuild -) - -IF NOT DEFINED BUILDENV_BASEPATH ( - SET BUILDENV_BASEPATH=%MIXXX_ROOT%\buildenv -) - -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 -) - -REM Make These permanent, not local to the batch script. -ENDLOCAL & SET "VCPKG_ROOT=%VCPKG_ROOT%" & SET "VCPKG_DEFAULT_TRIPLET=%VCPKG_DEFAULT_TRIPLET%" & SET "X_VCPKG_APPLOCAL_DEPS_INSTALL=%X_VCPKG_APPLOCAL_DEPS_INSTALL%" & SET "CMAKE_GENERATOR=%CMAKE_GENERATOR%" - -EXIT /B 0 - -:COMMAND_name - CALL :READ_ENVNAME - IF DEFINED GITHUB_ENV ( - ECHO BUILDENV_NAME=!RETVAL! >> !GITHUB_ENV! - ) - GOTO :EOF - -:COMMAND_setup - CALL :READ_ENVNAME - SET BUILDENV_NAME=%RETVAL% - SET BUILDENV_PATH=%BUILDENV_BASEPATH%\%BUILDENV_NAME% - - IF NOT EXIST %BUILDENV_BASEPATH% ( - ECHO ^Creating "buildenv" directory... - MD %BUILDENV_BASEPATH% - ) - - IF NOT EXIST %BUILDENV_PATH% ( - SET BUILDENV_URL=https://downloads.mixxx.org/dependencies/2.4/Windows/!BUILDENV_NAME!.zip - IF NOT EXIST !BUILDENV_PATH!.zip ( - ECHO ^Download prebuilt build environment from "!BUILDENV_URL!" to "!BUILDENV_PATH!.zip"... - REM TODO: The /DYNAMIC parameter is required because our server does not yet support HTTP range headers - BITSADMIN /transfer buildenvjob /download /priority normal /DYNAMIC !BUILDENV_URL! !BUILDENV_PATH!.zip - REM TODO: verify download using sha256sum? - ECHO ^Download complete. - ) else ( - ECHO ^Using cached archive at "!BUILDENV_PATH!.zip". - ) - - CALL :DETECT_SEVENZIP - IF !RETVAL!=="" ( - ECHO ^Unpacking "!BUILDENV_PATH!.zip" using powershell... - CALL :UNZIP_POWERSHELL "!BUILDENV_PATH!.zip" "!BUILDENV_BASEPATH!" - ) ELSE ( - ECHO ^Unpacking "!BUILDENV_PATH!.zip" using 7z... - CALL :UNZIP_SEVENZIP "!RETVAL!" "!BUILDENV_PATH!.zip" "!BUILDENV_BASEPATH!" - ) - IF NOT EXIST %BUILDENV_PATH% ( - ECHO ^Error: Unpacking failed. The downloaded archive might be broken, consider removing "!BUILDENV_PATH!.zip" to force redownload. - EXIT /B 1 - ) - - ECHO ^Unpacking complete. - DEL /f /q %BUILDENV_PATH%.zip - ) - - ECHO ^Build environment path: !BUILDENV_PATH! - - SET "VCPKG_ROOT=!BUILDENV_PATH!" - SET "CMAKE_GENERATOR=Ninja" - SET "CMAKE_PREFIX_PATH=!BUILDENV_PATH!\installed\x64-windows" - - ECHO ^Environment Variables: - ECHO ^- VCPKG_ROOT='!VCPKG_ROOT!' - ECHO ^- CMAKE_GENERATOR='!CMAKE_GENERATOR!' - - IF DEFINED GITHUB_ENV ( - ECHO VCPKG_ROOT=!VCPKG_ROOT!>>!GITHUB_ENV! - ECHO CMAKE_GENERATOR=!CMAKE_GENERATOR!>>!GITHUB_ENV! - ) ELSE ( - ECHO ^Generating "CMakeSettings.json"... - CALL :GENERATE_CMakeSettings_JSON - - IF NOT EXIST %BUILD_ROOT% ( - ECHO ^Creating subdirectory "build"... - MD %BUILD_ROOT% - ) - - IF NOT EXIST %INSTALL_ROOT% ( - ECHO ^Creating subdirectory "install"... - MD %INSTALL_ROOT% - ) - ) - GOTO :EOF - - -:DETECT_SEVENZIP - SET SEVENZIP_PATH=7z.exe - !SEVENZIP_PATH! --help >NUL 2>NUL - IF errorlevel 1 ( - SET SEVENZIP_PATH="c:\Program Files\7-Zip\7z.exe" - !SEVENZIP_PATH! --help >NUL 2>NUL - IF errorlevel 1 ( - SET SEVENZIP_PATH="c:\Program Files (x86)\7-Zip\7z.exe" - !SEVENZIP_PATH! --help >NUL 2>NUL - if errorlevel 1 ( - SET SEVENZIP_PATH= - ) - ) - ) - SET RETVAL="!SEVENZIP_PATH!" - GOTO :EOF - - -:UNZIP_SEVENZIP <7zippath> - %1 x -o"%3" "%2" - GOTO :EOF - - -:UNZIP_POWERSHELL - SET SCRIPTDIR=%~dp0 - powershell -executionpolicy bypass -File "%SCRIPTDIR%\unzip.ps1" %1 %2 - GOTO :EOF - - -:REALPATH - SET RETVAL=%~f1 - GOTO :EOF - - -:READ_ENVNAME - ECHO Reading 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 Environment name: %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% ( - FOR /f "delims=" %%a in ('wmic OS Get localdatetime ^| find "."') do set DateTime=%%a - SET CMakeSettingsBackup=CMakeSettings_!DateTime:~0,4!-!DateTime:~4,2!-!DateTime:~6,2!_!DateTime:~8,2!-!DateTime:~10,2!-!DateTime:~12,2!.json - ECHO CMakeSettings.json already exists, creating backup at "!CMakeSettingsBackup!"... - REN %CMakeSettings% !CMakeSettingsBackup! - ) - - CALL :SETANSICONSOLE - SET OLDCODEPAGE=%RETVAL% - REM set byte order mark (BOM) for the file . - REM WARNING: Ensure that the script is saved as ANSI, or these characters will not - REM contain the correct values. Correct values are EF BB BF (ï » ¿) . - REM The last character is an actual character for the file, the start "{" - >"%CMakeSettings%" echo { - CALL :SETUTF8CONSOLE - - >>%CMakeSettings% echo "configurations": [ - SET configElementTermination=, - CALL :Configuration2CMakeSettings_JSON off Debug - CALL :Configuration2CMakeSettings_JSON legacy RelWithDebInfo - CALL :Configuration2CMakeSettings_JSON portable RelWithDebInfo - SET configElementTermination= - CALL :Configuration2CMakeSettings_JSON native Release - >>%CMakeSettings% echo ] - >>%CMakeSettings% echo } - CALL :RESTORECONSOLE %OLDCODEPAGE% - GOTO :EOF - -:Configuration2CMakeSettings_JSON - >>%CMakeSettings% echo { - >>%CMakeSettings% echo "name": "!PLATFORM!__%1", - >>%CMakeSettings% echo "buildRoot": "!BUILD_ROOT:\=\\!\\${name}", - >>%CMakeSettings% echo "configurationType": "%2", - >>%CMakeSettings% echo "enableClangTidyCodeAnalysis": true, - >>%CMakeSettings% echo "generator": "Ninja", - >>%CMakeSettings% echo "inheritEnvironments": [ "msvc_!PLATFORM!_!PLATFORM!" ], - >>%CMakeSettings% echo "installRoot": "!INSTALL_ROOT:\=\\!\\${name}", - >>%CMakeSettings% echo "intelliSenseMode": "windows-msvc-!PLATFORM!", - >>%CMakeSettings% echo "variables": [ - SET variableElementTermination=, - CALL :AddCMakeVar2CMakeSettings_JSON "VCPKG_ROOT" "STRING" "!VCPKG_ROOT:\=\\!" - CALL :AddCMakeVar2CMakeSettings_JSON "BATTERY" "BOOL" "True" - CALL :AddCMakeVar2CMakeSettings_JSON "BROADCAST" "BOOL" "True" - CALL :AddCMakeVar2CMakeSettings_JSON "BULK" "BOOL" "False" - CALL :AddCMakeVar2CMakeSettings_JSON "CMAKE_EXPORT_COMPILE_COMMANDS" "BOOL" "True" - REM Replace all \ by \\ in CMAKE_PREFIX_PATH - CALL :AddCMakeVar2CMakeSettings_JSON "CMAKE_PREFIX_PATH" "STRING" "!CMAKE_PREFIX_PATH:\=\\!" - CALL :AddCMakeVar2CMakeSettings_JSON "DEBUG_ASSERTIONS_FATAL" "BOOL" "True" - CALL :AddCMakeVar2CMakeSettings_JSON "FFMPEG" "BOOL" "False" - 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 "MODPLUG" "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" "False" - CALL :AddCMakeVar2CMakeSettings_JSON "VINYLCONTROL" "BOOL" "True" - SET variableElementTermination= - CALL :AddCMakeVar2CMakeSettings_JSON "WAVPACK" "BOOL" "True" - >>%CMakeSettings% echo ] - >>%CMakeSettings% echo }!configElementTermination! - GOTO :EOF - -:AddCMakeVar2CMakeSettings_JSON - >>%CMakeSettings% echo { - >>%CMakeSettings% echo "name": %1, - >>%CMakeSettings% echo "value": %3, - >>%CMakeSettings% echo "type": %2 - >>%CMakeSettings% echo }!variableElementTermination! - GOTO :EOF - -:SETANSICONSOLE - for /f "tokens=2 delims=:" %%I in ('chcp') do set "_codepage=%%I" - - >NUL chcp 1252 - REM Remove suffix dot - set _codepage=%_codepage:.=% - SET RETVAL=%_codepage% - GOTO :EOF - -:SETUTF8CONSOLE - >NUL chcp 65001 - GOTO :EOF - -:RESTORECONSOLE - >NUL chcp %1 - GOTO :EOF diff --git a/vcpkg b/vcpkg new file mode 160000 index 000000000000..e1f65395e98e --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit e1f65395e98ee18d93b6b1049b5ffab56538e1cf diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 000000000000..881252c2f435 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,94 @@ +{ + "name": "mixxx", + "version": "2.4.0", + "description": "Mixxx is free cross platform DJ software", + "homepage": "https://mixxx.org/", + "license": "GPL-2.0-or-later", + "supports": "!uwp", + "dependencies": [ + "chromaprint", + "fdk-aac", + "ffmpeg", + "fftw3", + "hidapi", + { + "name": "hss1394", + "platform": "windows | osx" + }, + "libdjinterop", + "libebur128", + "libflac", + { + "name": "libid3tag", + "platform": "windows" + }, + "libkeyfinder", + { + "name": "libmad", + "platform": "windows" + }, + "libmodplug", + "libogg", + "libopusenc", + "libsndfile", + "libusb", + "libvorbis", + "lilv", + "mp3lame", + "opus", + "opusfile", + { + "name": "portaudio", + "features": [ + "asio", + "jack" + ] + }, + "portmidi", + "protobuf", + "pthreads", + "rubberband", + "soundtouch", + "taglib", + "wavpack" + ], + "features": { + "qt5": { + "description": "Build with Qt5", + "dependencies": [ + { + "name": "angle", + "platform": "windows" + }, + "qt5-base", + "qt5-declarative", + { + "name": "qt5-macextras", + "platform": "osx" + }, + "qt5-svg", + "qt5-translations", + { + "name": "qt5-winextras", + "platform": "windows" + }, + { + "name": "qt5-x11extras", + "platform": "linux" + }, + "qtkeychain" + ] + }, + "qt6": { + "description": "Build with Qt6", + "dependencies": [ + "qt5compat", + "qtbase", + "qtdeclarative", + "qtkeychain-qt6", + "qtsvg", + "qttranslations" + ] + } + } +}