diff --git a/.cmakelintrc b/.cmakelintrc new file mode 100644 index 00000000000..405ac61e566 --- /dev/null +++ b/.cmakelintrc @@ -0,0 +1 @@ +filter=-linelength,-convention/filename,-package/stdargs diff --git a/.gersemirc b/.gersemirc new file mode 100644 index 00000000000..bfa2d92bb6f --- /dev/null +++ b/.gersemirc @@ -0,0 +1 @@ +indent: 2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 179b192e628..1cb59d8f7da 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -129,6 +129,14 @@ repos: rev: 37c2513b1b8275a475a160ed2f5b044910335d5f # No release tag yet including #6 fix hooks: - id: qml_formatter + - repo: https://github.com/BlankSpruce/gersemi + rev: 0.17.1 + hooks: + - id: gersemi + - repo: https://github.com/cmake-lint/cmake-lint.git + rev: 1.4.3 + hooks: + - id: cmakelint - repo: local hooks: - id: qsscheck diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f44946c04a..64446f8d474 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,5 @@ cmake_minimum_required(VERSION 3.21) +# lint_cmake: -readability/wonkycase message(STATUS "CMAKE_VERSION: ${CMAKE_VERSION}") @@ -47,25 +48,48 @@ if(POLICY CMP0135) cmake_policy(SET CMP0135 NEW) endif() -function(FATAL_ERROR_MISSING_ENV) +# Use this function to throw an error because the build environment is not set +# up correctly. +function(fatal_error_missing_env) if(WIN32) if(CMAKE_BUILD_TYPE MATCHES "Debug") - message(FATAL_ERROR "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/windows_buildenv.bat`?") + message( + FATAL_ERROR + "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/windows_buildenv.bat`?" + ) else() - message(FATAL_ERROR "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/windows_release_buildenv.bat` or `${CMAKE_SOURCE_DIR}/tools/windows_buildenv.bat`(includes Debug)?") + message( + FATAL_ERROR + "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/windows_release_buildenv.bat` or `${CMAKE_SOURCE_DIR}/tools/windows_buildenv.bat`(includes Debug)?" + ) endif() elseif(APPLE AND NOT IOS) if(CMAKE_BUILD_TYPE MATCHES "Debug") - message(FATAL_ERROR "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/macos_buildenv.sh`") + message( + FATAL_ERROR + "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/macos_buildenv.sh`" + ) else() - message(FATAL_ERROR "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/macos_release_buildenv.sh` or `${CMAKE_SOURCE_DIR}/tools/macos_buildenv.sh`(includes Debug)?") + message( + FATAL_ERROR + "Did you download the Mixxx build environment using `${CMAKE_SOURCE_DIR}/tools/macos_release_buildenv.sh` or `${CMAKE_SOURCE_DIR}/tools/macos_buildenv.sh`(includes Debug)?" + ) endif() elseif(LINUX) - message(FATAL_ERROR "Did you install the Debian dev packages via `${CMAKE_SOURCE_DIR}/tools/debian_buildenv.sh` or the equivalent packages using your package manager?") + message( + FATAL_ERROR + "Did you install the Debian dev packages via `${CMAKE_SOURCE_DIR}/tools/debian_buildenv.sh` or the equivalent packages using your package manager?" + ) elseif(DEFINED VCPKG_TARGET_TRIPLET) - message(FATAL_ERROR "You are targeting ${VCPKG_TARGET_TRIPLET}, which does not have a prebuilt environment. Please make sure that -DMIXXX_VCPKG_ROOT points to a vcpkg environment containing installed dependencies for ${VCPKG_TARGET_TRIPLET}!") + message( + FATAL_ERROR + "You are targeting ${VCPKG_TARGET_TRIPLET}, which does not have a prebuilt environment. Please make sure that -DMIXXX_VCPKG_ROOT points to a vcpkg environment containing installed dependencies for ${VCPKG_TARGET_TRIPLET}!" + ) else() - message(FATAL_ERROR "You are building for an unknown platform and are missing a build environment. Please set -DVCPKG_TARGET_TRIPLET and make sure that -DMIXXX_VCPKG_ROOT points to a vcpkg environment containing installed dependencies for your target platform!") + message( + FATAL_ERROR + "You are building for an unknown platform and are missing a build environment. Please set -DVCPKG_TARGET_TRIPLET and make sure that -DMIXXX_VCPKG_ROOT points to a vcpkg environment containing installed dependencies for your target platform!" + ) endif() endfunction() @@ -74,26 +98,32 @@ endfunction() # Note: VCPKG_ROOT, the default location for the vcpkg cli tool is later # adjusted by CMAKE_TOOLCHAIN_FILE. if(DEFINED ENV{MIXXX_VCPKG_ROOT} AND NOT DEFINED MIXXX_VCPKG_ROOT) - set(MIXXX_VCPKG_ROOT "$ENV{MIXXX_VCPKG_ROOT}") + set(MIXXX_VCPKG_ROOT "$ENV{MIXXX_VCPKG_ROOT}") endif() if(DEFINED MIXXX_VCPKG_ROOT) - if(EXISTS "$ENV{MIXXX_VCPKG_ROOT}/overlay/ports" OR NOT EXISTS "$ENV{MIXXX_VCPKG_ROOT}/ports") + if( + EXISTS "$ENV{MIXXX_VCPKG_ROOT}/overlay/ports" + OR NOT EXISTS "$ENV{MIXXX_VCPKG_ROOT}/ports" + ) # MIXXX_VCPKG_ROOT points to our vcpkg environment # and we configure the CMAKE_TOOLCHAIN_FILE and overlays accordingly message(STATUS "Using MIXXX_VCPKG_ROOT: $ENV{MIXXX_VCPKG_ROOT}") else() - message(STATUS "MIXXX_VCPKG_ROOT not correct (missing $ENV{MIXXX_VCPKG_ROOT}/overlay/ports)") - FATAL_ERROR_MISSING_ENV() + message( + STATUS + "MIXXX_VCPKG_ROOT not correct (missing $ENV{MIXXX_VCPKG_ROOT}/overlay/ports)" + ) + fatal_error_missing_env() endif() if(NOT DEFINED VCPKG_OVERLAY_PORTS) # required for manifest mode set(VCPKG_OVERLAY_PORTS "${MIXXX_VCPKG_ROOT}/overlay/ports") if(APPLE) - list(APPEND VCPKG_OVERLAY_PORTS "${MIXXX_VCPKG_ROOT}/overlay/osx") + list(APPEND VCPKG_OVERLAY_PORTS "${MIXXX_VCPKG_ROOT}/overlay/osx") elseif(WIN32) - list(APPEND VCPKG_OVERLAY_PORTS "${MIXXX_VCPKG_ROOT}/overlay/windows") + list(APPEND VCPKG_OVERLAY_PORTS "${MIXXX_VCPKG_ROOT}/overlay/windows") endif() endif() @@ -103,7 +133,12 @@ if(DEFINED MIXXX_VCPKG_ROOT) endif() if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) - set(CMAKE_TOOLCHAIN_FILE "${MIXXX_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") + set( + CMAKE_TOOLCHAIN_FILE + "${MIXXX_VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + CACHE STRING + "" + ) endif() endif() @@ -114,8 +149,13 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET) set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}") endif() endif() -set(X_VCPKG_APPLOCAL_DEPS_INSTALL ON CACHE BOOL "Automatically copy dependencies into the install target directory for executables." FORCE) - +set( + X_VCPKG_APPLOCAL_DEPS_INSTALL + ON + CACHE BOOL + "Automatically copy dependencies into the install target directory for executables." + FORCE +) # Set a default build type if none was specified # See https://blog.kitware.com/cmake-and-the-default-build-type/ for details. @@ -128,19 +168,40 @@ endif() if(NOT CMAKE_CONFIGURATION_TYPES) if(NOT CMAKE_BUILD_TYPE) - message(STATUS "Setting CMAKE_BUILD_TYPE to '${default_build_type}' as none was specified.") - set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE STRING "Choose the type of build." FORCE) + message( + STATUS + "Setting CMAKE_BUILD_TYPE to '${default_build_type}' as none was specified." + ) + set( + CMAKE_BUILD_TYPE + "${default_build_type}" + CACHE STRING + "Choose the type of build." + FORCE + ) # Set the possible values of build type for cmake-gui - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo") + set_property( + CACHE CMAKE_BUILD_TYPE + PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo" + ) elseif(NOT CMAKE_BUILD_TYPE MATCHES "^(Debug|Release|RelWithDebInfo)$") - message(FATAL_ERROR "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} is not supported, use one of Debug, Release or RelWithDebInfo.") + message( + FATAL_ERROR + "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} is not supported, use one of Debug, Release or RelWithDebInfo." + ) endif() endif() include(CMakeDependentOption) option(QT6 "Build with Qt6" ON) -cmake_dependent_option(QML "Build with QML" ON "QT6" OFF) +cmake_dependent_option( + QML + "Build with QML" + ON + "QT6" + OFF +) option(QOPENGL "Use QOpenGLWindow based widget instead of QGLWidget" ON) if(QOPENGL) @@ -156,10 +217,18 @@ if(VCPKG_TARGET_TRIPLET MATCHES "^wasm(32|64)-emscripten") if(DEFINED ENV{EMSDK}) message(STATUS "Found EMSDK at $ENV{EMSDK}") else() - message(FATAL_ERROR "Please make sure emsdk is installed and the environment variable EMSDK is set (see https://emscripten.org/docs/getting_started/downloads.html)") + message( + FATAL_ERROR + "Please make sure emsdk is installed and the environment variable EMSDK is set (see https://emscripten.org/docs/getting_started/downloads.html)" + ) endif() if(NOT DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE) - set(VCPKG_CHAINLOAD_TOOLCHAIN_FILE "$ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" CACHE STRING "") + set( + VCPKG_CHAINLOAD_TOOLCHAIN_FILE + "$ENV{EMSDK}/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake" + CACHE STRING + "" + ) endif() # Enabling this causes Qt's FindWrapRt C++ compile check to fail as it tries # to run `clang-scan-deps` (because we set the C++ standard to 20). Emscripten @@ -168,13 +237,17 @@ if(VCPKG_TARGET_TRIPLET MATCHES "^wasm(32|64)-emscripten") set(CMAKE_CXX_SCAN_FOR_MODULES OFF) elseif(APPLE) # Check if xcode-select is installed - execute_process(COMMAND xcode-select -v + execute_process( + COMMAND xcode-select -v RESULT_VARIABLE XCODE_SELECT_RESULT OUTPUT_QUIET ) if(XCODE_SELECT_RESULT) # xcode-select command failed, meaning it is not installed or not configured properly - message(FATAL_ERROR "'xcode-select -v' failed with '${XCODE_SELECT_RESULT}'. You may need to install Xcode and run 'sudo xcode-select --install'.") + message( + FATAL_ERROR + "'xcode-select -v' failed with '${XCODE_SELECT_RESULT}'. You may need to install Xcode and run 'sudo xcode-select --install'." + ) endif() if(VCPKG_TARGET_TRIPLET MATCHES "^[a-zA-Z0-9]+-osx") @@ -182,16 +255,36 @@ elseif(APPLE) set(CMAKE_SYSTEM_NAME Darwin CACHE STRING "Target macOS") if(VCPKG_TARGET_TRIPLET MATCHES "^arm64-") # Minimum macOS version for arm64 Support - set(CMAKE_OSX_DEPLOYMENT_TARGET 11.0 CACHE STRING "Minimum macOS version the build will be able to run on") + set( + CMAKE_OSX_DEPLOYMENT_TARGET + 11.0 + CACHE STRING + "Minimum macOS version the build will be able to run on" + ) set(CMAKE_OSX_ARCHITECTURES arm64 CACHE STRING "The target architecture") - set(CMAKE_SYSTEM_PROCESSOR arm64 CACHE STRING "The target system processor") + set( + CMAKE_SYSTEM_PROCESSOR + arm64 + CACHE STRING + "The target system processor" + ) else() if(QT6) # Minimum macOS version supported by Qt 6 - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15 CACHE STRING "Minimum macOS version the build will be able to run on") + set( + CMAKE_OSX_DEPLOYMENT_TARGET + 10.15 + CACHE STRING + "Minimum macOS version the build will be able to run on" + ) else() # Minimum macOS version supported by Qt 5.12 - set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "Minimum macOS version the build will be able to run on") + set( + CMAKE_OSX_DEPLOYMENT_TARGET + 10.12 + CACHE STRING + "Minimum macOS version the build will be able to run on" + ) # Needed for deployment target < 10.14 add_compile_options(-fno-aligned-allocation) endif() @@ -199,9 +292,17 @@ elseif(APPLE) elseif(VCPKG_TARGET_TRIPLET MATCHES "^[a-zA-Z0-9]+-ios") message(STATUS "Targeting iOS (${VCPKG_TARGET_TRIPLET})") set(CMAKE_SYSTEM_NAME iOS CACHE STRING "Target iOS") - set(CMAKE_OSX_DEPLOYMENT_TARGET 14.0 CACHE STRING "Minimum iOS version to target") + set( + CMAKE_OSX_DEPLOYMENT_TARGET + 14.0 + CACHE STRING + "Minimum iOS version to target" + ) else() - message(WARNING "Targeting an Apple platform, but VCPKG_TARGET_TRIPLET is not set. This is not a supported scenario!") + message( + WARNING + "Targeting an Apple platform, but VCPKG_TARGET_TRIPLET is not set. This is not a supported scenario!" + ) endif() endif() @@ -211,7 +312,10 @@ enable_language(C CXX) set(MIXXX_VERSION_PRERELEASE "alpha") # set to "alpha" "beta" or "" set(CMAKE_PROJECT_HOMEPAGE_URL "https://www.mixxx.org") -set(CMAKE_PROJECT_DESCRIPTION "Mixxx is Free DJ software that gives you everything you need to perform live mixes.") +set( + CMAKE_PROJECT_DESCRIPTION + "Mixxx is Free DJ software that gives you everything you need to perform live mixes." +) # Used for force control of color output set(BUILD_COLORS "auto" CACHE STRING "Try to use colors auto/always/no") @@ -229,9 +333,12 @@ if(DEFINED _VCPKG_INSTALLED_DIR) if(NOT EXISTS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}") # Fail early if this part of CMAKE_PREFIX_PATH does not exist # else the library lookups below will fail with misleading error messages - message(STATUS "VCPKG_TARGET_TRIPLET dir not found: ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} " - "Make sure the VCPKG build environment is installed and contains the build for the selected triplet.") - FATAL_ERROR_MISSING_ENV() + message( + STATUS + "VCPKG_TARGET_TRIPLET dir not found: ${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET} " + "Make sure the VCPKG build environment is installed and contains the build for the selected triplet." + ) + fatal_error_missing_env() else() message(STATUS "Using VCPKG_TARGET_TRIPLET: ${VCPKG_TARGET_TRIPLET}") endif() @@ -248,7 +355,7 @@ else() endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - if (CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") + if(CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") set(LLVM_CLANG false) set(MSVC true) else() @@ -278,7 +385,13 @@ endif() # # This is only applies to gcc/clang, therefore this option is forcibly set to # ON on all other compilers. -cmake_dependent_option(BUILD_LOW_MEMORY "Store temporary build files on disk by disabling the build option -pipe" OFF "GNU_GCC OR LLVM_CLANG" ON) +cmake_dependent_option( + BUILD_LOW_MEMORY + "Store temporary build files on disk by disabling the build option -pipe" + OFF + "GNU_GCC OR LLVM_CLANG" + ON +) if(NOT BUILD_LOW_MEMORY) add_compile_options(-pipe) endif() @@ -287,7 +400,13 @@ endif() # # This is only available with GCC, therefore this option is forcibly set to OFF # for all other compilers. -cmake_dependent_option(COVERAGE "Coverage (i.e. gcov) support" OFF "GNU_GCC" OFF) +cmake_dependent_option( + COVERAGE + "Coverage (i.e. gcov) support" + OFF + "GNU_GCC" + OFF +) if(COVERAGE) add_compile_options(--coverage -fprofile-arcs -ftest-coverage) add_link_options(--coverage -fprofile-arcs -ftest-coverage) @@ -297,7 +416,13 @@ endif() # # This is only available on Linux, therefore this option is forcibly set to OFF # on all other platforms. -cmake_dependent_option(PROFILING "Profiling (e.g. gprof) support" OFF "UNIX;NOT APPLE" OFF) +cmake_dependent_option( + PROFILING + "Profiling (e.g. gprof) support" + OFF + "UNIX;NOT APPLE" + OFF +) if(PROFILING) add_compile_options(-pg) add_link_options(-pg) @@ -307,8 +432,16 @@ endif() # Optimizations # -set(OPTIMIZE "portable" CACHE STRING "Optimization and Tuning (set to off, portable, native, legacy)") -set_property(CACHE OPTIMIZE PROPERTY STRINGS "off" "portable" "native" "legacy") +set( + OPTIMIZE + "portable" + CACHE STRING + "Optimization and Tuning (set to off, portable, native, legacy)" +) +set_property( + CACHE OPTIMIZE + PROPERTY STRINGS "off" "portable" "native" "legacy" +) string(TOLOWER "${OPTIMIZE}" OPTIMIZE) message(STATUS "Optimization level: ${OPTIMIZE}") @@ -341,11 +474,29 @@ if(MSVC) string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") elseif(CMAKE_BUILD_TYPE STREQUAL "Release") - string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") + string( + REPLACE + "/Zi" + "/Z7" + CMAKE_CXX_FLAGS_RELEASE + "${CMAKE_CXX_FLAGS_RELEASE}" + ) string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + string( + REPLACE + "/Zi" + "/Z7" + CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" + ) + string( + REPLACE + "/Zi" + "/Z7" + CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO}" + ) endif() if(NOT OPTIMIZE STREQUAL "off") @@ -365,20 +516,38 @@ if(MSVC) if(CMAKE_BUILD_TYPE STREQUAL "Debug") #optimize Debug Builds as well, to have "normal" behaviour of mixxx during development - string(REPLACE "/Od" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/Od" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") - string(REPLACE "/Ob0" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/Ob0" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") + string(REPLACE "/Od" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/Od" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") + string(REPLACE "/Ob0" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") + string(REPLACE "/Ob0" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}") add_compile_options(/O2) # this implies /Od2 # Remove /RTC1 flag set by CMAKE by default (conflicts with /O2) - string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") - string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") + string( + REPLACE + "/RTC1" + "" + CMAKE_CXX_FLAGS_DEBUG + "${CMAKE_CXX_FLAGS_DEBUG}" + ) + string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") # For some reasons cmake uses /Ob1 in RelWithDebInfo https://gitlab.kitware.com/cmake/cmake/-/issues/20812 # /O2 is applied by CMake and this implies /Od2 - string(REPLACE "/Ob1" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - string(REPLACE "/Ob1" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + string( + REPLACE + "/Ob1" + "" + CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" + ) + string( + REPLACE + "/Ob1" + "" + CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO}" + ) # Reduce the size of the binary in RelWithDebInfo builds # Do not use /OPT:ICF because it has no effect. @@ -388,10 +557,24 @@ if(MSVC) # /INCREMENTAL is incompatible with /OPT:REF, but it's the CMake default for RelWithDebInfo # The CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO can be defined by the user in the GUI or in CMakeSettings.json, # therefore we can't rely on the default. - string(FIND CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/INCREMENTAL:NO" INCREMENTAL_NO_POSITION) + string( + FIND + CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO + "/INCREMENTAL:NO" + INCREMENTAL_NO_POSITION + ) if(INCREMENTAL_NO_POSITION EQUAL -1) - message(STATUS "Overwriting /INCREMENTAL by /INCREMENTAL:NO to allow link time code optimization") - string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}") + message( + STATUS + "Overwriting /INCREMENTAL by /INCREMENTAL:NO to allow link time code optimization" + ) + string( + REPLACE + "/INCREMENTAL" + "/INCREMENTAL:NO" + CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO + "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}" + ) endif() # Note: CMAKE_INTERPROCEDURAL_OPTIMIZATION sets the /GL and /LTCG flags for us elseif(CMAKE_BUILD_TYPE STREQUAL "Release") @@ -421,7 +604,10 @@ if(MSVC) # Define the target processor instruction and other compiler optimization flags here: # https://docs.microsoft.com/en-us/cpp/build/reference/arch-x64?view=msvc-160 # add_compile_options(/arch:AVX512) - message(FATAL_ERROR "User need to set the MSVC compiler flags for the native processor here!") + message( + FATAL_ERROR + "User need to set the MSVC compiler flags for the native processor here!" + ) add_compile_options("/favor:${CMAKE_SYSTEM_PROCESSOR}") elseif(OPTIMIZE STREQUAL "legacy") if(CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -430,25 +616,64 @@ if(MSVC) message("Enabling pure i386 instruction set (without SSE/SSE2 etc.)") endif() else() - message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}") + message( + FATAL_ERROR + "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}" + ) endif() else() # OPTIMIZE=off if(CMAKE_BUILD_TYPE STREQUAL "Release") #Remove optimize flags set by cmake defaults - string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - string(REPLACE "/O2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") - string(REPLACE "/Ob2" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") - string(REPLACE "/Ob2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") + string( + REPLACE + "/O2" + "" + CMAKE_CXX_FLAGS_RELEASE + "${CMAKE_CXX_FLAGS_RELEASE}" + ) + string(REPLACE "/O2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") + string( + REPLACE + "/Ob2" + "" + CMAKE_CXX_FLAGS_RELEASE + "${CMAKE_CXX_FLAGS_RELEASE}" + ) + string(REPLACE "/Ob2" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") add_compile_options(/Od) # this implies /Ob0 add_compile_options(/RTC1) elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") #Remove optimize flags set by cmake defaults - string(REPLACE "/O2" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - string(REPLACE "/O2" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + string( + REPLACE + "/O2" + "" + CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" + ) + string( + REPLACE + "/O2" + "" + CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO}" + ) # For some reasons cmake uses /Ob1 in RelWithDebInfo https://gitlab.kitware.com/cmake/cmake/-/issues/20812 - string(REPLACE "/Ob1" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") - string(REPLACE "/Ob1" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}") + string( + REPLACE + "/Ob1" + "" + CMAKE_CXX_FLAGS_RELWITHDEBINFO + "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" + ) + string( + REPLACE + "/Ob1" + "" + CMAKE_C_FLAGS_RELWITHDEBINFO + "${CMAKE_C_FLAGS_RELWITHDEBINFO}" + ) add_compile_options(/Od) # this implies /Ob0 add_compile_options(/RTC1) endif() @@ -461,10 +686,7 @@ elseif(GNU_GCC OR LLVM_CLANG) # unfortunately that work only on 64 bit CPUs or with sse2 enabled # The following optimisation flags makes the engine code ~3 times # faster, measured on a Atom CPU. - add_compile_options( - -ffast-math - -funroll-loops - ) + add_compile_options(-ffast-math -funroll-loops) if(EMSCRIPTEN) # Optimize for size + speed when targeting Emscripten/WebAssembly # This is recommended as we use asyncify: @@ -504,10 +726,7 @@ elseif(GNU_GCC OR LLVM_CLANG) # we require macOS 10.12. # https://stackoverflow.com/questions/45917280/mac-osx-minumum-support-sse-version elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|armv7.*)$") # but not armv8 - add_compile_options( - -mfloat-abi=hard - -mfpu=neon - ) + add_compile_options(-mfloat-abi=hard -mfpu=neon) endif() # this sets macros __SSE2_MATH__ __SSE_MATH__ __SSE2__ __SSE__ # This should be our default build for distribution @@ -527,10 +746,7 @@ elseif(GNU_GCC OR LLVM_CLANG) # macros like __SSE2_MATH__ __SSE_MATH__ __SSE2__ __SSE__ # are set automatically if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm|armv7.*)$") # but not armv8 - add_compile_options( - -mfloat-abi=hard - -mfpu=neon - ) + add_compile_options(-mfloat-abi=hard -mfpu=neon) endif() elseif(OPTIMIZE STREQUAL "legacy") if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(i[3456]86|x86|x64|x86_64|AMD64)$") @@ -540,7 +756,10 @@ elseif(GNU_GCC OR LLVM_CLANG) # on arm platforms equivalent to -march=arch endif() else() - message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}") + message( + FATAL_ERROR + "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}" + ) endif() endif() endif() @@ -559,7 +778,12 @@ if(MSVC) # With MSVC, PCH is faster than caching set(CMAKE_DISABLE_PRECOMPILE_HEADERS OFF) endif() - set(CMAKE_DISABLE_PRECOMPILE_HEADERS ${CMAKE_DISABLE_PRECOMPILE_HEADERS} CACHE BOOL "Disable precompiled headers") + set( + CMAKE_DISABLE_PRECOMPILE_HEADERS + ${CMAKE_DISABLE_PRECOMPILE_HEADERS} + CACHE BOOL + "Disable precompiled headers" + ) # sccache support find_program(SCCACHE_EXECUTABLE "sccache") @@ -572,11 +796,13 @@ if(MSVC) message(STATUS "Support for sccache: ${SCCACHE_SUPPORT}") if(SCCACHE_SUPPORT) if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) - message(WARNING - "sccache: Does not work with precompiled headers. Set CMAKE_DISABLE_PRECOMPILE_HEADERS=ON") + message( + WARNING + "sccache: Does not work with precompiled headers. Set CMAKE_DISABLE_PRECOMPILE_HEADERS=ON" + ) endif() - set( CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_EXECUTABLE}" ) - set( CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_EXECUTABLE}" ) + set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_EXECUTABLE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_EXECUTABLE}") endif() else() # ccache support @@ -584,37 +810,51 @@ else() if(CCACHE_EXECUTABLE) message(STATUS "Found ccache: ${CCACHE_EXECUTABLE}") else() - message(STATUS "Could NOT find ccache (missing executable)") + message(STATUS "Could NOT find ccache (missing executable)") endif() default_option(CCACHE_SUPPORT "Enable ccache support" "CCACHE_EXECUTABLE") if(NOT DEFINED CMAKE_DISABLE_PRECOMPILE_HEADERS) set(CMAKE_DISABLE_PRECOMPILE_HEADERS ${CCACHE_SUPPORT}) endif() - set(CMAKE_DISABLE_PRECOMPILE_HEADERS ${CMAKE_DISABLE_PRECOMPILE_HEADERS} CACHE BOOL "Disable precompiled headers") + set( + CMAKE_DISABLE_PRECOMPILE_HEADERS + ${CMAKE_DISABLE_PRECOMPILE_HEADERS} + CACHE BOOL + "Disable precompiled headers" + ) if(CCACHE_SUPPORT) if(GNU_GCC OR LLVM_CLANG) # without this compiler messages in `make` backend would be uncolored - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdiagnostics-color=${BUILD_COLORS}") + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -fdiagnostics-color=${BUILD_COLORS}" + ) endif() if(NOT CMAKE_DISABLE_PRECOMPILE_HEADERS) execute_process( - COMMAND "${CCACHE_EXECUTABLE}" "--get-config=sloppiness" - WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" - OUTPUT_VARIABLE CCACHE_CONFIGURED_SLOPPINESS OUTPUT_STRIP_TRAILING_WHITESPACE - ERROR_QUIET) - if (NOT CCACHE_CONFIGURED_SLOPPINESS MATCHES "pch_defines" OR - NOT CCACHE_CONFIGURED_SLOPPINESS MATCHES "time_macros") - message(WARNING - "ccache: For use with precompiled headers, the setting \"sloppiness\" needs to " - "be set to \"pch_defines,time_macros\". This can be done via the environment variable " - "\"CCACHE_SLOPPINESS=pch_defines,time_macros\" or permanent via " - "\"ccache --set-config=sloppiness=pch_defines,time_macros\".") + COMMAND "${CCACHE_EXECUTABLE}" "--get-config=sloppiness" + WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" + OUTPUT_VARIABLE CCACHE_CONFIGURED_SLOPPINESS + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + ) + if( + NOT CCACHE_CONFIGURED_SLOPPINESS MATCHES "pch_defines" + OR NOT CCACHE_CONFIGURED_SLOPPINESS MATCHES "time_macros" + ) + message( + WARNING + "ccache: For use with precompiled headers, the setting \"sloppiness\" needs to " + "be set to \"pch_defines,time_macros\". This can be done via the environment variable " + "\"CCACHE_SLOPPINESS=pch_defines,time_macros\" or permanent via " + "\"ccache --set-config=sloppiness=pch_defines,time_macros\"." + ) endif() endif() - set( CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" ) - set( CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}" ) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") endif() message(STATUS "Support for ccache: ${CCACHE_SUPPORT}") endif() @@ -628,7 +868,7 @@ if(NOT MSVC) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(MOLD_FUSE_VERSION_STRING) - set(MOLD_FUSE_FOUND TRUE) + set(MOLD_FUSE_FOUND TRUE) endif() if(NOT MOLD_FUSE_FOUND) # check if the symlink ld is in the mold folder for older compiler @@ -636,7 +876,7 @@ if(NOT MSVC) get_filename_component(MOLD_SYMLINK_DIRECTORY ${MOLD_SYMLINK} DIRECTORY) endif() if(MOLD_SYMLINK) - set(MOLD_SYMLINK_FOUND TRUE) + set(MOLD_SYMLINK_FOUND TRUE) endif() default_option(MOLD_SUPPORT "Use 'mold' for linking" "MOLD_FUSE_FOUND OR MOLD_SYMLINK_FOUND") if(MOLD_SUPPORT) @@ -644,7 +884,10 @@ if(NOT MSVC) message(STATUS "Selecting mold as linker") add_link_options("-fuse-ld=mold") elseif(MOLD_SYMLINK_FOUND) - message(STATUS "Selecting mold as linker via ld symlink in ${MOLD_SYMLINK_DIRECTORY}") + message( + STATUS + "Selecting mold as linker via ld symlink in ${MOLD_SYMLINK_DIRECTORY}" + ) add_link_options("-B${MOLD_SYMLINK_DIRECTORY}") else() message(FATAL_ERROR "Could NOT find mold (missing executable)") @@ -658,12 +901,20 @@ if(NOT MSVC) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(LLD_VERSION_STRING) - string(REGEX MATCH "LLD ([0-9]+\\.[0-9]+\\.[0-9]+)" LLD_VERSION_MATCH "${LLD_VERSION_STRING}") + string( + REGEX MATCH + "LLD ([0-9]+\\.[0-9]+\\.[0-9]+)" + LLD_VERSION_MATCH + "${LLD_VERSION_STRING}" + ) if(LLD_VERSION_MATCH) set(LLD_VERSION ${CMAKE_MATCH_1}) message(STATUS "Found ld.lld with version: ${LLD_VERSION}") else() - message(WARNING "Failed to parse ld.lld version from: ${LLD_VERSION_STRING}") + message( + WARNING + "Failed to parse ld.lld version from: ${LLD_VERSION_STRING}" + ) endif() endif() # LLD 10.0.0 does not work because of https://bugs.llvm.org/show_bug.cgi?id=45769 @@ -687,10 +938,18 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0") set(CMAKE_INCLUDE_CURRENT_DIR ON) endif() -set(CLANG_TIDY "" CACHE STRING "CMAKE_CXX_CLANG_TIDY equivalent that only applies to mixxx sources, not bundled dependencies") +set( + CLANG_TIDY + "" + CACHE STRING + "CMAKE_CXX_CLANG_TIDY equivalent that only applies to mixxx sources, not bundled dependencies" +) # Mixxx itself -add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL +add_library( + mixxx-lib + STATIC + EXCLUDE_FROM_ALL src/analyzer/analyzerbeats.cpp src/analyzer/analyzerebur128.cpp src/analyzer/analyzergain.cpp @@ -1324,10 +1583,9 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/widget/wwidgetgroup.cpp src/widget/wwidgetstack.cpp ) -set(MIXXX_COMMON_PRECOMPILED_HEADER - src/util/assert.h -) -set(MIXXX_LIB_PRECOMPILED_HEADER +set(MIXXX_COMMON_PRECOMPILED_HEADER src/util/assert.h) +set( + MIXXX_LIB_PRECOMPILED_HEADER src/audio/frame.h src/audio/signalinfo.h src/audio/streaminfo.h @@ -1484,71 +1742,88 @@ set(MIXXX_LIB_PRECOMPILED_HEADER src/util/workerthreadscheduler.h src/util/xml.h ) -if (NOT QML) - target_sources(mixxx-lib PRIVATE - # The following sources need to be in the QML target in order to get QML_ELEMENT properly interpreted. - # However, if we build Mixxx without QML support, these are still required, so it gets appended to the - # main target - src/control/controlmodel.cpp - src/control/controlsortfiltermodel.cpp +if(NOT QML) + target_sources( + mixxx-lib + PRIVATE + # The following sources need to be in the QML target in order to get QML_ELEMENT properly interpreted. + # However, if we build Mixxx without QML support, these are still required, so it gets appended to the + # main target + src/control/controlmodel.cpp + src/control/controlsortfiltermodel.cpp ) else() - target_sources(mixxx-lib PRIVATE - # The following source depends of QML being available but aren't part of the new QML UI - src/controllers/rendering/controllerrenderingengine.cpp - src/controllers/controllerenginethreadcontrol.cpp - src/controllers/controllerscreenpreview.cpp + target_sources( + mixxx-lib + PRIVATE + # The following source depends of QML being available but aren't part of the new QML UI + src/controllers/rendering/controllerrenderingengine.cpp + src/controllers/controllerenginethreadcontrol.cpp + src/controllers/controllerscreenpreview.cpp ) endif() if(QOPENGL) - target_sources(mixxx-lib PRIVATE - src/shaders/endoftrackshader.cpp - src/shaders/slipmodeshader.cpp - src/shaders/patternshader.cpp - src/shaders/rgbashader.cpp - src/shaders/rgbshader.cpp - src/shaders/shader.cpp - src/shaders/textureshader.cpp - src/shaders/unicolorshader.cpp - src/shaders/vinylqualityshader.cpp - src/util/opengltexture2d.cpp - src/waveform/renderers/allshader/digitsrenderer.cpp - src/waveform/renderers/allshader/matrixforwidgetgeometry.cpp - src/waveform/renderers/allshader/waveformrenderbackground.cpp - src/waveform/renderers/allshader/waveformrenderbeat.cpp - src/waveform/renderers/allshader/waveformrenderer.cpp - src/waveform/renderers/allshader/waveformrendererendoftrack.cpp - src/waveform/renderers/allshader/waveformrendererslipmode.cpp - src/waveform/renderers/allshader/waveformrendererfiltered.cpp - src/waveform/renderers/allshader/waveformrendererhsv.cpp - src/waveform/renderers/allshader/waveformrendererpreroll.cpp - src/waveform/renderers/allshader/waveformrendererrgb.cpp - src/waveform/renderers/allshader/waveformrenderertextured.cpp - src/waveform/renderers/allshader/waveformrenderersignalbase.cpp - src/waveform/renderers/allshader/waveformrenderersimple.cpp - src/waveform/renderers/allshader/waveformrendermark.cpp - src/waveform/renderers/allshader/waveformrendermarkrange.cpp - src/waveform/widgets/allshader/waveformwidget.cpp - src/widget/openglwindow.cpp - src/widget/tooltipqopengl.cpp - src/widget/wglwidgetqopengl.cpp - src/widget/winitialglwidget.cpp - src/widget/wspinnyglsl.cpp - src/widget/wvumeterglsl.cpp + target_sources( + mixxx-lib + PRIVATE + src/shaders/endoftrackshader.cpp + src/shaders/slipmodeshader.cpp + src/shaders/patternshader.cpp + src/shaders/rgbashader.cpp + src/shaders/rgbshader.cpp + src/shaders/shader.cpp + src/shaders/textureshader.cpp + src/shaders/unicolorshader.cpp + src/shaders/vinylqualityshader.cpp + src/util/opengltexture2d.cpp + src/waveform/renderers/allshader/digitsrenderer.cpp + src/waveform/renderers/allshader/matrixforwidgetgeometry.cpp + src/waveform/renderers/allshader/waveformrenderbackground.cpp + src/waveform/renderers/allshader/waveformrenderbeat.cpp + src/waveform/renderers/allshader/waveformrenderer.cpp + src/waveform/renderers/allshader/waveformrendererendoftrack.cpp + src/waveform/renderers/allshader/waveformrendererslipmode.cpp + src/waveform/renderers/allshader/waveformrendererfiltered.cpp + src/waveform/renderers/allshader/waveformrendererhsv.cpp + src/waveform/renderers/allshader/waveformrendererpreroll.cpp + src/waveform/renderers/allshader/waveformrendererrgb.cpp + src/waveform/renderers/allshader/waveformrenderertextured.cpp + src/waveform/renderers/allshader/waveformrenderersignalbase.cpp + src/waveform/renderers/allshader/waveformrenderersimple.cpp + src/waveform/renderers/allshader/waveformrendermark.cpp + src/waveform/renderers/allshader/waveformrendermarkrange.cpp + src/waveform/widgets/allshader/waveformwidget.cpp + src/widget/openglwindow.cpp + src/widget/tooltipqopengl.cpp + src/widget/wglwidgetqopengl.cpp + src/widget/winitialglwidget.cpp + src/widget/wspinnyglsl.cpp + src/widget/wvumeterglsl.cpp ) else() - target_sources(mixxx-lib PRIVATE - src/waveform/renderers/qtvsynctestrenderer.cpp - src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp - src/waveform/renderers/qtwaveformrenderersimplesignal.cpp - src/widget/wglwidgetqglwidget.cpp + target_sources( + mixxx-lib + PRIVATE + src/waveform/renderers/qtvsynctestrenderer.cpp + src/waveform/renderers/qtwaveformrendererfilteredsignal.cpp + src/waveform/renderers/qtwaveformrenderersimplesignal.cpp + src/widget/wglwidgetqglwidget.cpp ) endif() -set_source_files_properties(src/util/moc_included_test.cpp PROPERTIES SKIP_PRECOMPILE_HEADERS ON) +set_source_files_properties( + src/util/moc_included_test.cpp + PROPERTIES SKIP_PRECOMPILE_HEADERS ON +) -set_target_properties(mixxx-lib PROPERTIES AUTOMOC ON AUTOUIC ON CXX_CLANG_TIDY "${CLANG_TIDY}") -target_include_directories(mixxx-lib PUBLIC src "${CMAKE_CURRENT_BINARY_DIR}/src") +set_target_properties( + mixxx-lib + PROPERTIES AUTOMOC ON AUTOUIC ON CXX_CLANG_TIDY "${CLANG_TIDY}" +) +target_include_directories( + mixxx-lib + PUBLIC src "${CMAKE_CURRENT_BINARY_DIR}/src" +) if(UNIX AND NOT APPLE) target_sources(mixxx-lib PRIVATE src/util/rlimit.cpp) set(MIXXX_SETTINGS_PATH ".mixxx/") @@ -1567,24 +1842,25 @@ if(APPLE) # Apple's Metal API in the foreseeable future. target_compile_definitions(mixxx-lib PUBLIC GL_SILENCE_DEPRECATION) - target_sources(mixxx-lib PRIVATE - src/util/appleosversion.mm - ) + target_sources(mixxx-lib PRIVATE src/util/appleosversion.mm) if(IOS) - target_sources(mixxx-lib PRIVATE - src/soundio/soundmanagerios.mm - src/util/screensaverios.mm + target_sources( + mixxx-lib + PRIVATE src/soundio/soundmanagerios.mm src/util/screensaverios.mm ) else() - target_sources(mixxx-lib PRIVATE - src/util/darkappearance.mm - ) + target_sources(mixxx-lib PRIVATE src/util/darkappearance.mm) - option(MACOS_ITUNES_LIBRARY "Native macOS iTunes/Music.app library integration" ON) + option( + MACOS_ITUNES_LIBRARY + "Native macOS iTunes/Music.app library integration" + ON + ) if(MACOS_ITUNES_LIBRARY) - target_sources(mixxx-lib PRIVATE - src/library/itunes/itunesmacosimporter.mm + target_sources( + mixxx-lib + PRIVATE src/library/itunes/itunesmacosimporter.mm ) target_link_libraries(mixxx-lib PRIVATE "-weak_framework iTunesLibrary") target_compile_definitions(mixxx-lib PUBLIC __MACOS_ITUNES_LIBRARY__) @@ -1593,15 +1869,17 @@ if(APPLE) option(AU_EFFECTS "Audio Unit (AU) effects integration" ON) if(AU_EFFECTS) - target_sources(mixxx-lib PRIVATE - src/effects/backends/audiounit/audiounitbackend.mm - src/effects/backends/audiounit/audiounitmanager.mm - src/effects/backends/audiounit/audiouniteffectprocessor.mm - src/effects/backends/audiounit/audiounitmanifest.mm + target_sources( + mixxx-lib + PRIVATE + src/effects/backends/audiounit/audiounitbackend.mm + src/effects/backends/audiounit/audiounitmanager.mm + src/effects/backends/audiounit/audiouniteffectprocessor.mm + src/effects/backends/audiounit/audiounitmanifest.mm ) - target_link_libraries(mixxx-lib PRIVATE - "-weak_framework AudioToolbox" - "-weak_framework AVFAudio" + target_link_libraries( + mixxx-lib + PRIVATE "-weak_framework AudioToolbox" "-weak_framework AVFAudio" ) target_compile_definitions(mixxx-lib PUBLIC __AU_EFFECTS__) endif() @@ -1617,7 +1895,10 @@ endif() # QML Debugging if(CMAKE_BUILD_TYPE STREQUAL "Debug") target_compile_definitions(mixxx-lib PUBLIC QT_QML_DEBUG) - message(STATUS "Enabling QML Debugging! This poses a security risk as Mixxx will open a TCP port for debugging") + message( + STATUS + "Enabling QML Debugging! This poses a security risk as Mixxx will open a TCP port for debugging" + ) endif() option(WARNINGS_PEDANTIC "Let the compiler show even more warnings" OFF) @@ -1625,38 +1906,60 @@ if(MSVC) if(WARNINGS_PEDANTIC) target_compile_options(mixxx-lib PUBLIC /W4) else() - target_compile_options(mixxx-lib PUBLIC - /W3 # Warning Level 3 (production quality) + target_compile_options( + mixxx-lib + PUBLIC + /W3 # Warning Level 3 (production quality) /wd4200 # C4200: nonstandard extension used: zero-sized array in struct/union - # Note: Even with CMAKE_C_STANDARD = 99 MSVC does not complain about C99 flexible array members + # Note: Even with CMAKE_C_STANDARD = 99 MSVC does not complain about C99 flexible array members + ) + target_compile_definitions( + mixxx-lib + PUBLIC + _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING + _CRT_SECURE_NO_WARNINGS ) - target_compile_definitions(mixxx-lib PUBLIC _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING _CRT_SECURE_NO_WARNINGS) endif() else() # TODO: Add -Wtrampolines, not yet supported by clazy - target_compile_options(mixxx-lib PUBLIC -Wall -Wextra $<$:-Woverloaded-virtual> -Wfloat-conversion -Werror=return-type -Wformat=2 -Wformat-security -Wvla -Wundef) + target_compile_options( + mixxx-lib + PUBLIC + -Wall + -Wextra + $<$:-Woverloaded-virtual> + -Wfloat-conversion + -Werror=return-type + -Wformat=2 + -Wformat-security + -Wvla + -Wundef + ) if(WARNINGS_PEDANTIC) target_compile_options(mixxx-lib PUBLIC -pedantic) endif() endif() option(INFO_VECTORIZE "Let the compiler show vectorized loops" OFF) -if (INFO_VECTORIZE) - if(MSVC) - target_compile_options(mixxx-lib PUBLIC /Qvec-report:1) - elseif(GNU_GCC) - target_compile_options(mixxx-lib PUBLIC -fopt-info-vec-optimized) - elseif(LLVM_CLANG) - target_compile_options(mixxx-lib PUBLIC -Rpass=loop-vectorize) - else() - message(STATUS "INFO_VECTORIZE not implemented for this compiler.") - endif() +if(INFO_VECTORIZE) + if(MSVC) + target_compile_options(mixxx-lib PUBLIC /Qvec-report:1) + elseif(GNU_GCC) + target_compile_options(mixxx-lib PUBLIC -fopt-info-vec-optimized) + elseif(LLVM_CLANG) + target_compile_options(mixxx-lib PUBLIC -Rpass=loop-vectorize) + else() + message(STATUS "INFO_VECTORIZE not implemented for this compiler.") + endif() endif() option(RELATIVE_MACRO_PATHS "Relativize __FILE__ paths" ON) if(RELATIVE_MACRO_PATHS) if(NOT MSVC) - target_compile_options(mixxx-lib PUBLIC "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=.") + target_compile_options( + mixxx-lib + PUBLIC "-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=." + ) endif() endif() @@ -1669,19 +1972,33 @@ if(WARNINGS_FATAL) endif() endif() -target_compile_definitions(mixxx-lib PUBLIC - "${CMAKE_SYSTEM_PROCESSOR}" - $<$:MIXXX_BUILD_DEBUG> - $<$:MIXXX_DEBUG_ASSERTIONS_ENABLED> - $<$>:MIXXX_BUILD_RELEASE> +target_compile_definitions( + mixxx-lib + PUBLIC + "${CMAKE_SYSTEM_PROCESSOR}" + $<$:MIXXX_BUILD_DEBUG> + $<$:MIXXX_DEBUG_ASSERTIONS_ENABLED> + $<$>:MIXXX_BUILD_RELEASE> ) # Mac-specific options # # These options are OFF by default, and since they are only available on macOS, # they are forcibly set to OFF on all other platforms. -cmake_dependent_option(MACOS_BUNDLE "Install files to proper locations to make an .app bundle" OFF "APPLE" OFF) -cmake_dependent_option(MACAPPSTORE "Build for Mac App Store" OFF "APPLE" OFF) +cmake_dependent_option( + MACOS_BUNDLE + "Install files to proper locations to make an .app bundle" + OFF + "APPLE" + OFF +) +cmake_dependent_option( + MACAPPSTORE + "Build for Mac App Store" + OFF + "APPLE" + OFF +) if(MACAPPSTORE) target_compile_definitions(mixxx-lib PUBLIC __MACAPPSTORE__) endif() @@ -1704,26 +2021,45 @@ set(MIXXX_INSTALL_BINDIR ".") set(MIXXX_INSTALL_DATADIR ".") set(MIXXX_INSTALL_DOCDIR "./doc") set(MIXXX_INSTALL_LICENSEDIR "./doc") -if (APPLE AND MACOS_BUNDLE) +if(APPLE AND MACOS_BUNDLE) set(MIXXX_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}") - set(MACOS_BUNDLE_NAME Mixxx CACHE STRING "The macOS app bundle and executable name") - set(MACOS_BUNDLE_IDENTIFIER org.mixxx.mixxx CACHE STRING "The macOS app bundle identifier") + set( + MACOS_BUNDLE_NAME + Mixxx + CACHE STRING + "The macOS app bundle and executable name" + ) + set( + MACOS_BUNDLE_IDENTIFIER + org.mixxx.mixxx + CACHE STRING + "The macOS app bundle identifier" + ) set(MIXXX_INSTALL_PREFIX "${MACOS_BUNDLE_NAME}.app") set(MIXXX_INSTALL_DATADIR "${MIXXX_INSTALL_PREFIX}/Contents/Resources") set(MIXXX_INSTALL_DOCDIR "${MIXXX_INSTALL_DATADIR}") set(MIXXX_INSTALL_LICENSEDIR "${MIXXX_INSTALL_DATADIR}/licenses") -elseif (APPLE AND IOS) +elseif(APPLE AND IOS) set(MIXXX_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}") - set(IOS_BUNDLE_NAME Mixxx CACHE STRING "The iOS app bundle and executable name") - set(IOS_BUNDLE_IDENTIFIER org.mixxx.mixxx CACHE STRING "The iOS app bundle identifier") -elseif (UNIX) + set( + IOS_BUNDLE_NAME + Mixxx + CACHE STRING + "The iOS app bundle and executable name" + ) + set( + IOS_BUNDLE_IDENTIFIER + org.mixxx.mixxx + CACHE STRING + "The iOS app bundle identifier" + ) +elseif(UNIX) set(MIXXX_INSTALL_BINDIR "${CMAKE_INSTALL_BINDIR}") set(MIXXX_INSTALL_DATADIR "${CMAKE_INSTALL_DATADIR}/${CMAKE_PROJECT_NAME}") set(MIXXX_INSTALL_DOCDIR "${CMAKE_INSTALL_DOCDIR}") set(MIXXX_INSTALL_LICENSEDIR "${CMAKE_INSTALL_DOCDIR}") endif() - if(WIN32) target_compile_definitions(mixxx-lib PUBLIC __WINDOWS__) @@ -1764,7 +2100,7 @@ if(QT6) find_package(Qt6 COMPONENTS Core) # For Qt Core cmake functions # This is the first package form the environment, if this fails give hints how to install the environment if(NOT Qt6_FOUND) - FATAL_ERROR_MISSING_ENV() + fatal_error_missing_env() endif() # qt_add_executable() is the recommended initial call for qt_finalize_target() # below that takes care of the correct object order in the resulting binary @@ -1775,7 +2111,7 @@ else() find_package(Qt5 COMPONENTS Core) # For Qt Core cmake functions # This is the first package form the environment, if this fails give hints how to install the environment if(NOT Qt5_FOUND) - FATAL_ERROR_MISSING_ENV() + fatal_error_missing_env() endif() add_executable(mixxx WIN32 src/main.cpp) endif() @@ -1786,8 +2122,8 @@ target_link_libraries(mixxx PRIVATE mixxx-lib mixxx-gitinfostore) # # Installation and Packaging # -if (APPLE) - if (IOS) +if(APPLE) + if(IOS) set(IOS_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}") set(IOS_BUNDLE_SHORTVERSION "${CMAKE_PROJECT_VERSION}") @@ -1796,29 +2132,44 @@ if (APPLE) file(GLOB IOS_RESOURCES res/**) list(APPEND IOS_RESOURCES packaging/ios/Assets.xcassets) target_sources(mixxx PUBLIC ${IOS_RESOURCES}) - set_source_files_properties(${IOS_RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + set_source_files_properties( + ${IOS_RESOURCES} + PROPERTIES MACOSX_PACKAGE_LOCATION Resources + ) source_group(Resources FILES ${IOS_RESOURCES}) - set(QT_IOS_LAUNCH_SCREEN "${CMAKE_CURRENT_SOURCE_DIR}/packaging/ios/LaunchScreen.storyboard") + set( + QT_IOS_LAUNCH_SCREEN + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/ios/LaunchScreen.storyboard" + ) - set_target_properties(mixxx PROPERTIES - MACOSX_BUNDLE true - OUTPUT_NAME "${IOS_BUNDLE_NAME}" - MACOSX_BUNDLE_BUNDLE_NAME "${IOS_BUNDLE_NAME}" - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/packaging/ios/Info.plist.in" - MACOSX_BUNDLE_GUI_IDENTIFIER "${IOS_BUNDLE_IDENTIFIER}" - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" + set_target_properties( + mixxx + PROPERTIES + MACOSX_BUNDLE true + OUTPUT_NAME "${IOS_BUNDLE_NAME}" + MACOSX_BUNDLE_BUNDLE_NAME "${IOS_BUNDLE_NAME}" + MACOSX_BUNDLE_INFO_PLIST + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/ios/Info.plist.in" + MACOSX_BUNDLE_GUI_IDENTIFIER "${IOS_BUNDLE_IDENTIFIER}" + XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon" + ) + elseif(MACOS_BUNDLE) + install( + FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/osx/application.icns" + DESTINATION ${MIXXX_INSTALL_DATADIR} ) - elseif (MACOS_BUNDLE) - install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/osx/application.icns" DESTINATION ${MIXXX_INSTALL_DATADIR}) set(MACOS_BUNDLE_VERSION "${CMAKE_PROJECT_VERSION}") set(MACOS_BUNDLE_SHORTVERSION "${CMAKE_PROJECT_VERSION}") - set_target_properties(mixxx PROPERTIES + set_target_properties( + mixxx + PROPERTIES MACOSX_BUNDLE true OUTPUT_NAME "${MACOS_BUNDLE_NAME}" - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/Info.plist.in" + MACOSX_BUNDLE_INFO_PLIST + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/Info.plist.in" ) endif() endif() @@ -1828,7 +2179,10 @@ if(EMSCRIPTEN) # This will generate a mixxx.data file containing all the resources. # See https://emscripten.org/docs/porting/files/packaging_files.html # TODO: Strip this down by only including what we need (i.e. no macOS/Linux packaging, ...) - target_link_options(mixxx-lib PUBLIC "--preload-file=${CMAKE_CURRENT_SOURCE_DIR}/res@/res") + target_link_options( + mixxx-lib + PUBLIC "--preload-file=${CMAKE_CURRENT_SOURCE_DIR}/res@/res" + ) endif() if(WIN32) @@ -1840,49 +2194,37 @@ if(WIN32) endif() install( - TARGETS - mixxx - RUNTIME DESTINATION - "${MIXXX_INSTALL_BINDIR}" - BUNDLE DESTINATION - . + TARGETS mixxx + RUNTIME DESTINATION "${MIXXX_INSTALL_BINDIR}" + BUNDLE DESTINATION . ) # Skins install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/skins" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/skins" + DESTINATION "${MIXXX_INSTALL_DATADIR}" ) # Controller mappings install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/controllers" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/controllers" + DESTINATION "${MIXXX_INSTALL_DATADIR}" ) # Effect presets install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/effects" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/effects" + DESTINATION "${MIXXX_INSTALL_DATADIR}" ) # Translation files install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/translations" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" - FILES_MATCHING PATTERN - "*.qm" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/translations" + DESTINATION "${MIXXX_INSTALL_DATADIR}" + FILES_MATCHING + PATTERN "*.qm" ) - # Font files # # Font installation is only enabled on Windows and macOS, because on Linux/BSD @@ -1893,19 +2235,15 @@ install( # fonts here. if(APPLE OR WIN32) install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/fonts" + DESTINATION "${MIXXX_INSTALL_DATADIR}" ) endif() # Keyboard mapping(s) install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/keyboard" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/keyboard" + DESTINATION "${MIXXX_INSTALL_DATADIR}" ) # Licenses @@ -1913,8 +2251,7 @@ install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" "${CMAKE_CURRENT_SOURCE_DIR}/COPYING" - DESTINATION - "${MIXXX_INSTALL_LICENSEDIR}" + DESTINATION "${MIXXX_INSTALL_LICENSEDIR}" ) # Documentation @@ -1922,15 +2259,12 @@ install( FILES "${CMAKE_CURRENT_SOURCE_DIR}/README.md" "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Keyboard-Shortcuts.pdf" - DESTINATION - "${MIXXX_INSTALL_DOCDIR}" + DESTINATION "${MIXXX_INSTALL_DOCDIR}" ) if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf") install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf" - DESTINATION - "${MIXXX_INSTALL_DOCDIR}" + FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf" + DESTINATION "${MIXXX_INSTALL_DOCDIR}" ) endif() @@ -1938,61 +2272,62 @@ endif() if(UNIX AND NOT APPLE) # .desktop file for KDE/GNOME menu install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/org.mixxx.Mixxx.desktop" - DESTINATION - "${CMAKE_INSTALL_DATADIR}/applications" + FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/org.mixxx.Mixxx.desktop" + DESTINATION "${CMAKE_INSTALL_DATADIR}/applications" ) # Icon files for menu entry install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/images/icons/" - DESTINATION - "${CMAKE_INSTALL_DATADIR}/icons/hicolor" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/images/icons/" + DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor" # This file is for Windows. PATTERN ic_mixxx.ico EXCLUDE ) # .metainfo.xml file for KDE/GNOME AppStream initiative install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/org.mixxx.Mixxx.metainfo.xml" - DESTINATION - "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" + FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/org.mixxx.Mixxx.metainfo.xml" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" ) - option(INSTALL_USER_UDEV_RULES "Install user udev rule file for USB HID and Bulk controllers" ON) + option( + INSTALL_USER_UDEV_RULES + "Install user udev rule file for USB HID and Bulk controllers" + ON + ) if(INSTALL_USER_UDEV_RULES) set(MIXXX_UDEVDIR "${MIXXX_INSTALL_DATADIR}/udev") - if (CMAKE_INSTALL_PREFIX STREQUAL "/usr" OR CMAKE_INSTALL_PREFIX STREQUAL "/" ) + if( + CMAKE_INSTALL_PREFIX STREQUAL "/usr" + OR CMAKE_INSTALL_PREFIX STREQUAL "/" + ) # /usr and / install prefixes at treated by cmake GNUInstallDirs as # synonym for "system location". In this case we can look up the correct udevdir # using pkg-config. # See: https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html#special-cases find_package(PkgConfig) - if (PKG_CONFIG_FOUND) - pkg_check_modules( PKGCONFIG_UDEV udev) - if (PKGCONFIG_UDEV_FOUND) - execute_process( - COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=udevdir udev + if(PKG_CONFIG_FOUND) + pkg_check_modules(PKGCONFIG_UDEV udev) + if(PKGCONFIG_UDEV_FOUND) + execute_process( + COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=udevdir udev OUTPUT_VARIABLE PKGCONFIG_UDEVDIR OUTPUT_STRIP_TRAILING_WHITESPACE ) if(PKGCONFIG_UDEVDIR) - file(TO_CMAKE_PATH "${PKGCONFIG_UDEVDIR}" MIXXX_UDEVDIR) + file(TO_CMAKE_PATH "${PKGCONFIG_UDEVDIR}" MIXXX_UDEVDIR) endif() endif() endif() endif() - if (MIXXX_UDEVDIR STREQUAL "${MIXXX_INSTALL_DATADIR}/udev") + if(MIXXX_UDEVDIR STREQUAL "${MIXXX_INSTALL_DATADIR}/udev") install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules" - DESTINATION - "${MIXXX_UDEVDIR}/rules.d" + FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules" + DESTINATION "${MIXXX_UDEVDIR}/rules.d" ) - install(CODE " + install( + CODE + " message(STATUS \"Important Note: Installation of udev rules\n\" \"The udev rule file for USB HID and Bulk controller permissions have been\n\" \"installed to:\n\" @@ -2005,15 +2340,13 @@ if(UNIX AND NOT APPLE) \"system rules is either /lib/udev/rules.d (e.g. Debian, Fedora) or\n\" \"/usr/lib/udev/rules.d (e.g. Arch Linux) with an appropriate priority prefix.\n\" \"Adjust your package script accordingly and set -DINSTALL_USER_UDEV_RULES=OFF\") - ") + " + ) else() install( - FILES - "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules" - DESTINATION - "${MIXXX_UDEVDIR}/rules.d" - RENAME - "69-mixxx-usb-uaccess.rules" + FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules" + DESTINATION "${MIXXX_UDEVDIR}/rules.d" + RENAME "69-mixxx-usb-uaccess.rules" ) endif() endif() @@ -2025,7 +2358,8 @@ if(MSVC) FILES $ CONFIGURATIONS Debug RelWithDebInfo DESTINATION "${MIXXX_INSTALL_BINDIR}" - COMPONENT PDB # No spaces allowed + COMPONENT + PDB # No spaces allowed ) endif() @@ -2033,12 +2367,18 @@ if(WIN32 AND NOT QT6) # Qt 5 loads these ANGLE DLLs at runtime if the graphics driver is on the ignore list. # It does not work with Debug, because the debug version is compiled without the a d suffix find_package(unofficial-angle CONFIG REQUIRED) - install(IMPORTED_RUNTIME_ARTIFACTS - unofficial::angle::libEGL - unofficial::angle::libGLESv2 - CONFIGURATIONS RelWithDebInfo Release - DESTINATION "${MIXXX_INSTALL_BINDIR}" - COMPONENT applocal) + install( + IMPORTED_RUNTIME_ARTIFACTS + unofficial::angle::libEGL + unofficial::angle::libGLESv2 + CONFIGURATIONS + RelWithDebInfo + Release + DESTINATION + "${MIXXX_INSTALL_BINDIR}" + COMPONENT + applocal + ) set(APPLOCAL_COMPONENT_DEFINED true) endif() @@ -2046,7 +2386,8 @@ endif() # Tests # -add_executable(mixxx-test +add_executable( + mixxx-test src/test/analyserwaveformtest.cpp src/test/analyzersilence_test.cpp src/test/audiotaperpot_test.cpp @@ -2166,15 +2507,20 @@ add_executable(mixxx-test src/util/moc_included_test.cpp src/test/helpers/log_test.cpp ) -if (QML) - target_sources(mixxx-test PRIVATE - src/test/controller_mapping_file_handler_test.cpp - src/test/controllerrenderingengine_test.cpp +if(QML) + target_sources( + mixxx-test + PRIVATE + src/test/controller_mapping_file_handler_test.cpp + src/test/controllerrenderingengine_test.cpp ) endif() find_package(GTest CONFIG REQUIRED) set_target_properties(mixxx-test PROPERTIES AUTOMOC ON) -target_link_libraries(mixxx-test PRIVATE mixxx-lib mixxx-gitinfostore GTest::gtest GTest::gmock) +target_link_libraries( + mixxx-test + PRIVATE mixxx-lib mixxx-gitinfostore GTest::gtest GTest::gmock +) find_package(benchmark) target_link_libraries(mixxx-test PRIVATE benchmark::benchmark) @@ -2187,12 +2533,17 @@ target_link_libraries(mixxx-test PRIVATE benchmark::benchmark) # calls that are not present at the moment. Further information can be found # at: https://doc.qt.io/qt5/resources.html#using-resources-in-a-library option(DOWNLOAD_MANUAL "Download Manual PDF from Mixxx website" OFF) -if(DOWNLOAD_MANUAL AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf") - set(MANUAL_URL "https://downloads.mixxx.org/manual/${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}/mixxx-manual-${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}-en.pdf") +if( + DOWNLOAD_MANUAL + AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf" +) + set( + MANUAL_URL + "https://downloads.mixxx.org/manual/${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}/mixxx-manual-${CMAKE_PROJECT_VERSION_MAJOR}.${CMAKE_PROJECT_VERSION_MINOR}-en.pdf" + ) message(STATUS "Downloading manual from ${MANUAL_URL}...") - file(DOWNLOAD - "${MANUAL_URL}" - "${CMAKE_CURRENT_BINARY_DIR}/res/Mixxx-Manual.pdf" + file( + DOWNLOAD "${MANUAL_URL}" "${CMAKE_CURRENT_BINARY_DIR}/res/Mixxx-Manual.pdf" SHOW_PROGRESS STATUS MANUAL_PDF_DOWNLOAD TLS_VERIFY ON @@ -2200,14 +2551,21 @@ if(DOWNLOAD_MANUAL AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual. list(GET MANUAL_PDF_DOWNLOAD 0 MANUAL_PDF_DOWNLOAD_ERROR) if(NOT MANUAL_PDF_DOWNLOAD_ERROR EQUAL 0) list(GET MANUAL_PDF_DOWNLOAD 1 MANUAL_PDF_DOWNLOAD_MESSGAE) - message(FATAL_ERROR "Manual PDF download failed with: " - "${MANUAL_PDF_DOWNLOAD_MESSGAE} Code: ${MANUAL_PDF_DOWNLOAD_ERROR}. " - "Either download it yourself and move it to " - "'${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf' or " - "reconfigure with -DDOWNLOAD_MANUAL=OFF to build without included " - "manual.") + message( + FATAL_ERROR + "Manual PDF download failed with: " + "${MANUAL_PDF_DOWNLOAD_MESSGAE} Code: ${MANUAL_PDF_DOWNLOAD_ERROR}. " + "Either download it yourself and move it to " + "'${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf' or " + "reconfigure with -DDOWNLOAD_MANUAL=OFF to build without included " + "manual." + ) endif() - file(RENAME "${CMAKE_CURRENT_BINARY_DIR}/res/Mixxx-Manual.pdf" "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf") + file( + RENAME + "${CMAKE_CURRENT_BINARY_DIR}/res/Mixxx-Manual.pdf" + "${CMAKE_CURRENT_SOURCE_DIR}/res/Mixxx-Manual.pdf" + ) endif() target_sources(mixxx PRIVATE res/mixxx.qrc) @@ -2215,10 +2573,10 @@ set_target_properties(mixxx PROPERTIES AUTORCC ON) target_sources(mixxx-test PRIVATE res/mixxx.qrc) set_target_properties(mixxx-test PROPERTIES AUTORCC ON) -if (MIXXX_VERSION_PRERELEASE STREQUAL "") - set(MIXXX_VERSION "${CMAKE_PROJECT_VERSION}") +if(MIXXX_VERSION_PRERELEASE STREQUAL "") + set(MIXXX_VERSION "${CMAKE_PROJECT_VERSION}") else() - set(MIXXX_VERSION "${CMAKE_PROJECT_VERSION}-${MIXXX_VERSION_PRERELEASE}") + set(MIXXX_VERSION "${CMAKE_PROJECT_VERSION}-${MIXXX_VERSION_PRERELEASE}") endif() get_target_property(MIXXX_BUILD_FLAGS mixxx-lib COMPILE_OPTIONS) @@ -2226,20 +2584,31 @@ get_target_property(MIXXX_BUILD_FLAGS mixxx-lib COMPILE_OPTIONS) # uses CMAKE_PROJECT_VERSION MIXXX_VERSION_PRERELEASE MIXXX_BUILD_FLAGS configure_file(src/version.h.in src/version.h @ONLY) -if(GIT_COMMIT_DATE AND NOT GIT_COMMIT_DATE MATCHES "^[0-9]*-[0-9]*-[0-9]*T[0-9]*\\:[0-9]*\\:[0-9]*[+-][0-9]*\\:[0-9]*$") - message(FATAL_ERROR "GIT_COMMIT_DATE requires strict ISO 8601 format %Y-%m-%dT%H:%M:%SZ") +if( + GIT_COMMIT_DATE + AND + NOT + GIT_COMMIT_DATE + MATCHES + "^[0-9]*-[0-9]*-[0-9]*T[0-9]*\\:[0-9]*\\:[0-9]*[+-][0-9]*\\:[0-9]*$" +) + message( + FATAL_ERROR + "GIT_COMMIT_DATE requires strict ISO 8601 format %Y-%m-%dT%H:%M:%SZ" + ) endif() -add_custom_target(mixxx-gitinfo +add_custom_target( + mixxx-gitinfo # Note: We don't quote the paths in the command since CMake already inserts # escapes (which, if quoted, lead to paths wrongly containing backslashes). # See https://stackoverflow.com/questions/8925396/why-does-cmake-prefixes-spaces-with-backslashes-when-executing-a-command - COMMAND ${CMAKE_COMMAND} - -DGIT_DESCRIBE=${GIT_DESCRIBE} + COMMAND + ${CMAKE_COMMAND} -DGIT_DESCRIBE=${GIT_DESCRIBE} -DGIT_COMMIT_DATE=${GIT_COMMIT_DATE} -DINPUT_FILE=${CMAKE_CURRENT_SOURCE_DIR}/src/gitinfo.h.in - -DOUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h - -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/gitinfo.cmake + -DOUTPUT_FILE=${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h -P + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/scripts/gitinfo.cmake COMMENT "Update git version information in gitinfo.h" BYPRODUCTS "${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h" WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" @@ -2249,7 +2618,10 @@ add_custom_target(mixxx-gitinfo if(WIN32) string(TIMESTAMP MIXXX_YEAR "%Y") - set(MIXXX_FILEVERSION "${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH}") + set( + MIXXX_FILEVERSION + "${CMAKE_PROJECT_VERSION_MAJOR},${CMAKE_PROJECT_VERSION_MINOR},${CMAKE_PROJECT_VERSION_PATCH}" + ) set(MIXXX_PRODUCTVERSION "${MIXXX_FILEVERSION}") if(CMAKE_BUILD_TYPE STREQUAL "Debug") @@ -2258,24 +2630,22 @@ if(WIN32) set(MIXXX_DEBUG 0) endif() - if (MIXXX_VERSION_PRERELEASE STREQUAL "") + if(MIXXX_VERSION_PRERELEASE STREQUAL "") set(MIXXX_PRERELEASE 0) else() set(MIXXX_PRERELEASE 1) endif() # uses MIXXX_YEAR MIXXX_FILEVERSION MIXXX_PRODUCTVERSION MIXXX_VERSION MIXXX_DEBUG MIXXX_PRERELEASE - configure_file( - "src/mixxx.rc.include.in" - "src/mixxx.rc.include" - @ONLY - ) + configure_file("src/mixxx.rc.include.in" "src/mixxx.rc.include" @ONLY) add_dependencies(mixxx mixxx-gitinfo) - target_sources(mixxx PRIVATE - src/mixxx.rc - "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" - "${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h" + target_sources( + mixxx + PRIVATE + src/mixxx.rc + "${CMAKE_CURRENT_BINARY_DIR}/src/mixxx.rc.include" + "${CMAKE_CURRENT_BINARY_DIR}/src/gitinfo.h" ) target_include_directories(mixxx PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") endif() @@ -2302,10 +2672,19 @@ else() set(LOCALECOMPARE_DEFAULT OFF) endif() endif() -cmake_dependent_option(LOCALECOMPARE "Locale Aware Compare support for SQLite" ON "LOCALECOMPARE_DEFAULT" OFF) +cmake_dependent_option( + LOCALECOMPARE + "Locale Aware Compare support for SQLite" + ON + "LOCALECOMPARE_DEFAULT" + OFF +) if(LOCALECOMPARE) if(NOT SQLite3_FOUND) - message(FATAL_ERROR "Locale Aware Compare for SQLite requires libsqlite and its development headers.") + 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 SQLite::SQLite3) @@ -2321,9 +2700,9 @@ if(ENGINEPRIME) # statically. This situation should be reviewed once libdjinterop hits version 1.x. set(LIBDJINTEROP_VERSION 0.22.1) # Look whether an existing installation of libdjinterop matches the required version. - find_package(DjInterop ${LIBDJINTEROP_VERSION} EXACT CONFIG) + find_package(DjInterop ${LIBDJINTEROP_VERSION} EXACT CONFIG) if(NOT DjInterop_FOUND) - find_package(DjInterop ${LIBDJINTEROP_VERSION} EXACT MODULE) + find_package(DjInterop ${LIBDJINTEROP_VERSION} EXACT MODULE) endif() if(DjInterop_FOUND) @@ -2333,20 +2712,38 @@ if(ENGINEPRIME) else() # On MacOS, Mixxx does not use system SQLite, so we will use libdjinterop's # embedded SQLite in such a case. - if (APPLE AND NOT SQLite3_IS_STATIC) - message(STATUS "Building libdjinterop sources (with embedded SQLite) fetched from GitHub") + if(APPLE AND NOT SQLite3_IS_STATIC) + message( + STATUS + "Building libdjinterop sources (with embedded SQLite) fetched from GitHub" + ) set(DJINTEROP_SYSTEM_SQLITE OFF) else() - message(STATUS "Building libdjinterop sources (with system SQLite) fetched from GitHub") + message( + STATUS + "Building libdjinterop sources (with system SQLite) fetched from GitHub" + ) set(DJINTEROP_SYSTEM_SQLITE ON) endif() - set(DJINTEROP_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/libdjinterop-install") - set(DJINTEROP_LIBRARY "lib/${CMAKE_STATIC_LIBRARY_PREFIX}djinterop${CMAKE_STATIC_LIBRARY_SUFFIX}") + set( + DJINTEROP_INSTALL_DIR + "${CMAKE_CURRENT_BINARY_DIR}/lib/libdjinterop-install" + ) + set( + DJINTEROP_LIBRARY + "lib/${CMAKE_STATIC_LIBRARY_PREFIX}djinterop${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) # CMake does not pass lists of paths properly to external projects. # This is worked around by changing the list separator. - string(REPLACE ";" "|" PIPE_DELIMITED_CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}") + string( + REPLACE + ";" + "|" + PIPE_DELIMITED_CMAKE_PREFIX_PATH + "${CMAKE_PREFIX_PATH}" + ) # For offline builds download the archive file from the URL and # copy it into DOWNLOAD_DIR under DOWNLOAD_NAME prior to starting @@ -2358,18 +2755,19 @@ if(ENGINEPRIME) # GIT_REPOSITORY "https://github.com/abcd/your-fork-of-libdjinterop" # GIT_TAG "origin/name-of-your-branch" # - ExternalProject_Add(libdjinterop + ExternalProject_Add( + libdjinterop URL "https://github.com/xsco/libdjinterop/archive/refs/tags/${LIBDJINTEROP_VERSION}.tar.gz" "https://launchpad.net/~xsco/+archive/ubuntu/djinterop/+sourcefiles/libdjinterop/${LIBDJINTEROP_VERSION}-0ubuntu1/libdjinterop_${LIBDJINTEROP_VERSION}.orig.tar.gz" - URL_HASH SHA256=e811158d42c3864f5b682bcf76e0af78278050439d82d14d592dd0a391da6b20 + URL_HASH + SHA256=e811158d42c3864f5b682bcf76e0af78278050439d82d14d592dd0a391da6b20 DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads" DOWNLOAD_NAME "libdjinterop-${LIBDJINTEROP_VERSION}.tar.gz" INSTALL_DIR ${DJINTEROP_INSTALL_DIR} LIST_SEPARATOR "|" CMAKE_ARGS - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON + -DBUILD_SHARED_LIBS=OFF -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_PREFIX_PATH=${PIPE_DELIMITED_CMAKE_PREFIX_PATH} @@ -2403,25 +2801,32 @@ if(ENGINEPRIME) OUTPUT "${DJINTEROP_INSTALL_DIR}/${DJINTEROP_LIBRARY}" DEPENDS libdjinterop COMMAND echo libdjinterop installed + COMMENT + "Tell 'make' that libdjinterop is required for the djinterop target" ) endif() # Assemble a library based on the external project. add_library(mixxx-libdjinterop STATIC IMPORTED) - set_target_properties(mixxx-libdjinterop PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${DJINTEROP_INSTALL_DIR}/include" - INTERFACE_LINK_LIBRARIES ZLIB::ZLIB - IMPORTED_LOCATION "${DJINTEROP_INSTALL_DIR}/${DJINTEROP_LIBRARY}" + set_target_properties( + mixxx-libdjinterop + PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${DJINTEROP_INSTALL_DIR}/include" + INTERFACE_LINK_LIBRARIES ZLIB::ZLIB + IMPORTED_LOCATION "${DJINTEROP_INSTALL_DIR}/${DJINTEROP_LIBRARY}" ) add_dependencies(mixxx-libdjinterop libdjinterop) target_link_libraries(mixxx-lib PRIVATE mixxx-libdjinterop) endif() # Include conditional sources only required with Engine Prime export support. - target_sources(mixxx-lib PRIVATE - src/library/export/dlglibraryexport.cpp - src/library/export/engineprimeexportjob.cpp - src/library/export/libraryexporter.cpp) + target_sources( + mixxx-lib + PRIVATE + src/library/export/dlglibraryexport.cpp + src/library/export/engineprimeexportjob.cpp + src/library/export/libraryexporter.cpp + ) target_compile_definitions(mixxx-lib PUBLIC __ENGINEPRIME__) endif() @@ -2437,10 +2842,26 @@ if(MSVC) target_compile_options(fidlib PRIVATE /W3) elseif(MINGW) target_compile_definitions(fidlib PRIVATE T_MINGW) - target_compile_options(fidlib PRIVATE -fno-finite-math-only -Wall -Wextra -Wfloat-conversion -Werror=return-type) + target_compile_options( + fidlib + PRIVATE + -fno-finite-math-only + -Wall + -Wextra + -Wfloat-conversion + -Werror=return-type + ) else() target_compile_definitions(fidlib PRIVATE T_LINUX) - target_compile_options(fidlib PRIVATE -fno-finite-math-only -Wall -Wextra -Wfloat-conversion -Werror=return-type) + target_compile_options( + fidlib + PRIVATE + -fno-finite-math-only + -Wall + -Wextra + -Wfloat-conversion + -Werror=return-type + ) endif() target_include_directories(mixxx-lib SYSTEM PUBLIC lib/fidlib) target_link_libraries(mixxx-lib PRIVATE fidlib) @@ -2456,31 +2877,45 @@ if(KEYFINDER) set(MIN_LIBKEYFINDER_VERSION 2.2.4) set(FETCH_LIBKEYFINDER_VERSION 2.2.8) find_package(KeyFinder ${MIN_LIBKEYFINDER_VERSION}) - if (KeyFinder_FOUND) + if(KeyFinder_FOUND) target_link_libraries(mixxx-lib PRIVATE KeyFinder::KeyFinder) else() # If KeyFinder is built statically, we need FFTW find_package(FFTW REQUIRED) - set(KeyFinder_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/lib/keyfinder-install") - set(KeyFinder_LIBRARY "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keyfinder${CMAKE_STATIC_LIBRARY_SUFFIX}") + set( + KeyFinder_INSTALL_DIR + "${CMAKE_CURRENT_BINARY_DIR}/lib/keyfinder-install" + ) + set( + KeyFinder_LIBRARY + "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}keyfinder${CMAKE_STATIC_LIBRARY_SUFFIX}" + ) # CMake does not pass lists of paths properly to external projects. # This is worked around by changing the list separator. - string(REPLACE ";" "|" PIPE_DELIMITED_CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}") + string( + REPLACE + ";" + "|" + PIPE_DELIMITED_CMAKE_PREFIX_PATH + "${CMAKE_PREFIX_PATH}" + ) # For offline builds download the archive file from the URL and # copy it into DOWNLOAD_DIR under DOWNLOAD_NAME prior to starting # the configuration. - ExternalProject_Add(libkeyfinder - URL "https://github.com/mixxxdj/libkeyfinder/archive/refs/tags/${FETCH_LIBKEYFINDER_VERSION}.zip" - URL_HASH SHA256=4f10e9e5673d948776e47e78273fa4d61408155cb0e210af1538c83222f285d4 + ExternalProject_Add( + libkeyfinder + URL + "https://github.com/mixxxdj/libkeyfinder/archive/refs/tags/${FETCH_LIBKEYFINDER_VERSION}.zip" + URL_HASH + SHA256=4f10e9e5673d948776e47e78273fa4d61408155cb0e210af1538c83222f285d4 DOWNLOAD_DIR "${CMAKE_CURRENT_BINARY_DIR}/downloads" DOWNLOAD_NAME "libkeyfinder-${FETCH_LIBKEYFINDER_VERSION}.zip" INSTALL_DIR "${KeyFinder_INSTALL_DIR}" LIST_SEPARATOR "|" CMAKE_ARGS - -DBUILD_SHARED_LIBS=OFF - -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON + -DBUILD_SHARED_LIBS=OFF -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH= -DCMAKE_PREFIX_PATH=${PIPE_DELIMITED_CMAKE_PREFIX_PATH} @@ -2489,12 +2924,10 @@ if(KEYFINDER) -$,D,U>CMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMEN_TARGET} -$,D,U>CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} -DCMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR} - -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} - -DBUILD_TESTING=OFF + -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} -DBUILD_TESTING=OFF BUILD_COMMAND ${CMAKE_COMMAND} --build . BUILD_BYPRODUCTS /${KeyFinder_LIBRARY} EXCLUDE_FROM_ALL TRUE - LIST_SEPARATOR | ) # This is a bit of a hack to make sure that the include directory actually @@ -2515,14 +2948,23 @@ if(KEYFINDER) OUTPUT "${KeyFinder_INSTALL_DIR}/${KeyFinder_LIBRARY}" DEPENDS libkeyfinder COMMAND echo libkeyfinder installed + COMMENT + "Tell 'make' that libkeyfinder is required for the mixxx-keyfinder target" ) endif() add_library(mixxx-keyfinder STATIC IMPORTED) add_dependencies(mixxx-keyfinder libkeyfinder) - set_target_properties(mixxx-keyfinder PROPERTIES IMPORTED_LOCATION "${KeyFinder_INSTALL_DIR}/${KeyFinder_LIBRARY}") + set_target_properties( + mixxx-keyfinder + PROPERTIES + IMPORTED_LOCATION "${KeyFinder_INSTALL_DIR}/${KeyFinder_LIBRARY}" + ) target_link_libraries(mixxx-keyfinder INTERFACE FFTW::FFTW) - target_include_directories(mixxx-keyfinder INTERFACE "${KeyFinder_INSTALL_DIR}/include") + target_include_directories( + mixxx-keyfinder + INTERFACE "${KeyFinder_INSTALL_DIR}/include" + ) target_link_libraries(mixxx-lib PRIVATE mixxx-keyfinder) endif() @@ -2539,7 +2981,10 @@ target_link_libraries(mixxx-lib PRIVATE FLAC::FLAC) # from -ffast-math optimized objects. The MSVC option /fp:fast does not suffer this issue add_library(FpClassify STATIC EXCLUDE_FROM_ALL src/util/fpclassify.cpp) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC") +if( + CMAKE_CXX_COMPILER_ID MATCHES "Clang" + AND CMAKE_CXX_SIMULATE_ID MATCHES "MSVC" +) target_compile_options(FpClassify PRIVATE /fp:precise) elseif(GNU_GCC OR LLVM_CLANG) # The option `-ffp-contract=on` must precede `-fno-fast-math` @@ -2552,38 +2997,49 @@ target_link_libraries(mixxx-lib PRIVATE FpClassify) find_package(mp3lame REQUIRED) target_link_libraries(mixxx-lib PRIVATE mp3lame::mp3lame) -add_library(rekordbox_metadata STATIC EXCLUDE_FROM_ALL +add_library( + rekordbox_metadata + STATIC + EXCLUDE_FROM_ALL lib/rekordbox-metadata/rekordbox_pdb.cpp lib/rekordbox-metadata/rekordbox_anlz.cpp ) -target_include_directories(rekordbox_metadata SYSTEM PUBLIC lib/rekordbox-metadata) +target_include_directories( + rekordbox_metadata + SYSTEM + PUBLIC lib/rekordbox-metadata +) target_link_libraries(mixxx-lib PRIVATE rekordbox_metadata) #silence "enumeration values not handled in switch" in generated code if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") - target_compile_options(rekordbox_metadata PRIVATE -Wno-switch) + target_compile_options(rekordbox_metadata PRIVATE -Wno-switch) elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - target_compile_options(rekordbox_metadata PRIVATE /w44063) + target_compile_options(rekordbox_metadata PRIVATE /w44063) endif() # Kaitai for reading Rekordbox libraries -add_library(Kaitai STATIC EXCLUDE_FROM_ALL - lib/kaitai/kaitai/kaitaistream.cpp -) +add_library(Kaitai STATIC EXCLUDE_FROM_ALL lib/kaitai/kaitai/kaitaistream.cpp) target_include_directories(Kaitai SYSTEM PUBLIC lib/kaitai) target_compile_definitions(Kaitai PRIVATE KS_STR_ENCODING_NONE) target_link_libraries(rekordbox_metadata PRIVATE Kaitai) target_link_libraries(mixxx-lib PRIVATE Kaitai) # For determining MP3 timing offset cases in Rekordbox library feature -add_library(MP3GuessEnc STATIC EXCLUDE_FROM_ALL +add_library( + MP3GuessEnc + STATIC + EXCLUDE_FROM_ALL lib/mp3guessenc-0.27.4/mp3guessenc.c lib/mp3guessenc-0.27.4/tags.c lib/mp3guessenc-0.27.4/decode.c lib/mp3guessenc-0.27.4/bit_utils.c ) if(WIN32) - target_compile_definitions(MP3GuessEnc PRIVATE __WINDOWS__ _CRT_SECURE_NO_WARNINGS) + target_compile_definitions( + MP3GuessEnc + PRIVATE __WINDOWS__ _CRT_SECURE_NO_WARNINGS + ) endif() target_include_directories(MP3GuessEnc SYSTEM PUBLIC lib/mp3guessenc-0.27.4) target_link_libraries(mixxx-lib PRIVATE MP3GuessEnc) @@ -2610,7 +3066,10 @@ else() # Require WebGL 2.0 (for a WebGL-friendly subset of OpenGL ES 3.0) and # enable full OpenGL ES 2.0 emulation as per # https://emscripten.org/docs/porting/multimedia_and_graphics/OpenGL-support.html - target_link_options(mixxx-lib PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sFULL_ES2=1) + target_link_options( + mixxx-lib + PUBLIC -sMIN_WEBGL_VERSION=2 -sMAX_WEBGL_VERSION=2 -sFULL_ES2=1 + ) else() target_link_libraries(mixxx-lib PRIVATE OpenGL::GL) endif() @@ -2626,14 +3085,20 @@ target_link_libraries(mixxx-lib PRIVATE Ogg::ogg) # Vorbis find_package(Vorbis REQUIRED) -target_link_libraries(mixxx-lib PRIVATE Vorbis::vorbis Vorbis::vorbisenc Vorbis::vorbisfile) +target_link_libraries( + mixxx-lib + PRIVATE Vorbis::vorbis Vorbis::vorbisenc Vorbis::vorbisfile +) # PortAudio find_package(PortAudio REQUIRED) target_link_libraries(mixxx-lib PUBLIC PortAudio::PortAudio) # PortAudio Ring Buffer -add_library(PortAudioRingBuffer STATIC EXCLUDE_FROM_ALL +add_library( + PortAudioRingBuffer + STATIC + EXCLUDE_FROM_ALL lib/portaudio/pa_ringbuffer.c ) target_include_directories(mixxx-lib SYSTEM PUBLIC lib/portaudio) @@ -2646,9 +3111,11 @@ if(PORTMIDI) find_package(PortMidi REQUIRED) target_include_directories(mixxx-lib SYSTEM PUBLIC ${PortMidi_INCLUDE_DIRS}) target_link_libraries(mixxx-lib PRIVATE ${PortMidi_LIBRARIES}) - target_sources(mixxx-lib PRIVATE - src/controllers/midi/portmidicontroller.cpp - src/controllers/midi/portmidienumerator.cpp + target_sources( + mixxx-lib + PRIVATE + src/controllers/midi/portmidicontroller.cpp + src/controllers/midi/portmidienumerator.cpp ) endif() @@ -2658,23 +3125,27 @@ target_link_libraries(mixxx-lib PUBLIC mixxx-proto) # Rigtorp SPSC Queue # https://github.com/rigtorp/SPSCQueue -target_include_directories(mixxx-lib SYSTEM PUBLIC lib/rigtorp/SPSCQueue/include) +target_include_directories( + mixxx-lib + SYSTEM + PUBLIC lib/rigtorp/SPSCQueue/include +) # Qt set( QT_COMPONENTS - Concurrent - Core - Gui - Network - OpenGL - PrintSupport - Qml # for QJSEngine - Sql - Svg - Test - Widgets - Xml + Concurrent + Core + Gui + Network + OpenGL + PrintSupport + Qml # for QJSEngine + Sql + Svg + Test + Widgets + Xml ) set(QT_EXTRA_COMPONENTS "") if(QT6) @@ -2697,19 +3168,18 @@ if(QML) list(APPEND QT_EXTRA_COMPONENTS "QmlWorkerScript") list(APPEND QT_EXTRA_COMPONENTS "ShaderTools") endif() -find_package(Qt${QT_VERSION_MAJOR} - COMPONENTS - ${QT_COMPONENTS} - ${QT_EXTRA_COMPONENTS} +find_package( + Qt${QT_VERSION_MAJOR} + COMPONENTS ${QT_COMPONENTS} ${QT_EXTRA_COMPONENTS} REQUIRED ) # PUBLIC is required below to find included headers -foreach(COMPONENT ${QT_COMPONENTS}) - target_link_libraries(mixxx-lib PUBLIC Qt${QT_VERSION_MAJOR}::${COMPONENT}) +foreach(component ${QT_COMPONENTS}) + target_link_libraries(mixxx-lib PUBLIC Qt${QT_VERSION_MAJOR}::${component}) endforeach() if(QT_EXTRA_COMPONENTS) - foreach(COMPONENT ${QT_EXTRA_COMPONENTS}) - target_link_libraries(mixxx-lib PUBLIC Qt${QT_VERSION_MAJOR}::${COMPONENT}) + foreach(component ${QT_EXTRA_COMPONENTS}) + target_link_libraries(mixxx-lib PUBLIC Qt${QT_VERSION_MAJOR}::${component}) endforeach() endif() @@ -2718,12 +3188,18 @@ if(QML) set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/qml) qt_add_library(mixxx-qml-lib STATIC) - foreach(COMPONENT ${QT_COMPONENTS}) - target_link_libraries(mixxx-qml-lib PUBLIC Qt${QT_VERSION_MAJOR}::${COMPONENT}) + foreach(component ${QT_COMPONENTS}) + target_link_libraries( + mixxx-qml-lib + PUBLIC Qt${QT_VERSION_MAJOR}::${component} + ) endforeach() if(QT_EXTRA_COMPONENTS) - foreach(COMPONENT ${QT_EXTRA_COMPONENTS}) - target_link_libraries(mixxx-qml-lib PUBLIC Qt${QT_VERSION_MAJOR}::${COMPONENT}) + foreach(component ${QT_EXTRA_COMPONENTS}) + target_link_libraries( + mixxx-qml-lib + PUBLIC Qt${QT_VERSION_MAJOR}::${component} + ) endforeach() endif() set_target_properties(mixxx-qml-lib PROPERTIES AUTOMOC ON) @@ -2743,13 +3219,18 @@ if(QML) # See: https://bugreports.qt.io/browse/QTBUG-87221 target_include_directories(mixxx-qml-lib PRIVATE src/control src/qml) target_include_directories(mixxx-qml-lib PUBLIC src/ ${CMAKE_BINARY_DIR}/src) - target_include_directories(mixxx-qml-lib SYSTEM PUBLIC lib/rigtorp/SPSCQueue/include lib/portaudio) + target_include_directories( + mixxx-qml-lib + SYSTEM + PUBLIC lib/rigtorp/SPSCQueue/include lib/portaudio + ) target_link_libraries(mixxx-qml-lib PUBLIC mixxx-proto) target_link_libraries(mixxx-qml-libplugin PUBLIC mixxx-proto) - target_precompile_headers(mixxx-qml-lib PUBLIC - ${MIXXX_COMMON_PRECOMPILED_HEADER} + target_precompile_headers( + mixxx-qml-lib + PUBLIC ${MIXXX_COMMON_PRECOMPILED_HEADER} ) target_link_libraries(mixxx-qml-lib PRIVATE mixxx-qml-libplugin) @@ -2771,66 +3252,80 @@ if(QML) ) target_link_libraries(mixxx-qml-lib PRIVATE mixxx-qml-mixxxcontrolsplugin) - target_sources(mixxx-qml-lib PRIVATE - src/qml/asyncimageprovider.cpp - src/qml/qmlapplication.cpp - src/qml/qmlautoreload.cpp - src/qml/qmlbeatsmodel.cpp - src/qml/qmlcuesmodel.cpp - src/qml/qmlcontrolproxy.cpp - src/qml/qmlconfigproxy.cpp - src/qml/qmldlgpreferencesproxy.cpp - src/qml/qmleffectmanifestparametersmodel.cpp - src/qml/qmleffectsmanagerproxy.cpp - src/qml/qmleffectslotproxy.cpp - src/qml/qmllibraryproxy.cpp - src/qml/qmllibrarytracklistmodel.cpp - src/qml/qmlplayermanagerproxy.cpp - src/qml/qmlplayerproxy.cpp - src/qml/qmlvisibleeffectsmodel.cpp - src/qml/qmlchainpresetmodel.cpp - src/qml/qmlwaveformoverview.cpp - src/qml/qmlmixxxcontrollerscreen.cpp - # The following sources need to be in this target to get QML_ELEMENT properly interpreted - src/control/controlmodel.cpp - src/control/controlsortfiltermodel.cpp - # needed for qml/qmlautoreload.cpp - src/util/autofilereloader.cpp + target_sources( + mixxx-qml-lib + PRIVATE + src/qml/asyncimageprovider.cpp + src/qml/qmlapplication.cpp + src/qml/qmlautoreload.cpp + src/qml/qmlbeatsmodel.cpp + src/qml/qmlcuesmodel.cpp + src/qml/qmlcontrolproxy.cpp + src/qml/qmlconfigproxy.cpp + src/qml/qmldlgpreferencesproxy.cpp + src/qml/qmleffectmanifestparametersmodel.cpp + src/qml/qmleffectsmanagerproxy.cpp + src/qml/qmleffectslotproxy.cpp + src/qml/qmllibraryproxy.cpp + src/qml/qmllibrarytracklistmodel.cpp + src/qml/qmlplayermanagerproxy.cpp + src/qml/qmlplayerproxy.cpp + src/qml/qmlvisibleeffectsmodel.cpp + src/qml/qmlchainpresetmodel.cpp + src/qml/qmlwaveformoverview.cpp + src/qml/qmlmixxxcontrollerscreen.cpp + # The following sources need to be in this target to get QML_ELEMENT properly interpreted + src/control/controlmodel.cpp + src/control/controlsortfiltermodel.cpp + # needed for qml/qmlautoreload.cpp + src/util/autofilereloader.cpp ) # qt_finalize_target takes care that the resources :/mixxx.org/imports/Mixxx/ # and :/mixxx.org/imports/Mixxx/Controls are placed into beginning of the binary qt_finalize_target(mixxx) - install( - DIRECTORY - "${CMAKE_CURRENT_SOURCE_DIR}/res/qml" - DESTINATION - "${MIXXX_INSTALL_DATADIR}" + DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/res/qml" + DESTINATION "${MIXXX_INSTALL_DATADIR}" ) - endif() option(DEBUG_ASSERTIONS_FATAL "Fail if debug become true assertions" OFF) if(DEBUG_ASSERTIONS_FATAL) - target_compile_definitions(mixxx-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED) + target_compile_definitions( + mixxx-lib + PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED + ) if(QML) - target_compile_definitions(mixxx-qml-lib PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED) + target_compile_definitions( + mixxx-qml-lib + PUBLIC MIXXX_DEBUG_ASSERTIONS_FATAL MIXXX_DEBUG_ASSERTIONS_ENABLED + ) endif() - if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - message(STATUS "DEBUG_ASSERT statements have been enabled because DEBUG_ASSERTIONS_FATAL is ON.") + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + message( + STATUS + "DEBUG_ASSERT statements have been enabled because DEBUG_ASSERTIONS_FATAL is ON." + ) endif() endif() if(EMSCRIPTEN) - option(WASM_ASSERTIONS "Enable additional checks when targeting Emscripten/WebAssembly" OFF) + option( + WASM_ASSERTIONS + "Enable additional checks when targeting Emscripten/WebAssembly" + OFF + ) if(WASM_ASSERTIONS) target_link_options(mixxx-lib PUBLIC -sASSERTIONS) endif() endif() -target_compile_definitions(mixxx-lib PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER) +target_compile_definitions( + mixxx-lib + PUBLIC QT_TABLET_SUPPORT QT_USE_QSTRINGBUILDER +) is_static_library(Qt_IS_STATIC Qt${QT_VERSION_MAJOR}::Core) if(Qt_IS_STATIC) # NOTE(rryan): If you are adding a plugin here, you must also @@ -2840,45 +3335,54 @@ if(Qt_IS_STATIC) # to see exactly what's available as a standalone .lib vs linked # into Qt .libs by default. - target_link_libraries(mixxx-lib PRIVATE - # imageformats plugins - Qt${QT_VERSION_MAJOR}::QGifPlugin - Qt${QT_VERSION_MAJOR}::QICOPlugin - Qt${QT_VERSION_MAJOR}::QJpegPlugin - Qt${QT_VERSION_MAJOR}::QSvgPlugin - - # sqldrivers - Qt${QT_VERSION_MAJOR}::QSQLiteDriverPlugin + target_link_libraries( + mixxx-lib + PRIVATE + # imageformats plugins + Qt${QT_VERSION_MAJOR}::QGifPlugin + Qt${QT_VERSION_MAJOR}::QICOPlugin + Qt${QT_VERSION_MAJOR}::QJpegPlugin + Qt${QT_VERSION_MAJOR}::QSvgPlugin + # sqldrivers + Qt${QT_VERSION_MAJOR}::QSQLiteDriverPlugin ) if(EMSCRIPTEN) - target_link_libraries(mixxx-lib PRIVATE - Qt${QT_VERSION_MAJOR}::QWasmIntegrationPlugin + target_link_libraries( + mixxx-lib + PRIVATE Qt${QT_VERSION_MAJOR}::QWasmIntegrationPlugin ) else() - target_link_libraries(mixxx-lib PRIVATE - # platform plugins - Qt${QT_VERSION_MAJOR}::QOffscreenIntegrationPlugin - Qt${QT_VERSION_MAJOR}::QMinimalIntegrationPlugin + target_link_libraries( + mixxx-lib + PRIVATE + # platform plugins + Qt${QT_VERSION_MAJOR}::QOffscreenIntegrationPlugin + Qt${QT_VERSION_MAJOR}::QMinimalIntegrationPlugin ) endif() if(WIN32) - target_link_libraries(mixxx-lib PRIVATE - Qt${QT_VERSION_MAJOR}::QWindowsIntegrationPlugin - Qt${QT_VERSION_MAJOR}::QWindowsVistaStylePlugin + target_link_libraries( + mixxx-lib + PRIVATE + Qt${QT_VERSION_MAJOR}::QWindowsIntegrationPlugin + Qt${QT_VERSION_MAJOR}::QWindowsVistaStylePlugin ) endif() if(APPLE) if(IOS) - target_link_libraries(mixxx-lib PRIVATE - Qt${QT_VERSION_MAJOR}::QIOSIntegrationPlugin + target_link_libraries( + mixxx-lib + PRIVATE Qt${QT_VERSION_MAJOR}::QIOSIntegrationPlugin ) else() - target_link_libraries(mixxx-lib PRIVATE - Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin - Qt${QT_VERSION_MAJOR}::QMacStylePlugin + target_link_libraries( + mixxx-lib + PRIVATE + Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin + Qt${QT_VERSION_MAJOR}::QMacStylePlugin ) endif() endif() @@ -2887,144 +3391,229 @@ else() # Qt6 does not automatically install plugins like in Qt 5 find_package(libjpeg-turbo CONFIG REQUIRED) - install(IMPORTED_RUNTIME_ARTIFACTS - # QJpegPlugin dependency - libjpeg-turbo::jpeg - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - # platform plugins - Qt${QT_VERSION_MAJOR}::QOffscreenIntegrationPlugin - Qt${QT_VERSION_MAJOR}::QMinimalIntegrationPlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/platforms" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QGifPlugin - Qt${QT_VERSION_MAJOR}::QICOPlugin - Qt${QT_VERSION_MAJOR}::QJpegPlugin - Qt${QT_VERSION_MAJOR}::QSvgPlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/imageformats" - COMPONENT applocal) + install( + IMPORTED_RUNTIME_ARTIFACTS + # QJpegPlugin dependency + libjpeg-turbo::jpeg + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QSQLiteDriverPlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/sqldrivers" - COMPONENT applocal) + install( + IMPORTED_RUNTIME_ARTIFACTS + # platform plugins + Qt${QT_VERSION_MAJOR}::QOffscreenIntegrationPlugin + Qt${QT_VERSION_MAJOR}::QMinimalIntegrationPlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/platforms" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QGifPlugin + Qt${QT_VERSION_MAJOR}::QICOPlugin + Qt${QT_VERSION_MAJOR}::QJpegPlugin + Qt${QT_VERSION_MAJOR}::QSvgPlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/imageformats" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QSQLiteDriverPlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/sqldrivers" + COMPONENT + applocal + ) if(QML) - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::LabsQmlModels - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QuickControls2 - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QuickControls2Impl - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QuickLayouts - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QuickShapesPrivate - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QuickTemplates2 - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::QmlWorkerScript - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) - - install(IMPORTED_RUNTIME_ARTIFACTS - Qt${QT_VERSION_MAJOR}::ShaderTools - DESTINATION "${MIXXX_INSTALL_DATADIR}" - COMPONENT applocal) + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::LabsQmlModels + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QuickControls2 + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QuickControls2Impl + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QuickLayouts + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QuickShapesPrivate + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QuickTemplates2 + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QmlWorkerScript + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) + + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::ShaderTools + DESTINATION + "${MIXXX_INSTALL_DATADIR}" + COMPONENT + applocal + ) #install qml6-module-qt5compat-graphicaleffects install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/Qt5Compat/GraphicalEffects" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/Qt5Compat/GraphicalEffects" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/Qt5Compat" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qtqml-workerscript install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQml/WorkerScript" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQml/WorkerScript" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQml" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qtquick-controls install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Controls" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Controls" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQuick" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qtquick-layouts install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Layouts" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Layouts" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQuick" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qtquick-nativestyle install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/NativeStyle" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/NativeStyle" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQuick" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qtquick-shapes install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Shapes" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Shapes" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQuick" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qtquick-templates install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Templates" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Templates" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQuick" - COMPONENT applocal) + COMPONENT applocal + ) # qml6-module-qtquick-window install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Window" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/QtQuick/Window" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/QtQuick" - COMPONENT applocal) + COMPONENT applocal + ) # install qml6-module-qt-labs-qmlmodels install( - DIRECTORY "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/Qt/labs/qmlmodels" + DIRECTORY + "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}$<$:/debug>/Qt6/qml/Qt/labs/qmlmodels" DESTINATION "${MIXXX_INSTALL_DATADIR}/Qt6/qml/Qt/labs" - COMPONENT applocal) - + COMPONENT applocal + ) endif() if(WIN32) - install(IMPORTED_RUNTIME_ARTIFACTS Qt${QT_VERSION_MAJOR}::QWindowsIntegrationPlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/platforms" - COMPONENT applocal) - install(IMPORTED_RUNTIME_ARTIFACTS Qt${QT_VERSION_MAJOR}::QWindowsVistaStylePlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/styles" - COMPONENT applocal) + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QWindowsIntegrationPlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/platforms" + COMPONENT + applocal + ) + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QWindowsVistaStylePlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/styles" + COMPONENT + applocal + ) endif() if(APPLE) - install(IMPORTED_RUNTIME_ARTIFACTS Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/platforms" - COMPONENT applocal) - install(IMPORTED_RUNTIME_ARTIFACTS Qt${QT_VERSION_MAJOR}::QMacStylePlugin - DESTINATION "${MIXXX_INSTALL_DATADIR}/styles" - COMPONENT applocal) + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QCocoaIntegrationPlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/platforms" + COMPONENT + applocal + ) + install( + IMPORTED_RUNTIME_ARTIFACTS + Qt${QT_VERSION_MAJOR}::QMacStylePlugin + DESTINATION + "${MIXXX_INSTALL_DATADIR}/styles" + COMPONENT + applocal + ) endif() set(APPLOCAL_COMPONENT_DEFINED true) @@ -3033,7 +3622,9 @@ endif() if(APPLE) if(Qt_IS_STATIC OR QT6) - target_link_libraries(mixxx-lib PRIVATE + target_link_libraries( + mixxx-lib + PRIVATE "-weak_framework Accelerate" "-weak_framework AudioToolbox" "-weak_framework AVFoundation" @@ -3048,20 +3639,16 @@ if(APPLE) "-weak_framework VideoToolbox" ) if(IOS) - target_link_libraries(mixxx-lib PRIVATE - "-weak_framework UIKit" - ) + target_link_libraries(mixxx-lib PRIVATE "-weak_framework UIKit") elseif() - target_link_libraries(mixxx-lib PRIVATE - "-weak_framework AppKit" - "-weak_framework AudioUnit" + target_link_libraries( + mixxx-lib + PRIVATE "-weak_framework AppKit" "-weak_framework AudioUnit" ) endif() else() # Used for battery measurements and controlling the screensaver on macOS. - target_link_libraries(mixxx-lib PRIVATE - "-weak_framework IOKit" - ) + target_link_libraries(mixxx-lib PRIVATE "-weak_framework IOKit") endif() elseif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) if(QT6) @@ -3076,51 +3663,64 @@ elseif(UNIX AND NOT APPLE AND NOT EMSCRIPTEN) target_link_libraries(mixxx-lib PRIVATE "${X11_LIBRARIES}") endif() find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) - target_link_libraries(mixxx-lib PUBLIC - Qt${QT_VERSION_MAJOR}::DBus - ) + target_link_libraries(mixxx-lib PUBLIC Qt${QT_VERSION_MAJOR}::DBus) elseif(WIN32) if(Qt_IS_STATIC) - target_link_libraries(mixxx-lib PRIVATE - # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf - # QtCore - kernel32 - user32 # QtGui, QtOpenGL, libHSS1394 - shell32 - uuid - ole32 # QtGui, - advapi32 # QtGui, portaudio, portmidi - ws2_32 # QtGui, QtNetwork, libshout - # QtGui - gdi32 # QtOpenGL, libshout - comdlg32 - oleaut32 - imm32 - winmm - winspool - # QtOpenGL - glu32 - opengl32 - - # QtNetwork openssl-linked - crypt32 - - dwmapi # qtwindows - iphlpapi # qt5network - mpr # qt5core - netapi32 # qt5core - userenv # qt5core - uxtheme # ? - version # ? - wtsapi32 # ? - ) - - find_library(QTFONTDATABASESUPPORT_LIBRARY Qt${QT_VERSION_MAJOR}FontDatabaseSupport) + target_link_libraries( + mixxx-lib + PRIVATE + # Pulled from qt-4.8.2-source\mkspecs\win32-msvc2010\qmake.conf + # QtCore + kernel32 + user32 # QtGui, QtOpenGL, libHSS1394 + shell32 + uuid + ole32 # QtGui, + advapi32 # QtGui, portaudio, portmidi + ws2_32 # QtGui, QtNetwork, libshout + # QtGui + gdi32 # QtOpenGL, libshout + comdlg32 + oleaut32 + imm32 + winmm + winspool + # QtOpenGL + glu32 + opengl32 + # QtNetwork openssl-linked + crypt32 + dwmapi # qtwindows + iphlpapi # qt5network + mpr # qt5core + netapi32 # qt5core + userenv # qt5core + uxtheme # ? + version # ? + wtsapi32 # ? + ) + + find_library( + QTFONTDATABASESUPPORT_LIBRARY + Qt${QT_VERSION_MAJOR}FontDatabaseSupport + ) target_link_libraries(mixxx-lib PRIVATE "${QTFONTDATABASESUPPORT_LIBRARY}") - find_library(QTWINDOWSUIAUTOMATIONSUPPORT_LIBRARY Qt${QT_VERSION_MAJOR}WindowsUIAutomationSupport) - target_link_libraries(mixxx-lib PRIVATE "${QTWINDOWSUIAUTOMATIONSUPPORT_LIBRARY}") - find_library(QTEVENTDISPATCHERSUPPORT_LIBRARY Qt${QT_VERSION_MAJOR}EventDispatcherSupport) - target_link_libraries(mixxx-lib PRIVATE "${QTEVENTDISPATCHERSUPPORT_LIBRARY}") + find_library( + QTWINDOWSUIAUTOMATIONSUPPORT_LIBRARY + Qt${QT_VERSION_MAJOR}WindowsUIAutomationSupport + ) + target_link_libraries( + mixxx-lib + PRIVATE "${QTWINDOWSUIAUTOMATIONSUPPORT_LIBRARY}" + ) + find_library( + QTEVENTDISPATCHERSUPPORT_LIBRARY + Qt${QT_VERSION_MAJOR}EventDispatcherSupport + ) + target_link_libraries( + mixxx-lib + PRIVATE "${QTEVENTDISPATCHERSUPPORT_LIBRARY}" + ) find_library(QTTHEMESUPPORT_LIBRARY Qt${QT_VERSION_MAJOR}ThemeSupport) target_link_libraries(mixxx-lib PRIVATE "${QTTHEMESUPPORT_LIBRARY}") @@ -3134,9 +3734,11 @@ elseif(WIN32) target_link_libraries(mixxx-lib PRIVATE "${QTPCRE2_LIBRARY}") else() #libshout is always built statically - target_link_libraries(mixxx-lib PRIVATE - ws2_32 # libshout - gdi32 # libshout + target_link_libraries( + mixxx-lib + PRIVATE + ws2_32 # libshout + gdi32 # libshout ) endif() endif() @@ -3145,9 +3747,23 @@ if(APPLE OR WIN32) # qt_de.qm is just one arbitrary file in the directory that needs to be located; # there is no particular reason to look for this file versus any other one in the directory. if(QT6) - find_file(QT_TRANSLATION_FILE qt_de.qm PATHS "${Qt6_DIR}/../../translations/Qt6" REQUIRED NO_DEFAULT_PATH) + find_file( + QT_TRANSLATION_FILE + qt_de.qm + PATHS "${Qt6_DIR}/../../translations/Qt6" + REQUIRED + NO_DEFAULT_PATH + ) else() - find_file(QT_TRANSLATION_FILE qt_de.qm PATHS "${Qt5_DIR}/../../../translations" "${Qt5_DIR}/../../qt5/translations" REQUIRED NO_DEFAULT_PATH) + find_file( + QT_TRANSLATION_FILE + qt_de.qm + PATHS + "${Qt5_DIR}/../../../translations" + "${Qt5_DIR}/../../qt5/translations" + REQUIRED + NO_DEFAULT_PATH + ) endif() get_filename_component(QT_TRANSLATIONS ${QT_TRANSLATION_FILE} DIRECTORY) install( @@ -3155,21 +3771,31 @@ if(APPLE OR WIN32) DESTINATION "${MIXXX_INSTALL_DATADIR}/translations" # QT 5 translations have been separated into several files, and most of the qt_xx.qm files # contain just shortcuts to load the qtbase, qtmultimedia etc files. - FILES_MATCHING REGEX - "qt_.+\.qm|qtbase_.*\.qm|qtmultimedia_.*\.qm|qtscript_.*\.qm|qtxmlpatterns_.*\.qm" + FILES_MATCHING + REGEX + "qt_.+\.qm|qtbase_.*\.qm|qtmultimedia_.*\.qm|qtscript_.*\.qm|qtxmlpatterns_.*\.qm" ) endif() -add_library(mixxx-gitinfostore STATIC EXCLUDE_FROM_ALL - src/util/gitinfostore.cpp +add_library( + mixxx-gitinfostore + STATIC + EXCLUDE_FROM_ALL + src/util/gitinfostore.cpp ) # QtCore for QString target_link_libraries(mixxx-gitinfostore PUBLIC Qt${QT_VERSION_MAJOR}::Core) -target_include_directories(mixxx-gitinfostore PUBLIC src ${CMAKE_BINARY_DIR}/src) +target_include_directories( + mixxx-gitinfostore + PUBLIC src ${CMAKE_BINARY_DIR}/src +) add_dependencies(mixxx-gitinfostore mixxx-gitinfo) # Queen Mary DSP -add_library(QueenMaryDsp STATIC EXCLUDE_FROM_ALL +add_library( + QueenMaryDsp + STATIC + EXCLUDE_FROM_ALL # lib/qm-dsp/base/KaiserWindow.cpp lib/qm-dsp/base/Pitch.cpp # lib/qm-dsp/base/SincWindow.cpp @@ -3205,7 +3831,8 @@ add_library(QueenMaryDsp STATIC EXCLUDE_FROM_ALL # lib/qm-dsp/hmm/hmm.c lib/qm-dsp/maths/Correlation.cpp # lib/qm-dsp/maths/CosineDistance.cpp - lib/qm-dsp/maths/KLDivergence.cpp lib/qm-dsp/maths/MathUtilities.cpp + lib/qm-dsp/maths/KLDivergence.cpp + lib/qm-dsp/maths/MathUtilities.cpp # lib/qm-dsp/maths/pca/pca.c # lib/qm-dsp/thread/Thread.cpp ) @@ -3220,13 +3847,15 @@ elseif(MSVC) # may include cmath first. target_compile_definitions(QueenMaryDsp PRIVATE _USE_MATH_DEFINES) endif() -target_include_directories(QueenMaryDsp SYSTEM PUBLIC lib/qm-dsp lib/qm-dsp/include) +target_include_directories( + QueenMaryDsp + SYSTEM + PUBLIC lib/qm-dsp lib/qm-dsp/include +) target_link_libraries(mixxx-lib PRIVATE QueenMaryDsp) # ReplayGain -add_library(ReplayGain STATIC EXCLUDE_FROM_ALL - lib/replaygain/replaygain.cpp -) +add_library(ReplayGain STATIC EXCLUDE_FROM_ALL lib/replaygain/replaygain.cpp) target_include_directories(mixxx-lib SYSTEM PRIVATE lib/replaygain) target_link_libraries(mixxx-lib PRIVATE ReplayGain) @@ -3246,12 +3875,14 @@ if(RUBBERBAND) find_package(rubberband REQUIRED) target_link_libraries(mixxx-lib PRIVATE rubberband::rubberband) target_compile_definitions(mixxx-lib PUBLIC __RUBBERBAND__) - target_sources(mixxx-lib PRIVATE - src/effects/backends/builtin/pitchshifteffect.cpp - src/engine/bufferscalers/enginebufferscalerubberband.cpp - src/engine/bufferscalers/rubberbandwrapper.cpp - src/engine/bufferscalers/rubberbandtask.cpp - src/engine/bufferscalers/rubberbandworkerpool.cpp + target_sources( + mixxx-lib + PRIVATE + src/effects/backends/builtin/pitchshifteffect.cpp + src/engine/bufferscalers/enginebufferscalerubberband.cpp + src/engine/bufferscalers/rubberbandwrapper.cpp + src/engine/bufferscalers/rubberbandtask.cpp + src/engine/bufferscalers/rubberbandworkerpool.cpp ) endif() @@ -3260,7 +3891,10 @@ find_package(SndFile REQUIRED) target_link_libraries(mixxx-lib PRIVATE SndFile::sndfile) target_compile_definitions(mixxx-lib PUBLIC __SNDFILE__) if(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL) - target_compile_definitions(mixxx-lib PUBLIC SFC_SUPPORTS_SET_COMPRESSION_LEVEL) + target_compile_definitions( + mixxx-lib + PUBLIC SFC_SUPPORTS_SET_COMPRESSION_LEVEL + ) endif() # SoundTouch @@ -3269,11 +3903,14 @@ target_link_libraries(mixxx-lib PRIVATE SoundTouch::SoundTouch) # TagLib find_package(TagLib 1.11 REQUIRED) -if (NOT TagLib_VERSION VERSION_LESS 2.0.0) - message(WARNING "Installed Taglib ${TagLib_VERSION} is not supported and might lead to data loss (https://github.com/mixxxdj/mixxx/issues/12708). Use version >= 1.11 and < 2.0 instead.") +if(NOT TagLib_VERSION VERSION_LESS 2.0.0) + message( + WARNING + "Installed Taglib ${TagLib_VERSION} is not supported and might lead to data loss (https://github.com/mixxxdj/mixxx/issues/12708). Use version >= 1.11 and < 2.0 instead." + ) endif() target_link_libraries(mixxx-lib PUBLIC TagLib::TagLib) -if (QML) +if(QML) target_link_libraries(mixxx-qml-lib PUBLIC TagLib::TagLib) endif() @@ -3290,7 +3927,13 @@ target_link_libraries(mixxx-lib PRIVATE Threads::Threads) # # The battery meter is only available on Linux, macOS and Windows, therefore # this option is forcibly set to OFF on all other platforms. -cmake_dependent_option(BATTERY "Battery meter support" ON "WIN32 OR UNIX" OFF) +cmake_dependent_option( + BATTERY + "Battery meter support" + ON + "WIN32 OR UNIX" + OFF +) if(BATTERY) if(WIN32) target_sources(mixxx-lib PRIVATE src/util/battery/batterywindows.cpp) @@ -3302,20 +3945,28 @@ if(BATTERY) endif() elseif(UNIX) if(EMSCRIPTEN) - message(FATAL_ERROR "Battery support is not implemented for Emscripten (WebAssembly)") + message( + FATAL_ERROR + "Battery support is not implemented for Emscripten (WebAssembly)" + ) endif() find_package(Upower REQUIRED) find_package(GLIB COMPONENTS gobject REQUIRED) target_include_directories(mixxx-lib SYSTEM PUBLIC ${GLIB_INCLUDE_DIRS}) - target_link_libraries(mixxx-lib PRIVATE Upower::Upower ${GLIB_LIBRARIES} ${GLIB_GOBJECT_LIBRARIES}) + target_link_libraries( + mixxx-lib + PRIVATE Upower::Upower ${GLIB_LIBRARIES} ${GLIB_GOBJECT_LIBRARIES} + ) target_sources(mixxx-lib PRIVATE src/util/battery/batterylinux.cpp) else() - message(FATAL_ERROR "Battery support is not implemented for the target platform.") + message( + FATAL_ERROR + "Battery support is not implemented for the target platform." + ) endif() target_compile_definitions(mixxx-lib PUBLIC __BATTERY__) endif() - # Build Time option(BUILDTIME "Use __DATE__ and __TIME__" ON) if(NOT BUILDTIME) @@ -3332,7 +3983,10 @@ endif() option(CLANG_COLORDIAG "Clang color diagnostics" OFF) if(CLANG_COLORDIAG) if(NOT LLVM_CLANG) - message(FATAL_ERROR "Color Diagnostics are only available when using Clang.") + message( + FATAL_ERROR + "Color Diagnostics are only available when using Clang." + ) endif() target_compile_options(mixxx-lib PUBLIC -fcolor-diagnostics) endif() @@ -3364,12 +4018,20 @@ endif() # # The CoreAudio API is only available on macOS, therefore this option is # forcibly set to OFF on all other platforms. -cmake_dependent_option(COREAUDIO "CoreAudio MP3/AAC Decoder" ON "APPLE" OFF) +cmake_dependent_option( + COREAUDIO + "CoreAudio MP3/AAC Decoder" + ON + "APPLE" + OFF +) if(COREAUDIO) - target_sources(mixxx-lib PRIVATE - src/sources/soundsourcecoreaudio.cpp - src/sources/v1/legacyaudiosourceadapter.cpp - lib/apple/CAStreamBasicDescription.cpp + target_sources( + mixxx-lib + PRIVATE + src/sources/soundsourcecoreaudio.cpp + src/sources/v1/legacyaudiosourceadapter.cpp + lib/apple/CAStreamBasicDescription.cpp ) set_property( SOURCE lib/apple/CAStreamBasicDescription.cpp @@ -3380,7 +4042,6 @@ if(COREAUDIO) target_include_directories(mixxx-lib SYSTEM PUBLIC lib/apple) endif() - # FAAD AAC audio file decoder plugin find_package(MP4) find_package(MP4v2) @@ -3389,11 +4050,14 @@ find_package(MP4v2) default_option(FAAD "FAAD AAC audio file decoder support" "UNIX;NOT APPLE;MP4_FOUND OR MP4v2_FOUND") if(FAAD) if(NOT MP4_FOUND AND NOT MP4v2_FOUND) - message(FATAL_ERROR "FAAD AAC audio support requires libmp4 or libmp4v2 with development headers.") + message( + FATAL_ERROR + "FAAD AAC audio support requires libmp4 or libmp4v2 with development headers." + ) endif() - target_sources(mixxx-lib PRIVATE - src/sources/soundsourcem4a.cpp - src/sources/libfaadloader.cpp + target_sources( + mixxx-lib + PRIVATE src/sources/soundsourcem4a.cpp src/sources/libfaadloader.cpp ) target_compile_definitions(mixxx-lib PUBLIC __FAAD__) if(MP4v2_FOUND) @@ -3410,8 +4074,15 @@ if(APPLE AND MACOS_BUNDLE) find_library(FDK_AAC_LIBRARY fdk-aac) if(FDK_AAC_LIBRARY) message(STATUS "Found fdk-aac: ${FDK_AAC_LIBRARY}") - file(COPY ${FDK_AAC_LIBRARY} DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/lib/fdk-aac-install" FOLLOW_SYMLINK_CHAIN) - install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/fdk-aac-install/" DESTINATION "${MIXXX_INSTALL_PREFIX}/Contents/Frameworks") + file( + COPY ${FDK_AAC_LIBRARY} + DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/lib/fdk-aac-install" + FOLLOW_SYMLINK_CHAIN + ) + install( + DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/lib/fdk-aac-install/" + DESTINATION "${MIXXX_INSTALL_PREFIX}/Contents/Frameworks" + ) else() message(STATUS "Could NOT find libfdk-aac.dylib") endif() @@ -3439,26 +4110,52 @@ if(FFMPEG) # Minimum library versions according to # Windows: Version numbers are not available!? # macOS: Untested - if(FFMPEG_libavcodec_VERSION AND FFMPEG_libavcodec_VERSION VERSION_LESS 58.35.100) - message(FATAL_ERROR "FFmpeg support requires at least version 58.35.100 of libavcodec (found: ${FFMPEG_libavcodec_VERSION}).") + if( + FFMPEG_libavcodec_VERSION + AND FFMPEG_libavcodec_VERSION VERSION_LESS 58.35.100 + ) + message( + FATAL_ERROR + "FFmpeg support requires at least version 58.35.100 of libavcodec (found: ${FFMPEG_libavcodec_VERSION})." + ) endif() - if(FFMPEG_libavformat_VERSION AND FFMPEG_libavformat_VERSION VERSION_LESS 58.20.100) - message(FATAL_ERROR "FFmpeg support requires at least version 58.20.100 of libavformat (found: ${FFMPEG_libavformat_VERSION}).") + if( + FFMPEG_libavformat_VERSION + AND FFMPEG_libavformat_VERSION VERSION_LESS 58.20.100 + ) + message( + FATAL_ERROR + "FFmpeg support requires at least version 58.20.100 of libavformat (found: ${FFMPEG_libavformat_VERSION})." + ) endif() - if(FFMPEG_libavutil_VERSION AND FFMPEG_libavutil_VERSION VERSION_LESS 56.22.100) - message(FATAL_ERROR "FFmpeg support requires at least version 56.22.100 of libavutil (found: ${FFMPEG_libavutil_VERSION}).") + if( + FFMPEG_libavutil_VERSION + AND FFMPEG_libavutil_VERSION VERSION_LESS 56.22.100 + ) + message( + FATAL_ERROR + "FFmpeg support requires at least version 56.22.100 of libavutil (found: ${FFMPEG_libavutil_VERSION})." + ) endif() - if(FFMPEG_libswresample_VERSION AND FFMPEG_libswresample_VERSION VERSION_LESS 3.3.100) - message(FATAL_ERROR "FFmpeg support requires at least version 3.3.100 of libswresample (found: ${FFMPEG_libswresample_VERSION}).") + if( + FFMPEG_libswresample_VERSION + AND FFMPEG_libswresample_VERSION VERSION_LESS 3.3.100 + ) + message( + FATAL_ERROR + "FFmpeg support requires at least version 3.3.100 of libswresample (found: ${FFMPEG_libswresample_VERSION})." + ) endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourceffmpeg.cpp) - target_compile_definitions(mixxx-lib PUBLIC - __FFMPEG__ - # Needed to build new FFmpeg - __STDC_CONSTANT_MACROS - __STDC_LIMIT_MACROS - __STDC_FORMAT_MACROS + target_compile_definitions( + mixxx-lib + PUBLIC + __FFMPEG__ + # Needed to build new FFmpeg + __STDC_CONSTANT_MACROS + __STDC_LIMIT_MACROS + __STDC_FORMAT_MACROS ) target_link_libraries(mixxx-lib PRIVATE "${FFMPEG_LIBRARIES}") target_include_directories(mixxx-lib PUBLIC "${FFMPEG_INCLUDE_DIRS}") @@ -3466,35 +4163,38 @@ endif() # STEM file support default_option(STEM "STEM file support" "FFMPEG_FOUND;FFMPEG") -if (STEM) +if(STEM) if(NOT FFMPEG) message(FATAL_ERROR "STEM requires that also FFMPEG is enabled") endif() target_compile_definitions(mixxx-lib PUBLIC __STEM__) target_compile_definitions(mixxx-test PUBLIC __STEM__) - target_sources(mixxx-test PUBLIC - src/test/stemtest.cpp - src/test/steminfotest.cpp - src/test/stemcontrolobjecttest.cpp + target_sources( + mixxx-test + PUBLIC + src/test/stemtest.cpp + src/test/steminfotest.cpp + src/test/stemcontrolobjecttest.cpp ) list(APPEND MIXXX_LIB_PRECOMPILED_HEADER src/track/steminfo.h) - target_sources(mixxx-lib PRIVATE - src/sources/soundsourcestem.cpp - src/track/steminfoimporter.cpp - src/track/steminfo.cpp - src/widget/wtrackstemmenu.cpp - src/widget/wstemlabel.cpp + target_sources( + mixxx-lib + PRIVATE + src/sources/soundsourcestem.cpp + src/track/steminfoimporter.cpp + src/track/steminfo.cpp + src/widget/wtrackstemmenu.cpp + src/widget/wstemlabel.cpp ) if(QOPENGL) - target_sources(mixxx-lib PRIVATE - src/waveform/renderers/allshader/waveformrendererstem.cpp + target_sources( + mixxx-lib + PRIVATE src/waveform/renderers/allshader/waveformrendererstem.cpp ) endif() if(QML) target_compile_definitions(mixxx-qml-lib PUBLIC __STEM__) - target_sources(mixxx-qml-lib PRIVATE - src/qml/qmlstemsmodel.cpp - ) + target_sources(mixxx-qml-lib PRIVATE src/qml/qmlstemsmodel.cpp) endif() endif() @@ -3508,15 +4208,19 @@ gtest_add_tests( WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" TEST_LIST testsuite ) -if (NOT WIN32) +if(NOT WIN32) # Default to offscreen rendering during tests. # This is required if the build system like Fedora koji/mock does not # allow to pass environment variables into the ctest macro expansion. - set_tests_properties(${testsuite} PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=offscreen") + set_tests_properties( + ${testsuite} + PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=offscreen" + ) endif() # Benchmarking -add_custom_target(mixxx-benchmark +add_custom_target( + mixxx-benchmark COMMAND $ --benchmark WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" COMMENT "Mixxx Benchmarks" @@ -3546,15 +4250,26 @@ if(WIN32 OR APPLE) else() set(HSS1394 OFF) endif() -cmake_dependent_option(HSS1394 "HSS1394 MIDI device support" "${HSS1394_FOUND}" "WIN32 OR APPLE" OFF) +cmake_dependent_option( + HSS1394 + "HSS1394 MIDI device support" + "${HSS1394_FOUND}" + "WIN32 OR APPLE" + OFF +) if(HSS1394) - target_sources(mixxx-lib PRIVATE - src/controllers/midi/hss1394controller.cpp - src/controllers/midi/hss1394enumerator.cpp + target_sources( + mixxx-lib + PRIVATE + src/controllers/midi/hss1394controller.cpp + src/controllers/midi/hss1394enumerator.cpp ) target_compile_definitions(mixxx-lib PUBLIC __HSS1394__) if(NOT HSS1394_FOUND) - message(FATAL_ERROR "HSS1394 MIDI device support requires the libhss1394 and its development headers.") + message( + FATAL_ERROR + "HSS1394 MIDI device support requires the libhss1394 and its development headers." + ) endif() target_link_libraries(mixxx-lib PRIVATE HSS1394::HSS1394) endif() @@ -3564,12 +4279,17 @@ find_package(lilv) default_option(LILV "Lilv (LV2) support" "lilv_FOUND") if(LILV) if(NOT lilv_FOUND) - message(FATAL_ERROR "Lilv (LV2) support requires the liblilv-0 and LV2 libraries and development headers.") + message( + FATAL_ERROR + "Lilv (LV2) support requires the liblilv-0 and LV2 libraries and development headers." + ) endif() - target_sources(mixxx-lib PRIVATE - src/effects/backends/lv2/lv2backend.cpp - src/effects/backends/lv2/lv2effectprocessor.cpp - src/effects/backends/lv2/lv2manifest.cpp + target_sources( + mixxx-lib + PRIVATE + src/effects/backends/lv2/lv2backend.cpp + src/effects/backends/lv2/lv2effectprocessor.cpp + src/effects/backends/lv2/lv2manifest.cpp ) target_compile_definitions(mixxx-lib PUBLIC __LILV__) target_link_libraries(mixxx-lib PRIVATE lilv::lilv) @@ -3577,42 +4297,63 @@ if(LILV) endif() # Live Broadcasting (Shoutcast) -cmake_dependent_option(BROADCAST "Live Broadcasting (Shoutcast) support" ON "NOT IOS" OFF) +cmake_dependent_option( + BROADCAST + "Live Broadcasting (Shoutcast) support" + ON + "NOT IOS" + OFF +) if(BROADCAST) find_package(Shoutidjc) # Check if system lib is at least 2.4.6 and not suffering bugs # https://github.com/mixxxdj/mixxx/issues/9681 # https://github.com/mixxxdj/mixxx/issues/10305 if(Shoutidjc_FOUND AND Shoutidjc_VERSION VERSION_LESS 2.4.4) - message(STATUS "Installed libshout-idjc version: ${Shoutidjc_VERSION} is suffering from issue #9681") + message( + STATUS + "Installed libshout-idjc version: ${Shoutidjc_VERSION} is suffering from issue #9681" + ) elseif(Shoutidjc_FOUND AND Shoutidjc_VERSION VERSION_LESS 2.4.6) - message(STATUS "Installed libshout version: ${Shout_VERSION} is suffering from issue #10305") + message( + STATUS + "Installed libshout version: ${Shout_VERSION} is suffering from issue #10305" + ) endif() if(NOT Shoutidjc_FOUND OR Shoutidjc_VERSION VERSION_LESS 2.4.6) # Fall back to internal library in the lib tree message(STATUS "Using internal libshout-idjc") add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/lib/libshout-idjc") - target_include_directories(mixxx-lib SYSTEM PUBLIC lib/libshout-idjc/include) + target_include_directories( + mixxx-lib + SYSTEM + PUBLIC lib/libshout-idjc/include + ) if(WIN32) - target_compile_definitions(shout_mixxx PRIVATE __WINDOWS__ _CRT_NONSTDC_NO_WARNINGS) + target_compile_definitions( + shout_mixxx + PRIVATE __WINDOWS__ _CRT_NONSTDC_NO_WARNINGS + ) endif() target_link_libraries(mixxx-lib PRIVATE shout_mixxx) else() target_link_libraries(mixxx-lib PRIVATE Shoutidjc::Shoutidjc) endif() - target_sources(mixxx-lib PRIVATE - src/preferences/dialog/dlgprefbroadcastdlg.ui - src/preferences/dialog/dlgprefbroadcast.cpp - src/broadcast/broadcastmanager.cpp - src/engine/sidechain/shoutconnection.cpp - src/preferences/broadcastprofile.cpp - src/preferences/broadcastsettings.cpp - src/preferences/broadcastsettings_legacy.cpp - src/preferences/broadcastsettingsmodel.cpp - src/encoder/encoderbroadcastsettings.cpp + target_sources( + mixxx-lib + PRIVATE + src/preferences/dialog/dlgprefbroadcastdlg.ui + src/preferences/dialog/dlgprefbroadcast.cpp + src/broadcast/broadcastmanager.cpp + src/engine/sidechain/shoutconnection.cpp + src/preferences/broadcastprofile.cpp + src/preferences/broadcastsettings.cpp + src/preferences/broadcastsettings_legacy.cpp + src/preferences/broadcastsettingsmodel.cpp + src/encoder/encoderbroadcastsettings.cpp ) target_compile_definitions(mixxx-lib PUBLIC __BROADCAST__) - if (QML) + if(QML) target_compile_definitions(mixxx-qml-lib PUBLIC __BROADCAST__) endif() endif() @@ -3623,12 +4364,17 @@ find_package(Opus) default_option(OPUS "Opus (RFC 6716) support" "OpusFile_FOUND") if(OPUS) if(NOT OpusFile_FOUND OR NOT Opus_FOUND) - message(FATAL_ERROR "Opus support requires libopus and libopusfile with development headers.") + message( + FATAL_ERROR + "Opus support requires libopus and libopusfile with development headers." + ) endif() - target_sources(mixxx-lib PRIVATE - src/sources/soundsourceopus.cpp - src/encoder/encoderopus.cpp - src/encoder/encoderopussettings.cpp + target_sources( + mixxx-lib + PRIVATE + src/sources/soundsourceopus.cpp + src/encoder/encoderopus.cpp + src/encoder/encoderopussettings.cpp ) target_compile_definitions(mixxx-lib PUBLIC __OPUS__) target_link_libraries(mixxx-lib PRIVATE OpusFile::OpusFile Opus::Opus) @@ -3641,10 +4387,16 @@ find_package(ID3Tag) default_option(MAD "MAD MP3 Decoder" "MAD_FOUND;ID3Tag_FOUND") if(MAD) if(NOT MAD_FOUND) - message(FATAL_ERROR "MAD support requires libmad and its development headers.") + message( + FATAL_ERROR + "MAD support requires libmad and its development headers." + ) endif() if(NOT ID3Tag_FOUND) - message(FATAL_ERROR "ID3Tag support requires libid3tag and its development headers.") + message( + FATAL_ERROR + "ID3Tag support requires libid3tag and its development headers." + ) endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourcemp3.cpp) target_compile_definitions(mixxx-lib PUBLIC __MAD__) @@ -3655,19 +4407,25 @@ endif() # # The Media Foundtation API is only available on Windows, therefore this option # is forcibly set to OFF on all other platforms. -cmake_dependent_option(MEDIAFOUNDATION "Media Foundation AAC decoder plugin" ON "WIN32" OFF) +cmake_dependent_option( + MEDIAFOUNDATION + "Media Foundation AAC decoder plugin" + ON + "WIN32" + OFF +) if(MEDIAFOUNDATION) find_package(MediaFoundation REQUIRED) - target_sources(mixxx-lib PRIVATE - src/sources/soundsourcemediafoundation.cpp - ) + target_sources(mixxx-lib PRIVATE src/sources/soundsourcemediafoundation.cpp) target_compile_definitions(mixxx-lib PUBLIC __MEDIAFOUNDATION__) - target_include_directories(mixxx-lib SYSTEM PRIVATE - ${MediaFoundation_INCLUDE_DIRS} + target_include_directories( + mixxx-lib + SYSTEM + PRIVATE ${MediaFoundation_INCLUDE_DIRS} ) - target_link_libraries(mixxx-lib PRIVATE - ${MediaFoundation_LIBRARIES} - Version.lib + target_link_libraries( + mixxx-lib + PRIVATE ${MediaFoundation_LIBRARIES} Version.lib ) endif() @@ -3676,12 +4434,17 @@ find_package(Modplug) default_option(MODPLUG "Modplug module decoder support" "Modplug_FOUND") if(MODPLUG) if(NOT Modplug_FOUND) - message(FATAL_ERROR "Modplug module decoder support requires libmodplug and its development headers.") + message( + FATAL_ERROR + "Modplug module decoder support requires libmodplug and its development headers." + ) endif() - target_sources(mixxx-lib PRIVATE - src/preferences/dialog/dlgprefmodplugdlg.ui - src/sources/soundsourcemodplug.cpp - src/preferences/dialog/dlgprefmodplug.cpp + target_sources( + mixxx-lib + PRIVATE + src/preferences/dialog/dlgprefmodplugdlg.ui + src/sources/soundsourcemodplug.cpp + src/preferences/dialog/dlgprefmodplug.cpp ) target_compile_definitions(mixxx-lib PUBLIC __MODPLUG__) target_link_libraries(mixxx-lib PRIVATE Modplug::Modplug) @@ -3690,7 +4453,7 @@ endif() find_package(Microsoft.GSL CONFIG) if(Microsoft.GSL_FOUND) target_link_libraries(mixxx-lib PRIVATE Microsoft.GSL::GSL) - if (QML) + if(QML) target_link_libraries(mixxx-qml-lib PRIVATE Microsoft.GSL::GSL) target_link_libraries(mixxx-qml-libplugin PRIVATE Microsoft.GSL::GSL) endif() @@ -3703,9 +4466,12 @@ else() endif() endif() - # QtKeychain -option(QTKEYCHAIN "Secure credentials storage support for Live Broadcasting profiles" ON) +option( + QTKEYCHAIN + "Secure credentials storage support for Live Broadcasting profiles" + ON +) if(QTKEYCHAIN) find_package(Qt${QT_VERSION_MAJOR}Keychain REQUIRED) target_compile_definitions(mixxx-lib PUBLIC __QTKEYCHAIN__) @@ -3722,7 +4488,7 @@ if(HID) # hidapi 0.14.0 is the first release, that contains bus type information find_package(hidapi 0.14.0) if(NOT hidapi_FOUND) - message(FATAL_ERROR "hidapi >= 0.14.0 not found!") + message(FATAL_ERROR "hidapi >= 0.14.0 not found!") else() # hidapi has two backends on Linux, one using the kernel's hidraw API and one using libusb. # libusb obviously does not support Bluetooth HID devices, so use the hidraw backend. The @@ -3733,16 +4499,18 @@ if(HID) target_link_libraries(mixxx-lib PRIVATE hidapi::hidapi) endif() endif() - target_sources(mixxx-lib PRIVATE - src/controllers/hid/hidcontroller.cpp - src/controllers/hid/hidiothread.cpp - src/controllers/hid/hidioglobaloutputreportfifo.cpp - src/controllers/hid/hidiooutputreport.cpp - src/controllers/hid/hiddevice.cpp - src/controllers/hid/hidenumerator.cpp - src/controllers/hid/hidusagetables.cpp - src/controllers/hid/legacyhidcontrollermapping.cpp - src/controllers/hid/legacyhidcontrollermappingfilehandler.cpp + target_sources( + mixxx-lib + PRIVATE + src/controllers/hid/hidcontroller.cpp + src/controllers/hid/hidiothread.cpp + src/controllers/hid/hidioglobaloutputreportfifo.cpp + src/controllers/hid/hidiooutputreport.cpp + src/controllers/hid/hiddevice.cpp + src/controllers/hid/hidenumerator.cpp + src/controllers/hid/hidusagetables.cpp + src/controllers/hid/legacyhidcontrollermapping.cpp + src/controllers/hid/legacyhidcontrollermappingfilehandler.cpp ) target_compile_definitions(mixxx-lib PUBLIC __HID__) endif() @@ -3751,16 +4519,23 @@ endif() default_option(BULK "USB Bulk controller support" "LibUSB_FOUND;NOT WIN32") if(BULK) if(NOT LibUSB_FOUND) - message(FATAL_ERROR "USB Bulk controller support requires libusb 1.0 and its development headers.") + 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 + target_sources( + mixxx-lib + PRIVATE + 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 + target_sources( + mixxx-lib + PRIVATE + src/controllers/hid/legacyhidcontrollermapping.cpp + src/controllers/hid/legacyhidcontrollermappingfilehandler.cpp ) endif() target_compile_definitions(mixxx-lib PUBLIC __BULK__) @@ -3771,18 +4546,23 @@ endif() default_option(VINYLCONTROL "Vinyl Control support" "NOT MACAPPSTORE") if(VINYLCONTROL) if(MACAPPSTORE) - message(FATAL_ERROR "Mac App Store and Vinyl Control support are mutually exclusive due to licensing issues.") + message( + FATAL_ERROR + "Mac App Store and Vinyl Control support are mutually exclusive due to licensing issues." + ) endif() - target_sources(mixxx-lib PRIVATE - src/vinylcontrol/vinylcontrol.cpp - src/vinylcontrol/vinylcontrolxwax.cpp - src/preferences/dialog/dlgprefvinyl.cpp - src/vinylcontrol/vinylcontrolsignalwidget.cpp - src/vinylcontrol/vinylcontrolmanager.cpp - src/vinylcontrol/vinylcontrolprocessor.cpp - src/vinylcontrol/steadypitch.cpp - src/engine/controls/vinylcontrolcontrol.cpp + target_sources( + mixxx-lib + PRIVATE + src/vinylcontrol/vinylcontrol.cpp + src/vinylcontrol/vinylcontrolxwax.cpp + src/preferences/dialog/dlgprefvinyl.cpp + src/vinylcontrol/vinylcontrolsignalwidget.cpp + src/vinylcontrol/vinylcontrolmanager.cpp + src/vinylcontrol/vinylcontrolprocessor.cpp + src/vinylcontrol/steadypitch.cpp + src/engine/controls/vinylcontrolcontrol.cpp ) target_compile_definitions(mixxx-lib PUBLIC __VINYLCONTROL__) @@ -3798,29 +4578,44 @@ find_package(wavpack) default_option(WAVPACK "WavPack audio file support" "wavpack_FOUND") if(WAVPACK) if(NOT wavpack_FOUND) - message(FATAL_ERROR "WavPack audio file support requires libwv and its development headers.") + message( + FATAL_ERROR + "WavPack audio file support requires libwv and its development headers." + ) endif() target_sources(mixxx-lib PRIVATE src/sources/soundsourcewv.cpp) target_compile_definitions(mixxx-lib PUBLIC __WV__) target_link_libraries(mixxx-lib PRIVATE WavPack::wavpack) endif() -target_precompile_headers(mixxx-lib PUBLIC - ${MIXXX_LIB_PRECOMPILED_HEADER} - ${MIXXX_COMMON_PRECOMPILED_HEADER} +target_precompile_headers( + mixxx-lib + PUBLIC ${MIXXX_LIB_PRECOMPILED_HEADER} ${MIXXX_COMMON_PRECOMPILED_HEADER} ) target_precompile_headers(mixxx-test REUSE_FROM mixxx-lib) # Configure file with build options -file(RELATIVE_PATH MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}" "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DOCDIR}") -configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/src/config.h" @ONLY) +file( + RELATIVE_PATH + MIXXX_INSTALL_DOCDIR_RELATIVE_TO_DATADIR + "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}" + "${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DOCDIR}" +) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in" + "${CMAKE_CURRENT_BINARY_DIR}/src/config.h" + @ONLY +) # Packaging set(CPACK_PACKAGE_NAME "Mixxx") set(CPACK_PACKAGE_VENDOR "Mixxx Project") set(CPACK_PACKAGE_CONTACT "RJ Skerry-Ryan ") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Digital DJ Application") -set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackPackageDescription.txt") +set( + CPACK_PACKAGE_DESCRIPTION_FILE + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackPackageDescription.txt" +) set(CPACK_PACKAGE_INSTALL_DIRECTORY "Mixxx") set(CPACK_PACKAGE_EXECUTABLES "mixxx;Mixxx") set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/res/images/mixxx_install_logo.bmp") @@ -3837,7 +4632,7 @@ set(CPACK_GIT_COMMIT_DATE ${GIT_COMMIT_DATE}) # Detailed version information, git info and package file name are set from # CPackConfig.cmake, not here. -set(CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~;\\\\.o$") +set(CPACK_SOURCE_IGNORE_FILES "\\\\.#;/#;.*~;\\\\.o$") list(APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git/") list(APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.github/") list(APPEND CPACK_SOURCE_IGNORE_FILES "/build/") @@ -3850,82 +4645,138 @@ set(CPACK_DEBIAN_PACKAGE_SUGGESTS "pdf-viewer, pulseaudio-utils") set(CPACK_DEBIAN_PACKAGE_REPLACES "mixxx-data") if(QT6) if(QML) - set(CPACK_DEBIAN_PACKAGE_DEPENDS - "libqt6sql6-sqlite, fonts-open-sans, fonts-ubuntu, qt6-qpa-plugins,\ - qml6-module-qt5compat-graphicaleffects, qml6-module-qtquick-controls, qml6-module-qtquick-layouts, qml6-module-qtquick-nativestyle, qml6-module-qtquick-templates, qml6-module-qtquick-window, qml6-module-qt-labs-qmlmodels, qml6-module-qtquick-shapes, qml6-module-qtqml-workerscript") + set( + CPACK_DEBIAN_PACKAGE_DEPENDS + "libqt6sql6-sqlite, fonts-open-sans, fonts-ubuntu, qt6-qpa-plugins, qml6-module-qt5compat-graphicaleffects, qml6-module-qtquick-controls, qml6-module-qtquick-layouts, qml6-module-qtquick-nativestyle, qml6-module-qtquick-templates, qml6-module-qtquick-window, qml6-module-qt-labs-qmlmodels, qml6-module-qtquick-shapes, qml6-module-qtqml-workerscript" + ) else() - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6sql6-sqlite, fonts-open-sans, fonts-ubuntu, qt6-qpa-plugins") + set( + CPACK_DEBIAN_PACKAGE_DEPENDS + "libqt6sql6-sqlite, fonts-open-sans, fonts-ubuntu, qt6-qpa-plugins" + ) endif() else() if(QML) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5sql5-sqlite, fonts-open-sans, fonts-ubuntu,\ - qml-module-qtquick-controls, qml-module-qtquick-controls2, qml-module-qt-labs-qmlmodels, qml-module-qtquick-shapes") + set( + CPACK_DEBIAN_PACKAGE_DEPENDS + "libqt5sql5-sqlite, fonts-open-sans, fonts-ubuntu, qml-module-qtquick-controls, qml-module-qtquick-controls2, qml-module-qt-labs-qmlmodels, qml-module-qtquick-shapes" + ) else() - set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5sql5-sqlite, fonts-open-sans, fonts-ubuntu") + set( + CPACK_DEBIAN_PACKAGE_DEPENDS + "libqt5sql5-sqlite, fonts-open-sans, fonts-ubuntu" + ) endif() endif() set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_PACKAGE_HOMEPAGE_URL}") set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_DEBIAN_PACKAGE_DESCRIPTION) -set(CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}") -string(PREPEND CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}" "\n") -string(REPLACE "\n\n" "\n.\n" CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED "${CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED}") -string(REPLACE "\n" "\n " CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED "${CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED}") +set( + CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED + "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" +) +string( + PREPEND + CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED + "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}" + "\n" +) +string( + REPLACE + "\n\n" + "\n.\n" + CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED + "${CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED}" +) +string( + REPLACE + "\n" + "\n " + CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED + "${CPACK_DEBIAN_PACKAGE_DESCRIPTION_MERGED}" +) # This is the version of the package itself and can be advanced or set to # something like 0ubuntu1 when building a new package from the same version -if (NOT CPACK_DEBIAN_PACKAGE_RELEASE) - set(CPACK_DEBIAN_PACKAGE_RELEASE 1) +if(NOT CPACK_DEBIAN_PACKAGE_RELEASE) + set(CPACK_DEBIAN_PACKAGE_RELEASE 1) endif() set(CPACK_DEBIAN_DISTRIBUTION_RELEASES jammy mantic noble oracular) set(CPACK_DEBIAN_SOURCE_DIR ${CMAKE_SOURCE_DIR}) -set(CPACK_DEBIAN_UPLOAD_PPA_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackDebUploadPPA.cmake") -set(CPACK_DEBIAN_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackDebInstall.cmake") +set( + CPACK_DEBIAN_UPLOAD_PPA_SCRIPT + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackDebUploadPPA.cmake" +) +set( + CPACK_DEBIAN_INSTALL_SCRIPT + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/CPackDebInstall.cmake" +) set(CPACK_WIX_UPGRADE_GUID "921DC99C-4DCF-478D-B950-50685CB9E6BE") -set(CPACK_WIX_LICENSE_RTF "${CMAKE_CURRENT_BINARY_DIR}/packaging/wix/LICENSE.rtf") +set( + CPACK_WIX_LICENSE_RTF + "${CMAKE_CURRENT_BINARY_DIR}/packaging/wix/LICENSE.rtf" +) set(CPACK_WIX_PRODUCT_ICON "${CMAKE_SOURCE_DIR}/res/images/icons/ic_mixxx.ico") set(CPACK_WIX_PROPERTY_ARPHELPLINK "${CPACK_PACKAGE_HOMEPAGE_URL}") -set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/packaging/wix/images/banner.bmp") -set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/packaging/wix/images/dialog.bmp") +set( + CPACK_WIX_UI_BANNER + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/wix/images/banner.bmp" +) +set( + CPACK_WIX_UI_DIALOG + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/wix/images/dialog.bmp" +) -set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/packaging/CPackConfig.cmake" ) +set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/packaging/CPackConfig.cmake") if(WIN32) - # override not working default NSIS - set(CPACK_GENERATOR WIX) - # uses CMAKE_PROJECT_VERSION - configure_file(packaging/wix/LICENSE.rtf.in packaging/wix/LICENSE.rtf @ONLY) + # override not working default NSIS + set(CPACK_GENERATOR WIX) + # uses CMAKE_PROJECT_VERSION + configure_file(packaging/wix/LICENSE.rtf.in packaging/wix/LICENSE.rtf @ONLY) endif() include(CPack) -if (APPLOCAL_COMPONENT_DEFINED) - cpack_add_component(applocal - HIDDEN - REQUIRED) - - # In order to run Mixx from the build directory install applocal components - add_custom_command( - TARGET mixxx POST_BUILD - COMMAND "${CMAKE_COMMAND}" -DCOMPONENT=applocal -DCMAKE_INSTALL_PREFIX="${CMAKE_CURRENT_BINARY_DIR}" -P cmake_install.cmake) +if(APPLOCAL_COMPONENT_DEFINED) + cpack_add_component(applocal HIDDEN REQUIRED) + + # In order to run Mixx from the build directory install applocal components + add_custom_command( + TARGET mixxx + POST_BUILD + COMMAND + "${CMAKE_COMMAND}" -DCOMPONENT=applocal + -DCMAKE_INSTALL_PREFIX="${CMAKE_CURRENT_BINARY_DIR}" -P + cmake_install.cmake + COMMENT + "Install applocal components to allow Mixxx to be run from the build directory." + ) endif() if(APPLE AND MACOS_BUNDLE) - set(BUNDLE_NAME "${MIXXX_INSTALL_PREFIX}") - set(BUNDLE_DIRS "${CMAKE_PREFIX_PATH}/lib") - set(APPLE_CODESIGN_ENTITLEMENTS "${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/Mixxx.entitlements") - - # Starting with arm64 macOS Apple will require ad-hoc code signatures, - # which can be generated by setting the identity to a single dash (-). - # These only include a checksum for verifying integrity, not an actual - # signature. - if (NOT APPLE_CODESIGN_IDENTITY) - set(APPLE_CODESIGN_IDENTITY -) - endif() + set(BUNDLE_NAME "${MIXXX_INSTALL_PREFIX}") + set(BUNDLE_DIRS "${CMAKE_PREFIX_PATH}/lib") + set( + APPLE_CODESIGN_ENTITLEMENTS + "${CMAKE_CURRENT_SOURCE_DIR}/packaging/macos/Mixxx.entitlements" + ) - configure_file(cmake/modules/BundleInstall.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/BundleInstall.cmake" @ONLY) - install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/BundleInstall.cmake") + # Starting with arm64 macOS Apple will require ad-hoc code signatures, + # which can be generated by setting the identity to a single dash (-). + # These only include a checksum for verifying integrity, not an actual + # signature. + if(NOT APPLE_CODESIGN_IDENTITY) + set(APPLE_CODESIGN_IDENTITY -) + endif() + + configure_file( + cmake/modules/BundleInstall.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/BundleInstall.cmake" + @ONLY + ) + install(SCRIPT "${CMAKE_CURRENT_BINARY_DIR}/BundleInstall.cmake") endif() diff --git a/cmake/modules/DefaultOption.cmake b/cmake/modules/DefaultOption.cmake index 160cafc2420..c2e7f563690 100644 --- a/cmake/modules/DefaultOption.cmake +++ b/cmake/modules/DefaultOption.cmake @@ -32,9 +32,9 @@ set a default and the value may be overridden by the user. macro(DEFAULT_OPTION option doc depends) set(${option}_DEFAULT_ON 1) - foreach(d ${depends}) + foreach(dependency ${depends}) # if() takes the condition as a list of arguments. Parentheses need to be separated as well. - string(REPLACE "(" " ( " DEFAULT_OPTION_DEP "${d}") + string(REPLACE "(" " ( " DEFAULT_OPTION_DEP "${dependency}") string(REPLACE ")" " ) " DEFAULT_OPTION_DEP "${DEFAULT_OPTION_DEP}") string(REGEX REPLACE " +" ";" DEFAULT_OPTION_DEP "${DEFAULT_OPTION_DEP}") if(${DEFAULT_OPTION_DEP}) diff --git a/cmake/modules/FindChromaprint.cmake b/cmake/modules/FindChromaprint.cmake index d7b136318de..5a47b45abf3 100644 --- a/cmake/modules/FindChromaprint.cmake +++ b/cmake/modules/FindChromaprint.cmake @@ -50,14 +50,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Chromaprint QUIET libchromaprint) endif() -find_path(Chromaprint_INCLUDE_DIR +find_path( + Chromaprint_INCLUDE_DIR NAMES chromaprint.h HINTS ${PC_Chromaprint_INCLUDE_DIRS} PATH_SUFFIXES chromaprint - DOC "Chromaprint include directory") + DOC "Chromaprint include directory" +) mark_as_advanced(Chromaprint_INCLUDE_DIR) -find_library(Chromaprint_LIBRARY +find_library( + Chromaprint_LIBRARY NAMES chromaprint chromaprint_p HINTS ${PC_Chromaprint_LIBRARY_DIRS} DOC "Chromaprint library" @@ -82,7 +85,8 @@ if(Chromaprint_FOUND) if(NOT TARGET Chromaprint::Chromaprint) add_library(Chromaprint::Chromaprint UNKNOWN IMPORTED) - set_target_properties(Chromaprint::Chromaprint + set_target_properties( + Chromaprint::Chromaprint PROPERTIES IMPORTED_LOCATION "${Chromaprint_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Chromaprint_CFLAGS_OTHER}" @@ -92,13 +96,17 @@ if(Chromaprint_FOUND) if(Chromaprint_IS_STATIC) if(WIN32) # used in chomaprint.h to set dllexport for Windows - set_property(TARGET Chromaprint::Chromaprint APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS - CHROMAPRINT_NODLL + set_property( + TARGET Chromaprint::Chromaprint + APPEND + PROPERTY INTERFACE_COMPILE_DEFINITIONS CHROMAPRINT_NODLL ) endif() find_package(FFTW REQUIRED) - set_property(TARGET Chromaprint::Chromaprint APPEND PROPERTY INTERFACE_LINK_LIBRARIES - FFTW::FFTW + set_property( + TARGET Chromaprint::Chromaprint + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES FFTW::FFTW ) endif() endif() diff --git a/cmake/modules/FindDjInterop.cmake b/cmake/modules/FindDjInterop.cmake index ad1a2b0f392..df9a638bf12 100644 --- a/cmake/modules/FindDjInterop.cmake +++ b/cmake/modules/FindDjInterop.cmake @@ -48,13 +48,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_DjInterop QUIET libdjinterop) endif() -find_path(DjInterop_INCLUDE_DIR +find_path( + DjInterop_INCLUDE_DIR NAMES djinterop/djinterop.hpp HINTS ${PC_DjInterop_INCLUDE_DIRS} - DOC "DjInterop include directory") + DOC "DjInterop include directory" +) mark_as_advanced(DjInterop_INCLUDE_DIR) -find_library(DjInterop_LIBRARY +find_library( + DjInterop_LIBRARY NAMES djinterop HINTS ${PC_DjInterop_LIBRARY_DIRS} DOC "DjInterop library" @@ -79,7 +82,8 @@ if(DjInterop_FOUND) if(NOT TARGET DjInterop::DjInterop) add_library(DjInterop::DjInterop UNKNOWN IMPORTED) - set_target_properties(DjInterop::DjInterop + set_target_properties( + DjInterop::DjInterop PROPERTIES IMPORTED_LOCATION "${DjInterop_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_DjInterop_CFLAGS_OTHER}" diff --git a/cmake/modules/FindEbur128.cmake b/cmake/modules/FindEbur128.cmake index 6fd837ba010..e44db10638f 100644 --- a/cmake/modules/FindEbur128.cmake +++ b/cmake/modules/FindEbur128.cmake @@ -48,14 +48,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Ebur128 QUIET libebur128>=1.2.4) endif() -find_path(Ebur128_INCLUDE_DIR +find_path( + Ebur128_INCLUDE_DIR NAMES ebur128.h HINTS ${PC_Ebur128_INCLUDE_DIRS} PATH_SUFFIXES ebur128 - DOC "Ebur128 include directory") + DOC "Ebur128 include directory" +) mark_as_advanced(Ebur128_INCLUDE_DIR) -find_library(Ebur128_LIBRARY +find_library( + Ebur128_LIBRARY NAMES ebur128 HINTS ${PC_Ebur128_LIBRARY_DIRS} DOC "Ebur128 library" @@ -80,7 +83,8 @@ if(Ebur128_FOUND) if(NOT TARGET Ebur128::Ebur128) add_library(Ebur128::Ebur128 UNKNOWN IMPORTED) - set_target_properties(Ebur128::Ebur128 + set_target_properties( + Ebur128::Ebur128 PROPERTIES IMPORTED_LOCATION "${Ebur128_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Ebur128_CFLAGS_OTHER}" diff --git a/cmake/modules/FindFFMPEG.cmake b/cmake/modules/FindFFMPEG.cmake index 6924d07cae6..55255cc30e2 100644 --- a/cmake/modules/FindFFMPEG.cmake +++ b/cmake/modules/FindFFMPEG.cmake @@ -63,9 +63,9 @@ include(FindPackageHandleStandardArgs) # The default components were taken from a survey over other FindFFMPEG.cmake files -if (NOT FFMPEG_FIND_COMPONENTS) +if(NOT FFMPEG_FIND_COMPONENTS) set(FFMPEG_FIND_COMPONENTS libavcodec libavformat libavutil) -endif () +endif() # ### Macro: find_component @@ -73,50 +73,62 @@ endif () # Checks for the given component by invoking pkgconfig and then looking up the libraries and # include directories. # -macro(find_component _component _pkgconfig _library _header) - - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls - find_package(PkgConfig QUIET) - if (PkgConfig_FOUND) - pkg_check_modules(PC_FFMPEG_${_component} QUIET ${_pkgconfig}) - endif () +macro(find_component component pkgconfig library header) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig QUIET) + if(PkgConfig_FOUND) + pkg_check_modules(PC_FFMPEG_${component} QUIET ${pkgconfig}) + endif() - find_path(FFMPEG_${_component}_INCLUDE_DIRS ${_header} + find_path( + FFMPEG_${component}_INCLUDE_DIRS + ${header} HINTS - ${PC_FFMPEG_${_component}_INCLUDEDIR} - ${PC_FFMPEG_${_component}_INCLUDE_DIRS} + ${PC_FFMPEG_${component}_INCLUDEDIR} + ${PC_FFMPEG_${component}_INCLUDE_DIRS} ${PC_FFMPEG_INCLUDE_DIRS} - PATH_SUFFIXES - ffmpeg + PATH_SUFFIXES ffmpeg ) - find_library(FFMPEG_${_component}_LIBRARIES NAMES ${PC_FFMPEG_${_component}_LIBRARIES} ${_library} - HINTS - ${PC_FFMPEG_${_component}_LIBDIR} - ${PC_FFMPEG_${_component}_LIBRARY_DIRS} + find_library( + FFMPEG_${component}_LIBRARIES + NAMES ${PC_FFMPEG_${component}_LIBRARIES} ${library} + HINTS + ${PC_FFMPEG_${component}_LIBDIR} + ${PC_FFMPEG_${component}_LIBRARY_DIRS} ${PC_FFMPEG_LIBRARY_DIRS} ) - #message(STATUS ${FFMPEG_${_component}_LIBRARIES}) - #message(STATUS ${PC_FFMPEG_${_component}_LIBRARIES}) + #message(STATUS ${FFMPEG_${component}_LIBRARIES}) + #message(STATUS ${PC_FFMPEG_${component}_LIBRARIES}) - set(FFMPEG_${_component}_DEFINITIONS ${PC_FFMPEG_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.") - set(FFMPEG_${_component}_VERSION ${PC_FFMPEG_${_component}_VERSION} CACHE STRING "The ${_component} version number.") + set( + FFMPEG_${component}_DEFINITIONS + ${PC_FFMPEG_${component}_CFLAGS_OTHER} + CACHE STRING + "The ${component} CFLAGS." + ) + set( + FFMPEG_${component}_VERSION + ${PC_FFMPEG_${component}_VERSION} + CACHE STRING + "The ${component} version number." + ) - if (FFMPEG_${_component}_LIBRARIES AND FFMPEG_${_component}_INCLUDE_DIRS) - message(STATUS " - ${_component} ${FFMPEG_${_component}_VERSION} found.") - set(FFMPEG_${_component}_FOUND TRUE) - else () - message(STATUS " - ${_component} not found.") - endif () + if(FFMPEG_${component}_LIBRARIES AND FFMPEG_${component}_INCLUDE_DIRS) + message(STATUS " - ${component} ${FFMPEG_${component}_VERSION} found.") + set(FFMPEG_${component}_FOUND TRUE) + else() + message(STATUS " - ${component} not found.") + endif() mark_as_advanced( - FFMPEG_${_component}_INCLUDE_DIRS - FFMPEG_${_component}_LIBRARIES - FFMPEG_${_component}_DEFINITIONS - FFMPEG_${_component}_VERSION) - + FFMPEG_${component}_INCLUDE_DIRS + FFMPEG_${component}_LIBRARIES + FFMPEG_${component}_DEFINITIONS + FFMPEG_${component}_VERSION + ) endmacro() message(STATUS "Searching for FFMPEG components") @@ -132,34 +144,59 @@ find_component(libswresample libswresample swresample libswresample/swresample.h set(FFMPEG_LIBRARIES "") set(FFMPEG_DEFINITIONS "") # Check if the required components were found and add their stuff to the FFMPEG_* vars. -foreach (_component ${FFMPEG_FIND_COMPONENTS}) - if (FFMPEG_${_component}_FOUND) - #message(STATUS "Required component ${_component} present.") - set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_${_component}_LIBRARIES}) - set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${FFMPEG_${_component}_DEFINITIONS}) - list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${_component}_INCLUDE_DIRS}) +foreach(component ${FFMPEG_FIND_COMPONENTS}) + if(FFMPEG_${component}_FOUND) + #message(STATUS "Required component ${component} present.") + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${FFMPEG_${component}_LIBRARIES}) + set( + FFMPEG_DEFINITIONS + ${FFMPEG_DEFINITIONS} + ${FFMPEG_${component}_DEFINITIONS} + ) + list(APPEND FFMPEG_INCLUDE_DIRS ${FFMPEG_${component}_INCLUDE_DIRS}) endif() -endforeach () +endforeach() # Build the include path with duplicates removed. -if (FFMPEG_INCLUDE_DIRS) +if(FFMPEG_INCLUDE_DIRS) list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) -endif () +endif() # cache the vars. -set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFMPEG include directories." FORCE) -set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFMPEG libraries." FORCE) -set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFMPEG cflags." FORCE) - -mark_as_advanced(FFMPEG_INCLUDE_DIRS - FFMPEG_LIBRARIES - FFMPEG_DEFINITIONS) +set( + FFMPEG_INCLUDE_DIRS + ${FFMPEG_INCLUDE_DIRS} + CACHE STRING + "The FFMPEG include directories." + FORCE +) +set( + FFMPEG_LIBRARIES + ${FFMPEG_LIBRARIES} + CACHE STRING + "The FFMPEG libraries." + FORCE +) +set( + FFMPEG_DEFINITIONS + ${FFMPEG_DEFINITIONS} + CACHE STRING + "The FFMPEG cflags." + FORCE +) + +mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS) # Compile the list of required vars -set(_FFMPEG_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) -foreach (_component ${FFMPEG_FIND_COMPONENTS}) - list(APPEND _FFMPEG_REQUIRED_VARS FFMPEG_${_component}_LIBRARIES FFMPEG_${_component}_INCLUDE_DIRS) -endforeach () +set(FFMPEG_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) +foreach(component ${FFMPEG_FIND_COMPONENTS}) + list( + APPEND + FFMPEG_REQUIRED_VARS + FFMPEG_${component}_LIBRARIES + FFMPEG_${component}_INCLUDE_DIRS + ) +endforeach() # Give a nice error message if some of the required vars are missing. -find_package_handle_standard_args(FFMPEG DEFAULT_MSG ${_FFMPEG_REQUIRED_VARS}) +find_package_handle_standard_args(FFMPEG DEFAULT_MSG ${FFMPEG_REQUIRED_VARS}) diff --git a/cmake/modules/FindFFTW.cmake b/cmake/modules/FindFFTW.cmake index a3fb8265c6b..0380dd10fdd 100644 --- a/cmake/modules/FindFFTW.cmake +++ b/cmake/modules/FindFFTW.cmake @@ -41,15 +41,10 @@ The following cache variables may also be set: #]=======================================================================] -find_path(FFTW_INCLUDE_DIR - NAMES fftw3.h - DOC "FFTW include directory") +find_path(FFTW_INCLUDE_DIR NAMES fftw3.h DOC "FFTW include directory") mark_as_advanced(FFTW_INCLUDE_DIR) -find_library(FFTW_LIBRARY - NAMES fftw fftw3 fftw-3.3 - DOC "FFTW library" -) +find_library(FFTW_LIBRARY NAMES fftw fftw3 fftw-3.3 DOC "FFTW library") mark_as_advanced(FFTW_LIBRARY) include(FindPackageHandleStandardArgs) @@ -66,7 +61,8 @@ if(FFTW_FOUND) if(NOT TARGET FFTW::FFTW) add_library(FFTW::FFTW UNKNOWN IMPORTED) - set_target_properties(FFTW::FFTW + set_target_properties( + FFTW::FFTW PROPERTIES IMPORTED_LOCATION "${FFTW_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${FFTW_INCLUDE_DIR}" diff --git a/cmake/modules/FindFLAC.cmake b/cmake/modules/FindFLAC.cmake index 9441a5963db..94030ceb5c9 100644 --- a/cmake/modules/FindFLAC.cmake +++ b/cmake/modules/FindFLAC.cmake @@ -50,13 +50,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_FLAC QUIET flac) endif() -find_path(FLAC_INCLUDE_DIR +find_path( + FLAC_INCLUDE_DIR NAMES FLAC/all.h HINTS ${PC_FLAC_INCLUDE_DIRS} - DOC "FLAC include directory") + DOC "FLAC include directory" +) mark_as_advanced(FLAC_INCLUDE_DIR) -find_library(FLAC_LIBRARY +find_library( + FLAC_LIBRARY NAMES FLAC HINTS ${PC_FLAC_LIBRARY_DIRS} DOC "FLAC library" @@ -81,7 +84,8 @@ if(FLAC_FOUND) if(NOT TARGET FLAC::FLAC) add_library(FLAC::FLAC UNKNOWN IMPORTED) - set_target_properties(FLAC::FLAC + set_target_properties( + FLAC::FLAC PROPERTIES IMPORTED_LOCATION "${FLAC_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_FLAC_CFLAGS_OTHER}" @@ -90,8 +94,10 @@ if(FLAC_FOUND) is_static_library(FLAC_IS_STATIC FLAC::FLAC) if(FLAC_IS_STATIC) if(WIN32) - set_property(TARGET FLAC::FLAC APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS - FLAC__NO_DLL + set_property( + TARGET FLAC::FLAC + APPEND + PROPERTY INTERFACE_COMPILE_DEFINITIONS FLAC__NO_DLL ) endif() endif() diff --git a/cmake/modules/FindG72X.cmake b/cmake/modules/FindG72X.cmake index ad22da2b6f1..4785cd35277 100644 --- a/cmake/modules/FindG72X.cmake +++ b/cmake/modules/FindG72X.cmake @@ -37,27 +37,20 @@ The following cache variables may also be set: #]=======================================================================] -find_library(G72X_LIBRARY - NAMES g72x - DOC "G72X library" -) +find_library(G72X_LIBRARY NAMES g72x DOC "G72X library") mark_as_advanced(G72X_LIBRARY) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - G72X - DEFAULT_MSG - G72X_LIBRARY -) +find_package_handle_standard_args(G72X DEFAULT_MSG G72X_LIBRARY) if(G72X_FOUND) set(G72X_LIBRARIES "${G72X_LIBRARY}") if(NOT TARGET G72X::G72X) add_library(G72X::G72X UNKNOWN IMPORTED) - set_target_properties(G72X::G72X - PROPERTIES - IMPORTED_LOCATION "${G72X_LIBRARY}" + set_target_properties( + G72X::G72X + PROPERTIES IMPORTED_LOCATION "${G72X_LIBRARY}" ) endif() endif() diff --git a/cmake/modules/FindGLIB.cmake b/cmake/modules/FindGLIB.cmake index e7e3dac05ee..e500aae309f 100644 --- a/cmake/modules/FindGLIB.cmake +++ b/cmake/modules/FindGLIB.cmake @@ -46,79 +46,129 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_GLIB QUIET glib-2.0) endif() -find_library(GLIB_LIBRARIES - NAMES glib-2.0 - HINTS ${PC_GLIB_LIBDIR} - ${PC_GLIB_LIBRARY_DIRS} +find_library( + GLIB_LIBRARIES + NAMES glib-2.0 + HINTS ${PC_GLIB_LIBDIR} ${PC_GLIB_LIBRARY_DIRS} ) # Files in glib's main include path may include glibconfig.h, which, # for some odd reason, is normally in $LIBDIR/glib-2.0/include. get_filename_component(_GLIB_LIBRARY_DIR ${GLIB_LIBRARIES} PATH) -find_path(GLIBCONFIG_INCLUDE_DIR - NAMES glibconfig.h - HINTS ${PC_LIBDIR} ${PC_LIBRARY_DIRS} ${_GLIB_LIBRARY_DIR} - ${PC_GLIB_INCLUDEDIR} ${PC_GLIB_INCLUDE_DIRS} - PATH_SUFFIXES glib-2.0/include +find_path( + GLIBCONFIG_INCLUDE_DIR + NAMES glibconfig.h + HINTS + ${PC_LIBDIR} + ${PC_LIBRARY_DIRS} + ${_GLIB_LIBRARY_DIR} + ${PC_GLIB_INCLUDEDIR} + ${PC_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0/include ) -find_path(GLIB_INCLUDE_DIR - NAMES glib.h - HINTS ${PC_GLIB_INCLUDEDIR} - ${PC_GLIB_INCLUDE_DIRS} - PATH_SUFFIXES glib-2.0 +find_path( + GLIB_INCLUDE_DIR + NAMES glib.h + HINTS ${PC_GLIB_INCLUDEDIR} ${PC_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES glib-2.0 ) set(GLIB_INCLUDE_DIRS ${GLIB_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR}) # Version detection -if (EXISTS "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h") - file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS) - string(REGEX MATCH "#define GLIB_MAJOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") - set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}") - string(REGEX MATCH "#define GLIB_MINOR_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") - set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}") - string(REGEX MATCH "#define GLIB_MICRO_VERSION ([0-9]+)" _dummy "${GLIBCONFIG_H_CONTENTS}") - set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}") - set(GLIB_VERSION "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}") -endif () +if(EXISTS "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h") + file(READ "${GLIBCONFIG_INCLUDE_DIR}/glibconfig.h" GLIBCONFIG_H_CONTENTS) + string( + REGEX MATCH + "#define GLIB_MAJOR_VERSION ([0-9]+)" + _dummy + "${GLIBCONFIG_H_CONTENTS}" + ) + set(GLIB_VERSION_MAJOR "${CMAKE_MATCH_1}") + string( + REGEX MATCH + "#define GLIB_MINOR_VERSION ([0-9]+)" + _dummy + "${GLIBCONFIG_H_CONTENTS}" + ) + set(GLIB_VERSION_MINOR "${CMAKE_MATCH_1}") + string( + REGEX MATCH + "#define GLIB_MICRO_VERSION ([0-9]+)" + _dummy + "${GLIBCONFIG_H_CONTENTS}" + ) + set(GLIB_VERSION_MICRO "${CMAKE_MATCH_1}") + set( + GLIB_VERSION + "${GLIB_VERSION_MAJOR}.${GLIB_VERSION_MINOR}.${GLIB_VERSION_MICRO}" + ) +endif() # Additional Glib components. We only look for libraries, as not all of them # have corresponding headers and all headers are installed alongside the main # glib ones. -foreach (_component ${GLIB_FIND_COMPONENTS}) - if (${_component} STREQUAL "gio") - find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR}) - set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES) - elseif (${_component} STREQUAL "gobject") - find_library(GLIB_GOBJECT_LIBRARIES NAMES gobject-2.0 HINTS ${_GLIB_LIBRARY_DIR}) - set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GOBJECT_LIBRARIES) - elseif (${_component} STREQUAL "gmodule") - find_library(GLIB_GMODULE_LIBRARIES NAMES gmodule-2.0 HINTS ${_GLIB_LIBRARY_DIR}) - set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GMODULE_LIBRARIES) - elseif (${_component} STREQUAL "gthread") - find_library(GLIB_GTHREAD_LIBRARIES NAMES gthread-2.0 HINTS ${_GLIB_LIBRARY_DIR}) - set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GTHREAD_LIBRARIES) - elseif (${_component} STREQUAL "gio-unix") - # gio-unix is compiled as part of the gio library, but the include paths - # are separate from the shared glib ones. Since this is currently only used - # by WebKitGTK we don't go to extraordinary measures beyond pkg-config. - pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0) - endif () -endforeach () +foreach(component ${GLIB_FIND_COMPONENTS}) + if(${component} STREQUAL "gio") + find_library(GLIB_GIO_LIBRARIES NAMES gio-2.0 HINTS ${_GLIB_LIBRARY_DIR}) + set(ADDITIONAL_REQUIRED_VARS ${ADDITIONAL_REQUIRED_VARS} GLIB_GIO_LIBRARIES) + elseif(${component} STREQUAL "gobject") + find_library( + GLIB_GOBJECT_LIBRARIES + NAMES gobject-2.0 + HINTS ${_GLIB_LIBRARY_DIR} + ) + set( + ADDITIONAL_REQUIRED_VARS + ${ADDITIONAL_REQUIRED_VARS} + GLIB_GOBJECT_LIBRARIES + ) + elseif(${component} STREQUAL "gmodule") + find_library( + GLIB_GMODULE_LIBRARIES + NAMES gmodule-2.0 + HINTS ${_GLIB_LIBRARY_DIR} + ) + set( + ADDITIONAL_REQUIRED_VARS + ${ADDITIONAL_REQUIRED_VARS} + GLIB_GMODULE_LIBRARIES + ) + elseif(${component} STREQUAL "gthread") + find_library( + GLIB_GTHREAD_LIBRARIES + NAMES gthread-2.0 + HINTS ${_GLIB_LIBRARY_DIR} + ) + set( + ADDITIONAL_REQUIRED_VARS + ${ADDITIONAL_REQUIRED_VARS} + GLIB_GTHREAD_LIBRARIES + ) + elseif(${component} STREQUAL "gio-unix") + # gio-unix is compiled as part of the gio library, but the include paths + # are separate from the shared glib ones. Since this is currently only used + # by WebKitGTK we don't go to extraordinary measures beyond pkg-config. + pkg_check_modules(GIO_UNIX QUIET gio-unix-2.0) + endif() +endforeach() include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GLIB REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS} - VERSION_VAR GLIB_VERSION) +find_package_handle_standard_args( + GLIB + REQUIRED_VARS GLIB_INCLUDE_DIRS GLIB_LIBRARIES ${ADDITIONAL_REQUIRED_VARS} + VERSION_VAR GLIB_VERSION +) mark_as_advanced( - GLIBCONFIG_INCLUDE_DIR - GLIB_GIO_LIBRARIES - GLIB_GIO_UNIX_LIBRARIES - GLIB_GMODULE_LIBRARIES - GLIB_GOBJECT_LIBRARIES - GLIB_GTHREAD_LIBRARIES - GLIB_INCLUDE_DIR - GLIB_INCLUDE_DIRS - GLIB_LIBRARIES + GLIBCONFIG_INCLUDE_DIR + GLIB_GIO_LIBRARIES + GLIB_GIO_UNIX_LIBRARIES + GLIB_GMODULE_LIBRARIES + GLIB_GOBJECT_LIBRARIES + GLIB_GTHREAD_LIBRARIES + GLIB_INCLUDE_DIR + GLIB_INCLUDE_DIRS + GLIB_LIBRARIES ) diff --git a/cmake/modules/FindGPerfTools.cmake b/cmake/modules/FindGPerfTools.cmake index d2b681f54f1..5aa1d11ee0b 100644 --- a/cmake/modules/FindGPerfTools.cmake +++ b/cmake/modules/FindGPerfTools.cmake @@ -55,26 +55,32 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_GPerfTools_PROFILER QUIET libprofiler) endif() -find_path(GPerfTools_TCMALLOC_INCLUDE_DIR +find_path( + GPerfTools_TCMALLOC_INCLUDE_DIR NAMES gperftools/tcmalloc.h HINTS ${PC_GPerfTools_TCMALLOC_INCLUDE_DIRS} - DOC "tcmalloc include directory") + DOC "tcmalloc include directory" +) mark_as_advanced(GPerfTools_TCMALLOC_INCLUDE_DIR) -find_library(GPerfTools_TCMALLOC_LIBRARY +find_library( + GPerfTools_TCMALLOC_LIBRARY NAMES tcmalloc HINTS ${PC_GPerfTools_TCMALLOC_LIBRARY_DIRS} DOC "tcmalloc library" ) mark_as_advanced(GPerfTools_TCMALLOC_LIBRARY) -find_path(GPerfTools_PROFILER_INCLUDE_DIR +find_path( + GPerfTools_PROFILER_INCLUDE_DIR NAMES gperftools/profiler.h HINTS ${PC_GPerfTools_PROFILER_INCLUDE_DIRS} - DOC "profiler include directory") + DOC "profiler include directory" +) mark_as_advanced(GPerfTools_PROFILER_INCLUDE_DIR) -find_library(GPerfTools_PROFILER_LIBRARY +find_library( + GPerfTools_PROFILER_LIBRARY NAMES profiler HINTS ${PC_GPerfTools_PROFILER_LIBRARY_DIRS} DOC "profiler library" @@ -92,31 +98,40 @@ find_package_handle_standard_args( ) if(GPerfTools_FOUND) - set(GPerfTools_LIBRARIES + set( + GPerfTools_LIBRARIES ${GPerfTools_TCMALLOC_LIBRARY} ${GPerfTools_PROFILER_LIBRARY} ) - set(GPerfTools_INCLUDE_DIRS + set( + GPerfTools_INCLUDE_DIRS ${GPerfTools_TCMALLOC_INCLUDE_DIR} ${GPerfTools_PROFILER_INCLUDE_DIR} ) - set(GPerfTools_DEFINITIONS + set( + GPerfTools_DEFINITIONS ${PC_GPerfTools_TCMALLOC_CFLAGS_OTHER} ${PC_GPerfTools_PROFILER_CFLAGS_OTHER} ) - if (NOT TARGET GPerfTools::tcmalloc) + if(NOT TARGET GPerfTools::tcmalloc) add_library(GPerfTools::tcmalloc UNKNOWN IMPORTED) - set_target_properties(GPerfTools::tcmalloc PROPERTIES - IMPORTED_LOCATION ${GPerfTools_TCMALLOC_LIBRARY} - INTERFACE_COMPILE_OPTIONS "${PC_GPerfTools_TCMALLOC_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${GPerfTools_TCMALLOC_INCLUDE_DIR}") + set_target_properties( + GPerfTools::tcmalloc + PROPERTIES + IMPORTED_LOCATION ${GPerfTools_TCMALLOC_LIBRARY} + INTERFACE_COMPILE_OPTIONS "${PC_GPerfTools_TCMALLOC_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${GPerfTools_TCMALLOC_INCLUDE_DIR}" + ) endif() - if (NOT TARGET GPerfTools::profiler) + if(NOT TARGET GPerfTools::profiler) add_library(GPerfTools::profiler UNKNOWN IMPORTED) - set_target_properties(GPerfTools::profiler PROPERTIES - IMPORTED_LOCATION "${GPerfTools_PROFILER_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_GPerfTools_PROFILER_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${GPerfTools_PROFILER_INCLUDE_DIR}") + set_target_properties( + GPerfTools::profiler + PROPERTIES + IMPORTED_LOCATION "${GPerfTools_PROFILER_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_GPerfTools_PROFILER_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${GPerfTools_PROFILER_INCLUDE_DIR}" + ) endif() endif() diff --git a/cmake/modules/FindHSS1394.cmake b/cmake/modules/FindHSS1394.cmake index 42965f3c808..57ff6fc51cf 100644 --- a/cmake/modules/FindHSS1394.cmake +++ b/cmake/modules/FindHSS1394.cmake @@ -41,15 +41,14 @@ The following cache variables may also be set: #]=======================================================================] -find_path(HSS1394_INCLUDE_DIR +find_path( + HSS1394_INCLUDE_DIR NAMES HSS1394/HSS1394.h - DOC "HSS1394 include directory") + DOC "HSS1394 include directory" +) mark_as_advanced(HSS1394_INCLUDE_DIR) -find_library(HSS1394_LIBRARY - NAMES hss1394 - DOC "HSS1394 library" -) +find_library(HSS1394_LIBRARY NAMES hss1394 DOC "HSS1394 library") mark_as_advanced(HSS1394_LIBRARY) include(FindPackageHandleStandardArgs) @@ -66,7 +65,8 @@ if(HSS1394_FOUND) if(NOT TARGET HSS1394::HSS1394) add_library(HSS1394::HSS1394 UNKNOWN IMPORTED) - set_target_properties(HSS1394::HSS1394 + set_target_properties( + HSS1394::HSS1394 PROPERTIES IMPORTED_LOCATION "${HSS1394_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${HSS1394_INCLUDE_DIR}" diff --git a/cmake/modules/FindID3Tag.cmake b/cmake/modules/FindID3Tag.cmake index 35c0842b5a4..cb96982751a 100644 --- a/cmake/modules/FindID3Tag.cmake +++ b/cmake/modules/FindID3Tag.cmake @@ -48,14 +48,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_ID3Tag QUIET id3tag) endif() -find_path(ID3Tag_INCLUDE_DIR +find_path( + ID3Tag_INCLUDE_DIR NAMES id3tag.h HINTS ${PC_ID3Tag_INCLUDE_DIRS} PATH_SUFFIXES id3tag - DOC "ID3Tag include directory") + DOC "ID3Tag include directory" +) mark_as_advanced(ID3Tag_INCLUDE_DIR) -find_library(ID3Tag_LIBRARY +find_library( + ID3Tag_LIBRARY NAMES id3tag HINTS ${PC_ID3Tag_LIBRARY_DIRS} DOC "ID3Tag library" @@ -80,7 +83,8 @@ if(ID3Tag_FOUND) if(NOT TARGET ID3Tag::ID3Tag) add_library(ID3Tag::ID3Tag UNKNOWN IMPORTED) - set_target_properties(ID3Tag::ID3Tag + set_target_properties( + ID3Tag::ID3Tag PROPERTIES IMPORTED_LOCATION "${ID3Tag_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_ID3Tag_CFLAGS_OTHER}" diff --git a/cmake/modules/FindJACK.cmake b/cmake/modules/FindJACK.cmake index 1bb3cd6ad7e..3699517eea3 100644 --- a/cmake/modules/FindJACK.cmake +++ b/cmake/modules/FindJACK.cmake @@ -26,13 +26,16 @@ if(PkgConfig_FOUND) pkg_check_modules(JACK jack) endif() -find_path(JACK_INCLUDE_DIR +find_path( + JACK_INCLUDE_DIR NAMES jack/jack.h HINTS ${PC_JACK_INCLUDE_DIRS} - DOC "JACK include directory") + DOC "JACK include directory" +) mark_as_advanced(JACK_INCLUDE_DIR) -find_library(JACK_LIBRARY +find_library( + JACK_LIBRARY NAMES jack HINTS ${PC_JACK_LIBRARY_DIRS} DOC "JACK library" @@ -40,10 +43,10 @@ find_library(JACK_LIBRARY mark_as_advanced(JACK_LIBRARY) if(WIN32) - # vcpkg provides CMake targets for pthreads4w - # This won't work if pthreads4w was built without vcpkg. - find_package(pthreads REQUIRED) - list(APPEND JACK_LINK_LIBRARIES PThreads4W::PThreads4W) + # vcpkg provides CMake targets for pthreads4w + # This won't work if pthreads4w was built without vcpkg. + find_package(pthreads REQUIRED) + list(APPEND JACK_LINK_LIBRARIES PThreads4W::PThreads4W) endif() if(DEFINED PC_JACK_VERSION AND NOT PC_JACK_VERSION STREQUAL "") @@ -55,7 +58,6 @@ find_package_handle_standard_args( JACK REQUIRED_VARS JACK_LIBRARY JACK_INCLUDE_DIR VERSION_VAR JACK_VERSION - ) if(JACK_FOUND) @@ -64,8 +66,9 @@ if(JACK_FOUND) set(JACK_DEFINITIONS ${PC_JACK_CFLAGS_OTHER}) if(NOT TARGET JACK::jack) - add_library(JACK::jack UNKNOWN IMPORTED) - set_target_properties(JACK::jack + add_library(JACK::jack UNKNOWN IMPORTED) + set_target_properties( + JACK::jack PROPERTIES IMPORTED_LOCATION "${JACK_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_JACK_CFLAGS_OTHER}" diff --git a/cmake/modules/FindKeyFinder.cmake b/cmake/modules/FindKeyFinder.cmake index d6c9fc230ee..4340953f3e9 100644 --- a/cmake/modules/FindKeyFinder.cmake +++ b/cmake/modules/FindKeyFinder.cmake @@ -50,13 +50,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_KeyFinder QUIET libKeyFinder>=2.0) endif() -find_path(KeyFinder_INCLUDE_DIR +find_path( + KeyFinder_INCLUDE_DIR NAMES keyfinder/keyfinder.h HINTS ${PC_KeyFinder_INCLUDE_DIRS} - DOC "KeyFinder include directory") + DOC "KeyFinder include directory" +) mark_as_advanced(KeyFinder_INCLUDE_DIR) -find_library(KeyFinder_LIBRARY +find_library( + KeyFinder_LIBRARY NAMES keyfinder HINTS ${PC_KeyFinder_LIBRARY_DIRS} DOC "KeyFinder library" @@ -81,7 +84,8 @@ if(KeyFinder_FOUND) if(NOT TARGET KeyFinder::KeyFinder) add_library(KeyFinder::KeyFinder UNKNOWN IMPORTED) - set_target_properties(KeyFinder::KeyFinder + set_target_properties( + KeyFinder::KeyFinder PROPERTIES IMPORTED_LOCATION "${KeyFinder_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_KeyFinder_CFLAGS_OTHER}" @@ -90,8 +94,10 @@ if(KeyFinder_FOUND) is_static_library(KeyFinder_IS_STATIC KeyFinder::KeyFinder) if(KeyFinder_IS_STATIC) find_package(FFTW REQUIRED) - set_property(TARGET KeyFinder::KeyFinder APPEND PROPERTY INTERFACE_LINK_LIBRARIES - FFTW::FFTW + set_property( + TARGET KeyFinder::KeyFinder + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES FFTW::FFTW ) endif() endif() diff --git a/cmake/modules/FindLibUSB.cmake b/cmake/modules/FindLibUSB.cmake index 48aaea30f4d..d7484454e7b 100644 --- a/cmake/modules/FindLibUSB.cmake +++ b/cmake/modules/FindLibUSB.cmake @@ -50,7 +50,8 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_LibUSB QUIET libusb-1.0) endif() -find_path(LibUSB_INCLUDE_DIR +find_path( + LibUSB_INCLUDE_DIR NAMES libusb.h PATH_SUFFIXES libusb libusb-1.0 HINTS ${PC_LibUSB_INCLUDE_DIRS} @@ -58,7 +59,8 @@ find_path(LibUSB_INCLUDE_DIR ) mark_as_advanced(LibUSB_INCLUDE_DIR) -find_library(LibUSB_LIBRARY +find_library( + LibUSB_LIBRARY NAMES usb-1.0 usb HINTS ${PC_LibUSB_LIBRARY_DIRS} DOC "LibUSB library" @@ -83,7 +85,8 @@ if(LibUSB_FOUND) if(NOT TARGET LibUSB::LibUSB) add_library(LibUSB::LibUSB UNKNOWN IMPORTED) - set_target_properties(LibUSB::LibUSB + set_target_properties( + LibUSB::LibUSB PROPERTIES IMPORTED_LOCATION "${LibUSB_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_LibUSB_CFLAGS_OTHER}" @@ -94,8 +97,10 @@ if(LibUSB_FOUND) if(LibUSB_IS_STATIC) find_package(Libudev) if(Libudev_FOUND) - set_property(TARGET LibUSB::LibUSB APPEND PROPERTY INTERFACE_LINK_LIBRARIES - Libudev::Libudev + set_property( + TARGET LibUSB::LibUSB + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES Libudev::Libudev ) endif() endif() diff --git a/cmake/modules/FindLibudev.cmake b/cmake/modules/FindLibudev.cmake index 696d55e28f0..9ea43ab7d2c 100644 --- a/cmake/modules/FindLibudev.cmake +++ b/cmake/modules/FindLibudev.cmake @@ -24,15 +24,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Libudev QUIET libudev) endif() -find_path(Libudev_INCLUDE_DIR +find_path( + Libudev_INCLUDE_DIR NAMES libudev.h PATHS ${PC_Libudev_INCLUDE_DIRS} - DOC "The libudev include directory") + DOC "The libudev include directory" +) mark_as_advanced(Libudev_INCLUDE_DIR) -find_library(Libudev_LIBRARY - NAMES udev - PATH ${PC_Libudev_LIBRARY_DIRS} +find_library( + Libudev_LIBRARY + NAMES udev PATH ${PC_Libudev_LIBRARY_DIRS} DOC "The libudev library" ) mark_as_advanced(Libudev_LIBRARY) @@ -51,7 +53,8 @@ if(Libudev_FOUND) if(NOT TARGET Libudev::Libudev) add_library(Libudev::Libudev UNKNOWN IMPORTED) - set_target_properties(Libudev::Libudev + set_target_properties( + Libudev::Libudev PROPERTIES IMPORTED_LOCATION "${Libudev_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Libudev_CFLAGS_OTHER}" diff --git a/cmake/modules/FindMAD.cmake b/cmake/modules/FindMAD.cmake index a9d722c45df..79c25efdc5b 100644 --- a/cmake/modules/FindMAD.cmake +++ b/cmake/modules/FindMAD.cmake @@ -48,14 +48,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_MAD QUIET mad) endif() -find_path(MAD_INCLUDE_DIR +find_path( + MAD_INCLUDE_DIR NAMES mad.h HINTS ${PC_MAD_INCLUDE_DIRS} PATH_SUFFIXES mad - DOC "MAD include directory") + DOC "MAD include directory" +) mark_as_advanced(MAD_INCLUDE_DIR) -find_library(MAD_LIBRARY +find_library( + MAD_LIBRARY NAMES mad HINTS ${PC_MAD_LIBRARY_DIRS} DOC "MAD library" @@ -80,7 +83,8 @@ if(MAD_FOUND) if(NOT TARGET MAD::MAD) add_library(MAD::MAD UNKNOWN IMPORTED) - set_target_properties(MAD::MAD + set_target_properties( + MAD::MAD PROPERTIES IMPORTED_LOCATION "${MAD_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_MAD_CFLAGS_OTHER}" diff --git a/cmake/modules/FindMP4.cmake b/cmake/modules/FindMP4.cmake index d166ef99fda..e45db967f99 100644 --- a/cmake/modules/FindMP4.cmake +++ b/cmake/modules/FindMP4.cmake @@ -48,13 +48,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_MP4 QUIET mp4) endif() -find_path(MP4_INCLUDE_DIR +find_path( + MP4_INCLUDE_DIR NAMES mp4/mp4.h HINTS ${PC_MP4_INCLUDE_DIRS} - DOC "MP4 include directory") + DOC "MP4 include directory" +) mark_as_advanced(MP4_INCLUDE_DIR) -find_library(MP4_LIBRARY +find_library( + MP4_LIBRARY NAMES mp4 HINTS ${PC_MP4_LIBRARY_DIRS} DOC "MP4 library" @@ -79,7 +82,8 @@ if(MP4_FOUND) if(NOT TARGET MP4::MP4) add_library(MP4::MP4 UNKNOWN IMPORTED) - set_target_properties(MP4::MP4 + set_target_properties( + MP4::MP4 PROPERTIES IMPORTED_LOCATION "${MP4_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_MP4_CFLAGS_OTHER}" diff --git a/cmake/modules/FindMP4v2.cmake b/cmake/modules/FindMP4v2.cmake index c60bf765017..b3d11ac26a7 100644 --- a/cmake/modules/FindMP4v2.cmake +++ b/cmake/modules/FindMP4v2.cmake @@ -48,13 +48,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_MP4v2 QUIET mp4v2) endif() -find_path(MP4v2_INCLUDE_DIR +find_path( + MP4v2_INCLUDE_DIR NAMES mp4v2/mp4v2.h HINTS ${PC_MP4v2_INCLUDE_DIRS} - DOC "MP4v2 include directory") + DOC "MP4v2 include directory" +) mark_as_advanced(MP4v2_INCLUDE_DIR) -find_library(MP4v2_LIBRARY +find_library( + MP4v2_LIBRARY NAMES mp4v2 HINTS ${PC_MP4v2_LIBRARY_DIRS} DOC "MP4v2 library" @@ -79,7 +82,8 @@ if(MP4v2_FOUND) if(NOT TARGET MP4v2::MP4v2) add_library(MP4v2::MP4v2 UNKNOWN IMPORTED) - set_target_properties(MP4v2::MP4v2 + set_target_properties( + MP4v2::MP4v2 PROPERTIES IMPORTED_LOCATION "${MP4v2_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_MP4v2_CFLAGS_OTHER}" diff --git a/cmake/modules/FindMediaFoundation.cmake b/cmake/modules/FindMediaFoundation.cmake index 0d8f47a8219..47b4a392c13 100644 --- a/cmake/modules/FindMediaFoundation.cmake +++ b/cmake/modules/FindMediaFoundation.cmake @@ -3,18 +3,27 @@ # # MediaFoundation_LIBRARIES - List of libraries when using MediaFoundation # MediaFoundation_FOUND - True if MediaFoundation found +# +# lint_cmake: -package/consistency -IF (MSVC) - SET( MediaFoundation_LIBRARIES mf.lib mfplat.lib mfreadwrite.lib mfuuid.lib strmiids.lib ) - SET( MediaFoundation_FOUND true ) -ENDIF (MSVC) +if(MSVC) + set( + MediaFoundation_LIBRARIES + mf.lib + mfplat.lib + mfreadwrite.lib + mfuuid.lib + strmiids.lib + ) + set(MediaFoundation_FOUND true) +endif() -IF (MediaFoundation_FOUND) - IF (NOT MediaFoundation_FIND_QUIETLY) - MESSAGE(STATUS "Found MediaFoundation: ${MediaFoundation_LIBRARIES}") - ENDIF (NOT MediaFoundation_FIND_QUIETLY) -ELSE (MediaFoundation_FOUND) - IF (MediaFoundation_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "Could not find MediaFoundation") - ENDIF (MediaFoundation_FIND_REQUIRED) -ENDIF (MediaFoundation_FOUND) +if(MediaFoundation_FOUND) + if(NOT MediaFoundation_FIND_QUIETLY) + message(STATUS "Found MediaFoundation: ${MediaFoundation_LIBRARIES}") + endif() +else() + if(MediaFoundation_FIND_REQUIRED) + message(FATAL_ERROR "Could not find MediaFoundation") + endif() +endif() diff --git a/cmake/modules/FindModplug.cmake b/cmake/modules/FindModplug.cmake index d6230e840f6..ec588743daf 100644 --- a/cmake/modules/FindModplug.cmake +++ b/cmake/modules/FindModplug.cmake @@ -48,13 +48,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Modplug QUIET libmodplug) endif() -find_path(Modplug_INCLUDE_DIR +find_path( + Modplug_INCLUDE_DIR NAMES libmodplug/modplug.h HINTS ${PC_Modplug_INCLUDE_DIRS} - DOC "Modplug include directory") + DOC "Modplug include directory" +) mark_as_advanced(Modplug_INCLUDE_DIR) -find_library(Modplug_LIBRARY +find_library( + Modplug_LIBRARY NAMES modplug HINTS ${PC_Modplug_LIBRARY_DIRS} DOC "Modplug library" @@ -79,7 +82,8 @@ if(Modplug_FOUND) if(NOT TARGET Modplug::Modplug) add_library(Modplug::Modplug UNKNOWN IMPORTED) - set_target_properties(Modplug::Modplug + set_target_properties( + Modplug::Modplug PROPERTIES IMPORTED_LOCATION "${Modplug_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Modplug_CFLAGS_OTHER}" diff --git a/cmake/modules/FindOgg.cmake b/cmake/modules/FindOgg.cmake index a32d7042e44..2e0db15f4d1 100644 --- a/cmake/modules/FindOgg.cmake +++ b/cmake/modules/FindOgg.cmake @@ -39,14 +39,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Ogg QUIET ogg) endif() -find_path(Ogg_INCLUDE_DIR +find_path( + Ogg_INCLUDE_DIR NAMES ogg/ogg.h HINTS ${PC_Ogg_INCLUDE_DIRS} DOC "Ogg include directory" ) mark_as_advanced(Ogg_INCLUDE_DIR) -find_library(Ogg_LIBRARY +find_library( + Ogg_LIBRARY NAMES ogg HINTS ${PC_Ogg_LIBRARY_DIRS} DOC "Ogg library" @@ -71,7 +73,8 @@ if(Ogg_FOUND) if(NOT TARGET Ogg::ogg) add_library(Ogg::ogg UNKNOWN IMPORTED) - set_target_properties(Ogg::ogg + set_target_properties( + Ogg::ogg PROPERTIES IMPORTED_LOCATION "${Ogg_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Ogg_CFLAGS_OTHER}" diff --git a/cmake/modules/FindOpus.cmake b/cmake/modules/FindOpus.cmake index f3ed9397081..fe3e422f6b1 100644 --- a/cmake/modules/FindOpus.cmake +++ b/cmake/modules/FindOpus.cmake @@ -40,13 +40,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Opus QUIET opus) endif() -find_path(Opus_INCLUDE_DIR +find_path( + Opus_INCLUDE_DIR NAMES opus/opus.h HINTS ${PC_Opus_INCLUDE_DIRS} - DOC "Opus include directory") + DOC "Opus include directory" +) mark_as_advanced(Opus_INCLUDE_DIR) -find_library(Opus_LIBRARY +find_library( + Opus_LIBRARY NAMES opus HINTS ${PC_Opus_LIBRARY_DIRS} DOC "Opus library" @@ -71,7 +74,8 @@ if(Opus_FOUND) if(NOT TARGET Opus::Opus) add_library(Opus::Opus UNKNOWN IMPORTED) - set_target_properties(Opus::Opus + set_target_properties( + Opus::Opus PROPERTIES IMPORTED_LOCATION "${Opus_LIBRARIES}" INTERFACE_COMPILE_OPTIONS "${Opus_DEFINITIONS}" diff --git a/cmake/modules/FindOpusFile.cmake b/cmake/modules/FindOpusFile.cmake index 226a4711167..cfa839e279f 100644 --- a/cmake/modules/FindOpusFile.cmake +++ b/cmake/modules/FindOpusFile.cmake @@ -46,14 +46,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_OpusFile QUIET opusfile) endif() -find_path(OpusFile_INCLUDE_DIR +find_path( + OpusFile_INCLUDE_DIR NAMES opusfile.h PATH_SUFFIXES opus HINTS ${PC_OpusFile_INCLUDE_DIRS} - DOC "Opusfile include directory") + DOC "Opusfile include directory" +) mark_as_advanced(OpusFile_INCLUDE_DIR) -find_library(OpusFile_LIBRARY +find_library( + OpusFile_LIBRARY NAMES opusfile HINTS ${PC_OpusFile_LIBRARY_DIRS} DOC "Opusfile library" @@ -78,7 +81,8 @@ if(OpusFile_FOUND) if(NOT TARGET OpusFile::OpusFile) add_library(OpusFile::OpusFile UNKNOWN IMPORTED) - set_target_properties(OpusFile::OpusFile + set_target_properties( + OpusFile::OpusFile PROPERTIES IMPORTED_LOCATION "${OpusFile_LIBRARIES}" INTERFACE_COMPILE_OPTIONS "${OpusFile_DEFINITIONS}" diff --git a/cmake/modules/FindPortAudio.cmake b/cmake/modules/FindPortAudio.cmake index 2c107b8b375..f1f4549b29b 100644 --- a/cmake/modules/FindPortAudio.cmake +++ b/cmake/modules/FindPortAudio.cmake @@ -50,19 +50,24 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_PortAudio QUIET portaudio-2.0) endif() -find_path(PortAudio_INCLUDE_DIR +find_path( + PortAudio_INCLUDE_DIR NAMES portaudio.h HINTS ${PC_PortAudio_INCLUDE_DIRS} - DOC "PortAudio include directory") + DOC "PortAudio include directory" +) mark_as_advanced(PortAudio_INCLUDE_DIR) # Temporary hack until https://github.com/PortAudio/portaudio/pull/635 is released. -find_path(PortAudio_ALSA_H +find_path( + PortAudio_ALSA_H NAMES pa_linux_alsa.h - HINTS ${PC_PortAudio_INCLUDE_DIRS}) + HINTS ${PC_PortAudio_INCLUDE_DIRS} +) mark_as_advanced(PortAudio_ALSA_H) -find_library(PortAudio_LIBRARY +find_library( + PortAudio_LIBRARY NAMES portaudio HINTS ${PC_PortAudio_LIBRARY_DIRS} DOC "PortAudio library" @@ -83,7 +88,8 @@ find_package_handle_standard_args( if(PortAudio_FOUND) if(NOT TARGET PortAudio::PortAudio) add_library(PortAudio::PortAudio UNKNOWN IMPORTED) - set_target_properties(PortAudio::PortAudio + set_target_properties( + PortAudio::PortAudio PROPERTIES IMPORTED_LOCATION "${PortAudio_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_PortAudio_CFLAGS_OTHER}" @@ -94,15 +100,19 @@ if(PortAudio_FOUND) if(PortAudio_ALSA_H) find_package(ALSA) if(ALSA_FOUND) - set_property(TARGET PortAudio::PortAudio APPEND PROPERTY INTERFACE_LINK_LIBRARIES - ALSA::ALSA + set_property( + TARGET PortAudio::PortAudio + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ALSA::ALSA ) endif() endif() find_package(JACK) if(JACK_FOUND) - set_property(TARGET PortAudio::PortAudio APPEND PROPERTY INTERFACE_LINK_LIBRARIES - JACK::jack + set_property( + TARGET PortAudio::PortAudio + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES JACK::jack ) endif() endif() diff --git a/cmake/modules/FindPortMidi.cmake b/cmake/modules/FindPortMidi.cmake index 84e9342f85e..16617ea14c8 100644 --- a/cmake/modules/FindPortMidi.cmake +++ b/cmake/modules/FindPortMidi.cmake @@ -39,28 +39,26 @@ The following cache variables may also be set: include(IsStaticLibrary) -find_path(PortMidi_INCLUDE_DIR +find_path( + PortMidi_INCLUDE_DIR NAMES portmidi.h PATH_SUFFIXES portmidi - DOC "PortMidi include directory") + DOC "PortMidi include directory" +) mark_as_advanced(PortMidi_INCLUDE_DIR) -find_path(PortTime_INCLUDE_DIR +find_path( + PortTime_INCLUDE_DIR NAMES porttime.h PATH_SUFFIXES portmidi porttime - DOC "PortTime include directory") + DOC "PortTime include directory" +) mark_as_advanced(PortTime_INCLUDE_DIR) -find_library(PortMidi_LIBRARY - NAMES portmidi portmidi_s - DOC "PortMidi library" -) +find_library(PortMidi_LIBRARY NAMES portmidi portmidi_s DOC "PortMidi library") mark_as_advanced(PortMidi_LIBRARY) -find_library(PortTime_LIBRARY - NAMES porttime - DOC "PortTime library" -) +find_library(PortTime_LIBRARY NAMES porttime DOC "PortTime library") mark_as_advanced(PortTime_LIBRARY) if(DEFINED PC_PortMidi_VERSION AND NOT PC_PortMidi_VERSION STREQUAL "") @@ -76,7 +74,8 @@ find_package_handle_standard_args( if(PortMidi_FOUND AND NOT TARGET PortMidi::portmidi) add_library(PortMidi::portmidi UNKNOWN IMPORTED) - set_target_properties(PortMidi::portmidi + set_target_properties( + PortMidi::portmidi PROPERTIES IMPORTED_LOCATION "${PortMidi_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_PortMidi_CFLAGS_OTHER}" @@ -89,7 +88,8 @@ if(PortMidi_FOUND AND NOT TARGET PortMidi::portmidi) if(PortTime_LIBRARY) if(NOT TARGET PortTime::porttime) add_library(PortTime::porttime UNKNOWN IMPORTED) - set_target_properties(PortTime::porttime + set_target_properties( + PortTime::porttime PROPERTIES IMPORTED_LOCATION "${PortTime_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_PortTime_CFLAGS_OTHER}" @@ -104,8 +104,10 @@ if(PortMidi_FOUND AND NOT TARGET PortMidi::portmidi) if(PortMidi_IS_STATIC) find_package(ALSA) if(ALSA_FOUND) - set_property(TARGET PortMidi::portmidi APPEND PROPERTY INTERFACE_LINK_LIBRARIES - ALSA::ALSA + set_property( + TARGET PortMidi::portmidi + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ALSA::ALSA ) endif() endif() diff --git a/cmake/modules/FindShoutidjc.cmake b/cmake/modules/FindShoutidjc.cmake index e38ce17cf6d..391ef9ea664 100644 --- a/cmake/modules/FindShoutidjc.cmake +++ b/cmake/modules/FindShoutidjc.cmake @@ -50,13 +50,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Shoutidjc QUIET shout-idjc) endif() -find_path(Shoutidjc_INCLUDE_DIR +find_path( + Shoutidjc_INCLUDE_DIR NAMES shoutidjc/shout.h HINTS ${PC_Shout_INCLUDE_DIRS} - DOC "Shout include directory") + DOC "Shout include directory" +) mark_as_advanced(Shoutidjc_INCLUDE_DIR) -find_library(Shoutidjc_LIBRARY +find_library( + Shoutidjc_LIBRARY NAMES shout-idjc HINTS ${PC_Shoutidjc_LIBRARY_DIRS} DOC "Shoutidjc library" @@ -82,7 +85,8 @@ if(Shoutidjc_FOUND) if(NOT TARGET Shoutidjc::Shoutidjc) add_library(Shoutidjc::Shoutidjc UNKNOWN IMPORTED) - set_target_properties(Shoutidjc::Shoutidjc + set_target_properties( + Shoutidjc::Shoutidjc PROPERTIES IMPORTED_LOCATION "${Shoutidjc_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Shoutidjc_CFLAGS_OTHER}" diff --git a/cmake/modules/FindSleef.cmake b/cmake/modules/FindSleef.cmake index ea412ae9b5d..26062f09966 100644 --- a/cmake/modules/FindSleef.cmake +++ b/cmake/modules/FindSleef.cmake @@ -50,49 +50,80 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Sleef QUIET sleef) endif() -find_path(Sleef_INCLUDE_DIR +find_path( + Sleef_INCLUDE_DIR NAMES sleef.h PATHS ${PC_sleef_INCLUDE_DIRS} - DOC "Sleef include directory") + DOC "Sleef include directory" +) mark_as_advanced(Sleef_INCLUDE_DIR) -find_library(Sleef_LIBRARY +find_library( + Sleef_LIBRARY NAMES ${PC_Sleef_LIBRARIES} - PATHS ${PC_Sleef_LIBRARY_DIRS}) + PATHS ${PC_Sleef_LIBRARY_DIRS} +) mark_as_advanced(Sleef_LIBRARY) -find_library(SleefDFT_LIBRARY - NAMES sleefdft - PATHS ${PC_Sleef_LIBRARY_DIRS}) +find_library(SleefDFT_LIBRARY NAMES sleefdft PATHS ${PC_Sleef_LIBRARY_DIRS}) mark_as_advanced(SleefDFT_LIBRARY) if(DEFINED PC_Sleef_VERSION AND NOT PC_Sleef_VERSION STREQUAL "") set(Sleef_VERSION "${PC_Sleef_VERSION}") else() - if (EXISTS "${sleef_INCLUDE_DIR}/sleef.h") + if(EXISTS "${sleef_INCLUDE_DIR}/sleef.h") file(READ "$sleef{SLEEF_INCLUDE_DIR}/sleef.h" SLEEF_FIND_HEADER_CONTENTS) set(SLEEF_MAJOR_PREFIX "#define SLEEF_VERSION_MAJOR ") set(SLEEF_MINOR_PREFIX "#define SLEEF_VERSION_MINOR ") set(SLEEF_PATCH_PREFIX "#define SLEEF_VERSION_PATCHLEVEL ") - string(REGEX MATCH "${SLEEF_MAJOR_PREFIX}[0-9]+" - SLEEF_MAJOR_VERSION "${SLEEF_FIND_HEADER_CONTENTS}") - string(REPLACE "${SLEEF_MAJOR_PREFIX}" "" SLEEF_MAJOR_VERSION - "${SLEEF_MAJOR_VERSION}") + string( + REGEX MATCH + "${SLEEF_MAJOR_PREFIX}[0-9]+" + SLEEF_MAJOR_VERSION + "${SLEEF_FIND_HEADER_CONTENTS}" + ) + string( + REPLACE + "${SLEEF_MAJOR_PREFIX}" + "" + SLEEF_MAJOR_VERSION + "${SLEEF_MAJOR_VERSION}" + ) - string(REGEX MATCH "${SLEEF_MINOR_PREFIX}[0-9]+" - SLEEF_MINOR_VERSION "${SLEEF_FIND_HEADER_CONTENTS}") - string(REPLACE "${SLEEF_MINOR_PREFIX}" "" SLEEF_MINOR_VERSION - "${SLEEF_MINOR_VERSION}") + string( + REGEX MATCH + "${SLEEF_MINOR_PREFIX}[0-9]+" + SLEEF_MINOR_VERSION + "${SLEEF_FIND_HEADER_CONTENTS}" + ) + string( + REPLACE + "${SLEEF_MINOR_PREFIX}" + "" + SLEEF_MINOR_VERSION + "${SLEEF_MINOR_VERSION}" + ) - string(REGEX MATCH "${SLEEF_PATCH_PREFIX}[0-9]+" - SLEEF_SUBMINOR_VERSION "${SLEEF_FIND_HEADER_CONTENTS}") - string(REPLACE "${SLEEF_PATCH_PREFIX}" "" SLEEF_SUBMINOR_VERSION - "${SLEEF_SUBMINOR_VERSION}") + string( + REGEX MATCH + "${SLEEF_PATCH_PREFIX}[0-9]+" + SLEEF_SUBMINOR_VERSION + "${SLEEF_FIND_HEADER_CONTENTS}" + ) + string( + REPLACE + "${SLEEF_PATCH_PREFIX}" + "" + SLEEF_SUBMINOR_VERSION + "${SLEEF_SUBMINOR_VERSION}" + ) - set(Sleef_VERSION - "${SLEEF_MAJOR_VERSION}.${SLEEF_MINOR_VERSION}.${SLEEF_SUBMINOR_VERSION}") + set( + Sleef_VERSION + "${SLEEF_MAJOR_VERSION}.${SLEEF_MINOR_VERSION}.${SLEEF_SUBMINOR_VERSION}" + ) endif() endif() @@ -100,7 +131,8 @@ include(FindPackageHandleStandardArgs) find_package_handle_standard_args( Sleef REQUIRED_VARS Sleef_INCLUDE_DIR Sleef_LIBRARY - VERSION_VAR Sleef_VERSION) + VERSION_VAR Sleef_VERSION +) if(Sleef_FOUND) set(Sleef_LIBRARIES "${Sleef_LIBRARY}") @@ -109,7 +141,8 @@ if(Sleef_FOUND) if(SleefDFT_LIBRARY AND NOT TARGET Sleef::sleefdft) add_library(Sleef::sleefdft UNKNOWN IMPORTED) - set_target_properties(Sleef::sleefdft + set_target_properties( + Sleef::sleefdft PROPERTIES IMPORTED_LOCATION "${SleefDFT_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Sleef_CFLAGS_OTHER}" @@ -118,14 +151,18 @@ if(Sleef_FOUND) is_static_library(SleefDFT_IS_STATIC Sleef::sleefdft) if(SleefDFT_IS_STATIC) - set_property(TARGET Sleef::sleefdft APPEND PROPERTY INTERFACE_LINK_LIBRARIES - Sleef::sleef + set_property( + TARGET Sleef::sleefdft + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES Sleef::sleef ) find_package(OpenMP) if(OpenMP_CXX_FOUND) - set_property(TARGET Sleef::sleefdft APPEND PROPERTY INTERFACE_LINK_LIBRARIES - OpenMP::OpenMP_CXX + set_property( + TARGET Sleef::sleefdft + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES OpenMP::OpenMP_CXX ) endif() endif() @@ -133,7 +170,8 @@ if(Sleef_FOUND) if(NOT TARGET Sleef::sleef) add_library(Sleef::sleef UNKNOWN IMPORTED) - set_target_properties(Sleef::sleef + set_target_properties( + Sleef::sleef PROPERTIES IMPORTED_LOCATION "${Sleef_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Sleef_CFLAGS_OTHER}" diff --git a/cmake/modules/FindSndFile.cmake b/cmake/modules/FindSndFile.cmake index 4bf847b8c65..db6037ad2b5 100644 --- a/cmake/modules/FindSndFile.cmake +++ b/cmake/modules/FindSndFile.cmake @@ -50,14 +50,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_SndFile QUIET sndfile) endif() -find_path(SndFile_INCLUDE_DIR +find_path( + SndFile_INCLUDE_DIR NAMES sndfile.h HINTS ${PC_SndFile_INCLUDE_DIRS} PATH_SUFFIXES sndfile - DOC "SndFile include directory") + DOC "SndFile include directory" +) mark_as_advanced(SndFile_INCLUDE_DIR) -find_library(SndFile_LIBRARY +find_library( + SndFile_LIBRARY NAMES sndfile sndfile-1 HINTS ${PC_SndFile_LIBRARY_DIRS} DOC "SndFile library" @@ -75,7 +78,12 @@ find_package_handle_standard_args( VERSION_VAR SndFile_VERSION ) -file(STRINGS "${SndFile_INCLUDE_DIR}/sndfile.h" SndFile_SUPPORTS_SET_COMPRESSION_LEVEL REGEX ".*SFC_SET_COMPRESSION_LEVEL.*") +file( + STRINGS + "${SndFile_INCLUDE_DIR}/sndfile.h" + SndFile_SUPPORTS_SET_COMPRESSION_LEVEL + REGEX ".*SFC_SET_COMPRESSION_LEVEL.*" +) if(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL) set(SndFile_SUPPORTS_SET_COMPRESSION_LEVEL ON) else() @@ -90,7 +98,8 @@ if(SndFile_FOUND) if(NOT TARGET SndFile::sndfile) add_library(SndFile::sndfile UNKNOWN IMPORTED) - set_target_properties(SndFile::sndfile + set_target_properties( + SndFile::sndfile PROPERTIES IMPORTED_LOCATION "${SndFile_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_SndFile_CFLAGS_OTHER}" @@ -100,8 +109,10 @@ if(SndFile_FOUND) if(SndFile_IS_STATIC) find_package(FLAC) if(FLAC_FOUND) - set_property(TARGET SndFile::sndfile APPEND PROPERTY INTERFACE_LINK_LIBRARIES - FLAC::FLAC + set_property( + TARGET SndFile::sndfile + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES FLAC::FLAC ) endif() @@ -109,8 +120,10 @@ if(SndFile_FOUND) if(SndFile_VERSION VERSION_GREATER_EQUAL "1.1.0") find_package(mpg123 CONFIG) if(mpg123_FOUND) - set_property(TARGET SndFile::sndfile APPEND PROPERTY INTERFACE_LINK_LIBRARIES - MPG123::libmpg123 + set_property( + TARGET SndFile::sndfile + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES MPG123::libmpg123 ) endif() endif() diff --git a/cmake/modules/FindSoundTouch.cmake b/cmake/modules/FindSoundTouch.cmake index ce8aca9f490..52e34593a6a 100644 --- a/cmake/modules/FindSoundTouch.cmake +++ b/cmake/modules/FindSoundTouch.cmake @@ -48,13 +48,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_SoundTouch QUIET soundtouch) endif() -find_path(SoundTouch_INCLUDE_DIR +find_path( + SoundTouch_INCLUDE_DIR NAMES soundtouch/SoundTouch.h HINTS ${PC_SoundTouch_INCLUDE_DIRS} - DOC "SoundTouch include directory") + DOC "SoundTouch include directory" +) mark_as_advanced(SoundTouch_INCLUDE_DIR) -find_library(SoundTouch_LIBRARY +find_library( + SoundTouch_LIBRARY NAMES SoundTouch HINTS ${PC_SoundTouch_LIBRARY_DIRS} DOC "SoundTouch library" @@ -66,8 +69,17 @@ if(DEFINED PC_SoundTouch_VERSION AND NOT PC_SoundTouch_VERSION STREQUAL "") set(SoundTouch_VERSION "${PC_SoundTouch_VERSION}") else() if(EXISTS "${SoundTouch_INCLUDE_DIR}/soundtouch/SoundTouch.h") - file(READ "${SoundTouch_INCLUDE_DIR}/soundtouch/SoundTouch.h" SoundTouch_H_CONTENTS) - string(REGEX MATCH "#define SOUNDTOUCH_VERSION[ \t]+\"([0-9]+\.[0-9]+\.[0-9]+)\"" _dummy "${SoundTouch_H_CONTENTS}") + file( + READ + "${SoundTouch_INCLUDE_DIR}/soundtouch/SoundTouch.h" + SoundTouch_H_CONTENTS + ) + string( + REGEX MATCH + "#define SOUNDTOUCH_VERSION[ \t]+\"([0-9]+\.[0-9]+\.[0-9]+)\"" + _dummy + "${SoundTouch_H_CONTENTS}" + ) set(SoundTouch_VERSION "${CMAKE_MATCH_1}") endif() endif() @@ -86,7 +98,8 @@ if(SoundTouch_FOUND) if(NOT TARGET SoundTouch::SoundTouch) add_library(SoundTouch::SoundTouch UNKNOWN IMPORTED) - set_target_properties(SoundTouch::SoundTouch + set_target_properties( + SoundTouch::SoundTouch PROPERTIES IMPORTED_LOCATION "${SoundTouch_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_SoundTouch_CFLAGS_OTHER}" diff --git a/cmake/modules/FindTagLib.cmake b/cmake/modules/FindTagLib.cmake index 42515ac569b..91b331852a6 100644 --- a/cmake/modules/FindTagLib.cmake +++ b/cmake/modules/FindTagLib.cmake @@ -49,19 +49,25 @@ find_package(PkgConfig QUIET) if(PkgConfig_FOUND) if(UNIX AND NOT APPLE) # prioritize the taglib1 package introduced in https://www.archlinux.de/packages/extra/x86_64/taglib1 - set(ENV{PKG_CONFIG_PATH} "/usr/lib/taglib1/pkgconfig/:$ENV{PKG_CONFIG_PATH}") + set( + ENV{PKG_CONFIG_PATH} + "/usr/lib/taglib1/pkgconfig/:$ENV{PKG_CONFIG_PATH}" + ) endif() pkg_check_modules(PC_TagLib QUIET taglib) endif() -find_path(TagLib_INCLUDE_DIR +find_path( + TagLib_INCLUDE_DIR NAMES tag.h HINTS ${PC_TagLib_INCLUDE_DIRS} PATH_SUFFIXES taglib - DOC "TagLib include directory") + DOC "TagLib include directory" +) mark_as_advanced(TagLib_INCLUDE_DIR) -find_library(TagLib_LIBRARY +find_library( + TagLib_LIBRARY NAMES tag HINTS ${PC_TagLib_LIBRARY_DIRS} DOC "TagLib library" @@ -83,19 +89,39 @@ find_package_handle_standard_args( if(DEFINED PC_TagLib_VERSION AND NOT PC_TagLib_VERSION STREQUAL "") set(TagLib_VERSION "${PC_TagLib_VERSION}") else() - if (EXISTS "${TagLib_INCLUDE_DIR}/taglib.h") + if(EXISTS "${TagLib_INCLUDE_DIR}/taglib.h") file(READ "${TagLib_INCLUDE_DIR}/taglib.h" TagLib_H_CONTENTS) - string(REGEX MATCH "#define TAGLIB_MAJOR_VERSION ([0-9]+)" _dummy "${TagLib_H_CONTENTS}") + string( + REGEX MATCH + "#define TAGLIB_MAJOR_VERSION ([0-9]+)" + _dummy + "${TagLib_H_CONTENTS}" + ) set(TagLib_VERSION_MAJOR "${CMAKE_MATCH_1}") - string(REGEX MATCH "#define TAGLIB_MINOR_VERSION ([0-9]+)" _dummy "${TagLib_H_CONTENTS}") + string( + REGEX MATCH + "#define TAGLIB_MINOR_VERSION ([0-9]+)" + _dummy + "${TagLib_H_CONTENTS}" + ) set(TagLib_VERSION_MINOR "${CMAKE_MATCH_1}") - string(REGEX MATCH "#define TAGLIB_PATCH_VERSION ([0-9]+)" _dummy "${TagLib_H_CONTENTS}") + string( + REGEX MATCH + "#define TAGLIB_PATCH_VERSION ([0-9]+)" + _dummy + "${TagLib_H_CONTENTS}" + ) set(TagLib_VERSION_PATCH "${CMAKE_MATCH_1}") # Simply using if(NOT) does not work because 0 is a valid value, so compare to empty string. - if (NOT TagLib_VERSION_MAJOR STREQUAL "" AND - NOT TagLib_VERSION_MINOR STREQUAL "" AND - NOT TagLib_VERSION_PATCH STREQUAL "") - set(TagLib_VERSION "${TagLib_VERSION_MAJOR}.${TagLib_VERSION_MINOR}.${TagLib_VERSION_PATCH}") + if( + NOT TagLib_VERSION_MAJOR STREQUAL "" + AND NOT TagLib_VERSION_MINOR STREQUAL "" + AND NOT TagLib_VERSION_PATCH STREQUAL "" + ) + set( + TagLib_VERSION + "${TagLib_VERSION_MAJOR}.${TagLib_VERSION_MINOR}.${TagLib_VERSION_PATCH}" + ) endif() endif() endif() @@ -114,7 +140,8 @@ if(TagLib_FOUND) if(NOT TARGET TagLib::TagLib) add_library(TagLib::TagLib UNKNOWN IMPORTED) - set_target_properties(TagLib::TagLib + set_target_properties( + TagLib::TagLib PROPERTIES IMPORTED_LOCATION "${TagLib_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_TagLib_CFLAGS_OTHER}" @@ -123,8 +150,10 @@ if(TagLib_FOUND) is_static_library(Taglib_IS_STATIC TagLib::TagLib) if(Taglib_IS_STATIC) if(WIN32) - set_property(TARGET TagLib::TagLib APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS - TAGLIB_STATIC + set_property( + TARGET TagLib::TagLib + APPEND + PROPERTY INTERFACE_COMPILE_DEFINITIONS TAGLIB_STATIC ) endif() endif() diff --git a/cmake/modules/FindUpower.cmake b/cmake/modules/FindUpower.cmake index 909fc452b0d..56fac7dcc25 100644 --- a/cmake/modules/FindUpower.cmake +++ b/cmake/modules/FindUpower.cmake @@ -48,14 +48,17 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_Upower QUIET upower-glib) endif() -find_path(Upower_INCLUDE_DIR +find_path( + Upower_INCLUDE_DIR NAMES upower.h PATH_SUFFIXES upower-glib libupower-glib HINTS ${PC_Upower_INCLUDE_DIRS} - DOC "Upower include directory") + DOC "Upower include directory" +) mark_as_advanced(Upower_INCLUDE_DIR) -find_library(Upower_LIBRARY +find_library( + Upower_LIBRARY NAMES upower-glib HINTS ${PC_Upower_LIBRARY_DIRS} DOC "Upower library" @@ -80,7 +83,8 @@ if(Upower_FOUND) if(NOT TARGET Upower::Upower) add_library(Upower::Upower UNKNOWN IMPORTED) - set_target_properties(Upower::Upower + set_target_properties( + Upower::Upower PROPERTIES IMPORTED_LOCATION "${Upower_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_Upower_CFLAGS_OTHER}" diff --git a/cmake/modules/FindVorbis.cmake b/cmake/modules/FindVorbis.cmake index 59912054e7c..77c5668e5a7 100644 --- a/cmake/modules/FindVorbis.cmake +++ b/cmake/modules/FindVorbis.cmake @@ -45,37 +45,38 @@ The following cache variables may also be set: include(IsStaticLibrary) -find_path(Vorbis_vorbis_INCLUDE_DIR +find_path( + Vorbis_vorbis_INCLUDE_DIR NAMES vorbis/codec.h DOC "Vorbis include directory" ) mark_as_advanced(Vorbis_vorbis_INCLUDE_DIR) -find_path(Vorbis_vorbisenc_INCLUDE_DIR +find_path( + Vorbis_vorbisenc_INCLUDE_DIR NAMES vorbis/vorbisenc.h DOC "Vorbisenc include directory" ) mark_as_advanced(Vorbis_vorbisenc_INCLUDE_DIR) -find_path(Vorbis_vorbisfile_INCLUDE_DIR +find_path( + Vorbis_vorbisfile_INCLUDE_DIR NAMES vorbis/vorbisfile.h DOC "Vorbisfile include directory" ) mark_as_advanced(Vorbis_vorbisfile_INCLUDE_DIR) -find_library(Vorbis_vorbis_LIBRARY - NAMES vorbis - DOC "Vorbis library") +find_library(Vorbis_vorbis_LIBRARY NAMES vorbis DOC "Vorbis library") mark_as_advanced(Vorbis_vorbis_LIBRARY) -find_library(Vorbis_vorbisenc_LIBRARY - NAMES vorbisenc - DOC "Vorbisenc library") +find_library(Vorbis_vorbisenc_LIBRARY NAMES vorbisenc DOC "Vorbisenc library") mark_as_advanced(Vorbis_vorbisenc_LIBRARY) -find_library(Vorbis_vorbisfile_LIBRARY +find_library( + Vorbis_vorbisfile_LIBRARY NAMES vorbisfile - DOC "Vorbisfile library") + DOC "Vorbisfile library" +) mark_as_advanced(Vorbis_vorbisfile_LIBRARY) if(NOT Vorbis_FIND_COMPONENTS) @@ -87,7 +88,8 @@ foreach(component ${Vorbis_FIND_COMPONENTS}) set(Vorbis_${component}_FOUND TRUE) if(NOT TARGET Vorbis::${component}) add_library(Vorbis::${component} UNKNOWN IMPORTED) - set_target_properties(Vorbis::${component} + set_target_properties( + Vorbis::${component} PROPERTIES IMPORTED_LOCATION "${Vorbis_${component}_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${Vorbis_${component}_INCLUDE_DIR}" @@ -99,9 +101,10 @@ foreach(component ${Vorbis_FIND_COMPONENTS}) endforeach() include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Vorbis - REQUIRED_VARS Vorbis_vorbis_INCLUDE_DIR Vorbis_vorbis_LIBRARY - HANDLE_COMPONENTS +find_package_handle_standard_args( + Vorbis + REQUIRED_VARS Vorbis_vorbis_INCLUDE_DIR Vorbis_vorbis_LIBRARY + HANDLE_COMPONENTS ) if(Vorbis_vorbis_FOUND) @@ -109,8 +112,10 @@ if(Vorbis_vorbis_FOUND) if(Vorbis_vorbis_IS_STATIC) find_package(Ogg) if(Ogg_FOUND) - set_property(TARGET Vorbis::vorbis APPEND PROPERTY INTERFACE_LINK_LIBRARIES - Ogg::ogg + set_property( + TARGET Vorbis::vorbis + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES Ogg::ogg ) endif() endif() diff --git a/cmake/modules/Findhidapi.cmake b/cmake/modules/Findhidapi.cmake index 2b178c38c1b..2a6b5b1f854 100644 --- a/cmake/modules/Findhidapi.cmake +++ b/cmake/modules/Findhidapi.cmake @@ -50,14 +50,17 @@ if(PkgConfig_FOUND) pkg_search_module(PC_hidapi QUIET hidapi-libusb hidapi) endif() -find_path(hidapi_INCLUDE_DIR +find_path( + hidapi_INCLUDE_DIR NAMES hidapi.h HINTS ${PC_hidapi_INCLUDE_DIRS} PATH_SUFFIXES hidapi - DOC "hidapi include directory") + DOC "hidapi include directory" +) mark_as_advanced(hidapi_INCLUDE_DIR) -find_library(hidapi_LIBRARY +find_library( + hidapi_LIBRARY NAMES hidapi-libusb hidapi HINTS ${PC_hidapi_LIBRARY_DIRS} DOC "hidapi library" @@ -65,7 +68,8 @@ find_library(hidapi_LIBRARY mark_as_advanced(hidapi_LIBRARY) if(CMAKE_SYSTEM_NAME STREQUAL Linux) - find_library(hidapi-hidraw_LIBRARY + find_library( + hidapi-hidraw_LIBRARY NAMES hidapi-hidraw HINTS ${PC_hidapi_LIBRARY_DIRS} DOC "hidap-hidraw library" @@ -77,21 +81,41 @@ endif() if(DEFINED PC_hidapi_VERSION AND NOT PC_hidapi_VERSION STREQUAL "") set(hidapi_VERSION "${PC_hidapi_VERSION}") else() - if (EXISTS "${hidapi_LIBRARY}" AND EXISTS "${hidapi_INCLUDE_DIR}/hidapi.h") - file(READ "${hidapi_INCLUDE_DIR}/hidapi.h" hidapi_H_CONTENTS) - string(REGEX MATCH "#define HID_API_VERSION_MAJOR ([0-9]+)" _dummy "${hidapi_H_CONTENTS}") - set(hidapi_VERSION_MAJOR "${CMAKE_MATCH_1}") - string(REGEX MATCH "#define HID_API_VERSION_MINOR ([0-9]+)" _dummy "${hidapi_H_CONTENTS}") - set(hidapi_VERSION_MINOR "${CMAKE_MATCH_1}") - string(REGEX MATCH "#define HID_API_VERSION_PATCH ([0-9]+)" _dummy "${hidapi_H_CONTENTS}") - set(hidapi_VERSION_PATCH "${CMAKE_MATCH_1}") - # hidapi_VERSION is only available starting with 0.10.0 - # Simply using if(NOT) does not work because 0 is a valid value, so compare to empty string. - if (NOT hidapi_VERSION_MAJOR STREQUAL "" AND - NOT hidapi_VERSION_MINOR STREQUAL "" AND - NOT hidapi_VERSION_PATCH STREQUAL "") - set(hidapi_VERSION "${hidapi_VERSION_MAJOR}.${hidapi_VERSION_MINOR}.${hidapi_VERSION_PATCH}") - endif() + if(EXISTS "${hidapi_LIBRARY}" AND EXISTS "${hidapi_INCLUDE_DIR}/hidapi.h") + file(READ "${hidapi_INCLUDE_DIR}/hidapi.h" hidapi_H_CONTENTS) + string( + REGEX MATCH + "#define HID_API_VERSION_MAJOR ([0-9]+)" + _dummy + "${hidapi_H_CONTENTS}" + ) + set(hidapi_VERSION_MAJOR "${CMAKE_MATCH_1}") + string( + REGEX MATCH + "#define HID_API_VERSION_MINOR ([0-9]+)" + _dummy + "${hidapi_H_CONTENTS}" + ) + set(hidapi_VERSION_MINOR "${CMAKE_MATCH_1}") + string( + REGEX MATCH + "#define HID_API_VERSION_PATCH ([0-9]+)" + _dummy + "${hidapi_H_CONTENTS}" + ) + set(hidapi_VERSION_PATCH "${CMAKE_MATCH_1}") + # hidapi_VERSION is only available starting with 0.10.0 + # Simply using if(NOT) does not work because 0 is a valid value, so compare to empty string. + if( + NOT hidapi_VERSION_MAJOR STREQUAL "" + AND NOT hidapi_VERSION_MINOR STREQUAL "" + AND NOT hidapi_VERSION_PATCH STREQUAL "" + ) + set( + hidapi_VERSION + "${hidapi_VERSION_MAJOR}.${hidapi_VERSION_MINOR}.${hidapi_VERSION_PATCH}" + ) + endif() endif() endif() @@ -109,34 +133,40 @@ if(hidapi_FOUND) if(NOT TARGET hidapi::hidapi) add_library(hidapi::hidapi UNKNOWN IMPORTED) - set_target_properties(hidapi::hidapi + set_target_properties( + hidapi::hidapi PROPERTIES IMPORTED_LOCATION "${hidapi_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_hidapi_CFLAGS_OTHER}" INTERFACE_INCLUDE_DIRECTORIES "${hidapi_INCLUDE_DIR}" ) - if(CMAKE_SYSTEM_NAME STREQUAL Linux) - add_library(hidapi::hidraw UNKNOWN IMPORTED) - set_target_properties(hidapi::hidraw - PROPERTIES - IMPORTED_LOCATION "${hidapi-hidraw_LIBRARY}" - INTERFACE_COMPILE_OPTIONS "${PC_hidapi_CFLAGS_OTHER}" - INTERFACE_INCLUDE_DIRECTORIES "${hidapi_INCLUDE_DIR}" + if(CMAKE_SYSTEM_NAME STREQUAL Linux) + add_library(hidapi::hidraw UNKNOWN IMPORTED) + set_target_properties( + hidapi::hidraw + PROPERTIES + IMPORTED_LOCATION "${hidapi-hidraw_LIBRARY}" + INTERFACE_COMPILE_OPTIONS "${PC_hidapi_CFLAGS_OTHER}" + INTERFACE_INCLUDE_DIRECTORIES "${hidapi_INCLUDE_DIR}" ) find_package(Libudev) if(Libudev_FOUND) is_static_library(hidapi_IS_STATIC hidapi::hidapi) if(hidapi_IS_STATIC) - set_property(TARGET hidapi::hidapi APPEND PROPERTY INTERFACE_LINK_LIBRARIES - Libudev::Libudev + set_property( + TARGET hidapi::hidapi + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES Libudev::Libudev ) endif() is_static_library(hidapi-hidraw_IS_STATIC hidapi::hidraw) if(hidapi-hidraw_IS_STATIC) - set_property(TARGET hidapi::hidraw APPEND PROPERTY INTERFACE_LINK_LIBRARIES - Libudev::Libudev + set_property( + TARGET hidapi::hidraw + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES Libudev::Libudev ) endif() endif() diff --git a/cmake/modules/Findlilv.cmake b/cmake/modules/Findlilv.cmake index 422e5ae0235..22bb43c965d 100644 --- a/cmake/modules/Findlilv.cmake +++ b/cmake/modules/Findlilv.cmake @@ -50,7 +50,8 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_lilv QUIET lilv-0 lv2) endif() -find_path(lilv_INCLUDE_DIR +find_path( + lilv_INCLUDE_DIR NAMES lilv/lilv.h PATH_SUFFIXES lilv-0 HINTS ${PC_lilv_INCLUDE_DIRS} @@ -58,7 +59,8 @@ find_path(lilv_INCLUDE_DIR ) mark_as_advanced(lilv_INCLUDE_DIR) -find_library(lilv_LIBRARY +find_library( + lilv_LIBRARY NAMES lilv-0 lilv HINTS ${PC_lilv_LIBRARY_DIRS} DOC "lilv library" @@ -83,7 +85,8 @@ if(lilv_FOUND) if(NOT TARGET lilv::lilv) add_library(lilv::lilv UNKNOWN IMPORTED) - set_target_properties(lilv::lilv + set_target_properties( + lilv::lilv PROPERTIES IMPORTED_LOCATION "${lilv_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_lilv_CFLAGS_OTHER}" @@ -92,8 +95,10 @@ if(lilv_FOUND) is_static_library(lilv_IS_STATIC lilv::lilv) if(lilv_IS_STATIC) find_package(sord CONFIG REQUIRED) - set_property(TARGET lilv::lilv APPEND PROPERTY INTERFACE_LINK_LIBRARIES - sord::sord + set_property( + TARGET lilv::lilv + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES sord::sord ) endif() endif() diff --git a/cmake/modules/Findmp3lame.cmake b/cmake/modules/Findmp3lame.cmake index c204fe21d49..bfd616791b8 100644 --- a/cmake/modules/Findmp3lame.cmake +++ b/cmake/modules/Findmp3lame.cmake @@ -41,15 +41,10 @@ The following cache variables may also be set: #]=======================================================================] -find_path(mp3lame_INCLUDE_DIR - NAMES lame/lame.h - DOC "LAME include directory") +find_path(mp3lame_INCLUDE_DIR NAMES lame/lame.h DOC "LAME include directory") mark_as_advanced(mp3lame_INCLUDE_DIR) -find_library(mp3lame_LIBRARY - NAMES mp3lame mp3lame-static - DOC "LAME library" -) +find_library(mp3lame_LIBRARY NAMES mp3lame mp3lame-static DOC "LAME library") mark_as_advanced(mp3lame_LIBRARY) include(FindPackageHandleStandardArgs) @@ -66,7 +61,8 @@ if(mp3lame_FOUND) if(NOT TARGET mp3lame::mp3lame) add_library(mp3lame::mp3lame UNKNOWN IMPORTED) - set_target_properties(mp3lame::mp3lame + set_target_properties( + mp3lame::mp3lame PROPERTIES IMPORTED_LOCATION "${mp3lame_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${mp3lame_INCLUDE_DIR}" diff --git a/cmake/modules/Findrubberband.cmake b/cmake/modules/Findrubberband.cmake index a0c0da2786b..bb6b82280a5 100644 --- a/cmake/modules/Findrubberband.cmake +++ b/cmake/modules/Findrubberband.cmake @@ -48,13 +48,16 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_rubberband QUIET rubberband) endif() -find_path(rubberband_INCLUDE_DIR +find_path( + rubberband_INCLUDE_DIR NAMES rubberband/RubberBandStretcher.h HINTS ${PC_rubberband_INCLUDE_DIRS} - DOC "rubberband include directory") + DOC "rubberband include directory" +) mark_as_advanced(rubberband_INCLUDE_DIR) -find_library(rubberband_LIBRARY +find_library( + rubberband_LIBRARY NAMES rubberband rubberband-library rubberband-dll HINTS ${PC_rubberband_LIBRARY_DIRS} DOC "rubberband library" @@ -79,7 +82,8 @@ if(rubberband_FOUND) if(NOT TARGET rubberband::rubberband) add_library(rubberband::rubberband UNKNOWN IMPORTED) - set_target_properties(rubberband::rubberband + set_target_properties( + rubberband::rubberband PROPERTIES IMPORTED_LOCATION "${rubberband_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_rubberband_CFLAGS_OTHER}" @@ -88,20 +92,25 @@ if(rubberband_FOUND) is_static_library(rubberband_IS_STATIC rubberband::rubberband) if(rubberband_IS_STATIC) find_library(SAMPLERATE_LIBRARY samplerate REQUIRED) - set_property(TARGET rubberband::rubberband APPEND PROPERTY INTERFACE_LINK_LIBRARIES - ${SAMPLERATE_LIBRARY} + set_property( + TARGET rubberband::rubberband + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES ${SAMPLERATE_LIBRARY} ) find_package(FFTW) - if (FFTW_FOUND) - set_property(TARGET rubberband::rubberband APPEND PROPERTY INTERFACE_LINK_LIBRARIES - FFTW::FFTW + if(FFTW_FOUND) + set_property( + TARGET rubberband::rubberband + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES FFTW::FFTW ) endif() find_package(Sleef) - if (Sleef_FOUND) - set_property(TARGET rubberband::rubberband APPEND PROPERTY INTERFACE_LINK_LIBRARIES - Sleef::sleef - Sleef::sleefdft + if(Sleef_FOUND) + set_property( + TARGET rubberband::rubberband + APPEND + PROPERTY INTERFACE_LINK_LIBRARIES Sleef::sleef Sleef::sleefdft ) endif() endif() diff --git a/cmake/modules/Findwavpack.cmake b/cmake/modules/Findwavpack.cmake index 1292ef2551f..ecb928e9681 100644 --- a/cmake/modules/Findwavpack.cmake +++ b/cmake/modules/Findwavpack.cmake @@ -48,14 +48,18 @@ if(PkgConfig_FOUND) pkg_check_modules(PC_wavpack QUIET wavpack) endif() -find_path(wavpack_INCLUDE_DIR +find_path( + wavpack_INCLUDE_DIR NAMES wavpack.h PATH_SUFFIXES wavpack HINTS ${PC_wavpack_INCLUDE_DIRS} - DOC "wavpack include directory") + DOC "wavpack include directory" +) mark_as_advanced(wavpack_INCLUDE_DIR) -find_library(wavpack_LIBRARY NAMES wavpack wv wavpackdll +find_library( + wavpack_LIBRARY + NAMES wavpack wv wavpackdll HINTS ${PC_wavpack_LIBRARY_DIRS} DOC "wavpack library" ) @@ -79,7 +83,8 @@ if(wavpack_FOUND) if(NOT TARGET WavPack::wavpack) add_library(WavPack::wavpack UNKNOWN IMPORTED) - set_target_properties(WavPack::wavpack + set_target_properties( + WavPack::wavpack PROPERTIES IMPORTED_LOCATION "${wavpack_LIBRARY}" INTERFACE_COMPILE_OPTIONS "${PC_wavpack_CFLAGS_OTHER}" diff --git a/cmake/modules/GitInfo.cmake b/cmake/modules/GitInfo.cmake index 0d3729fd052..199b1167b7b 100644 --- a/cmake/modules/GitInfo.cmake +++ b/cmake/modules/GitInfo.cmake @@ -12,7 +12,7 @@ if(NOT GIT_DESCRIBE) else() message(NOTICE "Git describe: ${GIT_DESCRIBE}") string(REGEX MATCH "-modified$" GIT_DIRTY "${GIT_DESCRIBE}") - if (GIT_DIRTY) + if(GIT_DIRTY) message("Git worktree modified: yes") set(GIT_DIRTY 1) else() @@ -34,8 +34,13 @@ if(NOT GIT_DESCRIBE) message(NOTICE "Git branch: ${GIT_BRANCH}") endif() # Get the number of commits since the version tag - string(REGEX MATCH ".*-([0-9]*)-.*" GIT_COMMIT_COUNT_MATCH "${GIT_DESCRIBE}") - if (GIT_COMMIT_COUNT_MATCH) + string( + REGEX MATCH + ".*-([0-9]*)-.*" + GIT_COMMIT_COUNT_MATCH + "${GIT_DESCRIBE}" + ) + if(GIT_COMMIT_COUNT_MATCH) set(GIT_COMMIT_COUNT "${CMAKE_MATCH_1}") message(NOTICE "Git commit count: ${GIT_COMMIT_COUNT}") else() @@ -45,7 +50,10 @@ if(NOT GIT_DESCRIBE) else() message(NOTICE "Git describe: ${GIT_DESCRIBE}") if(NOT GIT_COMMIT_DATE) - message(NOTICE "Git commit date unknown, using current time for GIT_COMMIT_DATE") + message( + NOTICE + "Git commit date unknown, using current time for GIT_COMMIT_DATE" + ) # use current date in case of tar ball builds string(TIMESTAMP GIT_COMMIT_DATE "%Y-%m-%dT%H:%M:%SZ" UTC) endif() @@ -63,7 +71,10 @@ if(NOT GIT_COMMIT_DATE) endif() if(NOT GIT_COMMIT_DATE) - message(NOTICE "Git commit date unknown, using current time for GIT_COMMIT_DATE") + message( + NOTICE + "Git commit date unknown, using current time for GIT_COMMIT_DATE" + ) # use current date in case of tar ball builds string(TIMESTAMP GIT_COMMIT_DATE "%Y-%m-%dT%H:%M:%SZ" UTC) else() diff --git a/packaging/CPackConfig.cmake b/packaging/CPackConfig.cmake index 62c70c79fc4..2ccabc533c5 100644 --- a/packaging/CPackConfig.cmake +++ b/packaging/CPackConfig.cmake @@ -19,8 +19,8 @@ set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-source") # dpkg --compare-versions 2.3~alpha~1234~g8163 lt 2.3~beta~1234~g8163 && echo true # dpkg --compare-versions 2.3~beta~1234~g8163 lt 2.3.0 && echo true # dpkg --compare-versions 2.3.0 lt 2.3.0+2345+g163 && echo true -if (PACKAGE_VERSION MATCHES "^[0-9]+\\.[0-9]+[A-Za-z0-9.+~-]*$") - if (PACKAGE_VERSION MATCHES "(alpha|beta)") +if(PACKAGE_VERSION MATCHES "^[0-9]+\\.[0-9]+[A-Za-z0-9.+~-]*$") + if(PACKAGE_VERSION MATCHES "(alpha|beta)") string(REPLACE "-" "~" CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}") else() string(REPLACE "-" "+" CPACK_DEBIAN_PACKAGE_VERSION "${PACKAGE_VERSION}") @@ -29,16 +29,16 @@ else() string(REPLACE "-" "~" CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_MIXXX_VERSION}") endif() -if (CPACK_GENERATOR STREQUAL "DEB") +if(CPACK_GENERATOR STREQUAL "DEB") set(CPACK_INSTALL_SCRIPT ${CPACK_DEBIAN_INSTALL_SCRIPT}) endif() -if (CPACK_GENERATOR STREQUAL "External") - if (DEB_SOURCEPKG OR DEB_UPLOAD_PPA OR DEB_BUILD) +if(CPACK_GENERATOR STREQUAL "External") + if(DEB_SOURCEPKG OR DEB_UPLOAD_PPA OR DEB_BUILD) set(CPACK_EXTERNAL_ENABLE_STAGING true) set(CPACK_INSTALLED_DIRECTORIES "${CPACK_DEBIAN_SOURCE_DIR};/") set(CPACK_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}") set(CPACK_INSTALL_CMAKE_PROJECTS "") - set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CPACK_DEBIAN_UPLOAD_PPA_SCRIPT}" ) - endif () + set(CPACK_EXTERNAL_PACKAGE_SCRIPT "${CPACK_DEBIAN_UPLOAD_PPA_SCRIPT}") + endif() endif() diff --git a/packaging/CPackDebInstall.cmake b/packaging/CPackDebInstall.cmake index a3198e1dd51..f5fc4d3d838 100644 --- a/packaging/CPackDebInstall.cmake +++ b/packaging/CPackDebInstall.cmake @@ -2,53 +2,65 @@ # The command is # cpack -G DEB -find_program( CPACK_DEBIAN_DEBHELPER dh_prep ) -if( NOT CPACK_DEBIAN_DEBHELPER ) - message( FATAL_ERROR "debhelper not found, required for cpack -G DEB" ) +find_program(CPACK_DEBIAN_DEBHELPER dh_prep) +if(NOT CPACK_DEBIAN_DEBHELPER) + message(FATAL_ERROR "debhelper not found, required for cpack -G DEB") endif() -find_program( CPACK_DEBIAN_MARKDOWN markdown ) -if( NOT CPACK_DEBIAN_MARKDOWN ) - message( FATAL_ERROR "markdown not found, required for cpack -G DEB" ) +find_program(CPACK_DEBIAN_MARKDOWN markdown) +if(NOT CPACK_DEBIAN_MARKDOWN) + message(FATAL_ERROR "markdown not found, required for cpack -G DEB") endif() -find_program( CPACK_DEBIAN_DOCBOOK_TO_MAN docbook-to-man ) -if( NOT CPACK_DEBIAN_DOCBOOK_TO_MAN ) - message( FATAL_ERROR "docbook-to-man not found, required for cpack -G DEB" ) +find_program(CPACK_DEBIAN_DOCBOOK_TO_MAN docbook-to-man) +if(NOT CPACK_DEBIAN_DOCBOOK_TO_MAN) + message(FATAL_ERROR "docbook-to-man not found, required for cpack -G DEB") endif() find_program(CPACK_DEBIAN_DEBCHANGE debchange) if(NOT CPACK_DEBIAN_DEBCHANGE) - message(FATAL_ERROR "debchange not found, required for cpack -G DEB" ) + message(FATAL_ERROR "debchange not found, required for cpack -G DEB") endif() # We create a temporary debian folder that the debhelper below run as usual. # The final debian folder is created independently by cpack -message( NOTICE "Creating temporary debian folder for debhelper" ) -file(COPY ${CPACK_DEBIAN_SOURCE_DIR}/packaging/debian - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) +message(NOTICE "Creating temporary debian folder for debhelper") +file( + COPY ${CPACK_DEBIAN_SOURCE_DIR}/packaging/debian + DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} +) set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS_EXTRA "libavformat-dev, ") -configure_file(${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control - @ONLY) -file(REMOVE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in) +configure_file( + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control + @ONLY +) +file( + REMOVE + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in +) -file(COPY ${CPACK_DEBIAN_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian) -file(RENAME - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev) +file( + COPY ${CPACK_DEBIAN_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules + DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian +) +file( + RENAME + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev +) execute_process( - COMMAND ${CPACK_DEBIAN_DOCBOOK_TO_MAN} debian/mixxx.sgml - OUTPUT_FILE mixxx.1 - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} + COMMAND ${CPACK_DEBIAN_DOCBOOK_TO_MAN} debian/mixxx.sgml + OUTPUT_FILE mixxx.1 + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} ) execute_process( - COMMAND ${CPACK_DEBIAN_MARKDOWN} ${CPACK_DEBIAN_SOURCE_DIR}/CHANGELOG.md - OUTPUT_FILE NEWS.html - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian + COMMAND ${CPACK_DEBIAN_MARKDOWN} ${CPACK_DEBIAN_SOURCE_DIR}/CHANGELOG.md + OUTPUT_FILE NEWS.html + WORKING_DIRECTORY + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian ) if(DEB_BUILD) @@ -59,18 +71,31 @@ if(DEB_BUILD) ) endif() -execute_process(COMMAND ${CPACK_DEBIAN_DEBCHANGE} -v "${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}" -M "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) -execute_process(COMMAND ${CPACK_DEBIAN_DEBCHANGE} -r -M "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) +execute_process( + COMMAND + ${CPACK_DEBIAN_DEBCHANGE} -v + "${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}" -M + "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} +) +execute_process( + COMMAND + ${CPACK_DEBIAN_DEBCHANGE} -r -M "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} +) -function(run_dh DH_COMMAND) - execute_process(COMMAND ${DH_COMMAND} ${ARGV1} ${ARGV2} -P. - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} - RESULT_VARIABLE CPACK_DEBIAN_DH_RET) - if(NOT CPACK_DEBIAN_DH_RET EQUAL "0") - message(FATAL_ERROR "${DH_COMMAND} returned exit code ${CPACK_DEBIAN_DH_RET}") - endif() +function(run_dh dh_command) + execute_process( + COMMAND ${dh_command} ${ARGV1} ${ARGV2} -P. + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} + RESULT_VARIABLE CPACK_DEBIAN_DH_RET + ) + if(NOT CPACK_DEBIAN_DH_RET EQUAL "0") + message( + FATAL_ERROR + "${dh_command} returned exit code ${CPACK_DEBIAN_DH_RET}" + ) + endif() endfunction() # We don't need root, normally read as Rules-Requires-Root from debian/control @@ -84,5 +109,8 @@ run_dh(dh_installman) run_dh(dh_installudev --name=mixxx-usb-uaccess --priority=69) # Remove temporary files only needed by debhelpers -file (REMOVE_RECURSE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian) -file (REMOVE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/mixxx.1) +file( + REMOVE_RECURSE + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian +) +file(REMOVE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/mixxx.1) diff --git a/packaging/CPackDebUploadPPA.cmake b/packaging/CPackDebUploadPPA.cmake index 69af8e187a4..0648486779c 100644 --- a/packaging/CPackDebUploadPPA.cmake +++ b/packaging/CPackDebUploadPPA.cmake @@ -6,64 +6,95 @@ find_program(CPACK_DEBIAN_DEBUILD debuild) if(NOT CPACK_DEBIAN_DEBUILD) - message(FATAL_ERROR "debuild not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" ) + message( + FATAL_ERROR + "debuild not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" + ) endif() if(DEB_UPLOAD_PPA) find_program(CPACK_DEBIAN_DPUT dput) if(NOT CPACK_DEBIAN_DPUT) - message(FATAL_ERROR "dput not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" ) + message( + FATAL_ERROR + "dput not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" + ) endif() endif() find_program(CPACK_DEBIAN_DEBCHANGE debchange) if(NOT CPACK_DEBIAN_DEBCHANGE) - message(FATAL_ERROR "debchange not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" ) + message( + FATAL_ERROR + "debchange not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" + ) endif() find_program(CPACK_DEBIAN_MARKDOWN markdown) if(NOT CPACK_DEBIAN_MARKDOWN) - message(FATAL_ERROR "markdown not found, required for cpack -G External -D DEB_UPLOAD_PPA=true") + message( + FATAL_ERROR + "markdown not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" + ) endif() find_program(CPACK_DEBIAN_DOCBOOK_TO_MAN docbook-to-man) if(NOT CPACK_DEBIAN_DOCBOOK_TO_MAN) - message(FATAL_ERROR "docbook-to-man not found, required for cpack -G External -D DEB_UPLOAD_PPA=true") + message( + FATAL_ERROR + "docbook-to-man not found, required for cpack -G External -D DEB_UPLOAD_PPA=true" + ) endif() # PR branches have no access to the pgp key. Don't sign. find_program(CPACK_DEBIAN_GPG gpg) if(CPACK_DEBIAN_GPG) - execute_process(COMMAND ${CPACK_DEBIAN_GPG} --fingerprint "${CPACK_PACKAGE_CONTACT}" - RESULT_VARIABLE CPACK_DEBIAN_GPG_RET) + execute_process( + COMMAND ${CPACK_DEBIAN_GPG} --fingerprint "${CPACK_PACKAGE_CONTACT}" + RESULT_VARIABLE CPACK_DEBIAN_GPG_RET + ) endif() if(NOT CPACK_DEBIAN_GPG_RET EQUAL "0") - message(WARNING "No secret key found for \"${CPACK_PACKAGE_CONTACT}\", skip signing" ) - SET(CPACK_DEBIAN_DEBUILD_NOSIGN "--no-sign") + message( + WARNING + "No secret key found for \"${CPACK_PACKAGE_CONTACT}\", skip signing" + ) + set(CPACK_DEBIAN_DEBUILD_NOSIGN "--no-sign") endif() message(NOTICE "Creating mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}.orig.tar.gz") execute_process( - COMMAND tar -czf "mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}.orig.tar.gz" ${CPACK_PACKAGE_FILE_NAME} + COMMAND + tar -czf "mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}.orig.tar.gz" + ${CPACK_PACKAGE_FILE_NAME} WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY} ) # Save Git info from original working tree to allow building without git # uses GIT_BRANCH GIT_DESCRIBE GIT_COMMIT_DATE GIT_COMMIT_YEAR GIT_COMMIT_COUNT GIT_DIRTY configure_file( - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/src/gitinfo.h.in - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/src/gitinfo.h.in - @ONLY) + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/src/gitinfo.h.in + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/src/gitinfo.h.in + @ONLY +) -message( NOTICE "Creating debian folder" ) -file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/debian - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) -file(REMOVE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in) +message(NOTICE "Creating debian folder") +file( + COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/debian + DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} +) +file( + REMOVE + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in +) execute_process( - COMMAND ${CPACK_DEBIAN_MARKDOWN} ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/CHANGELOG.md + COMMAND + ${CPACK_DEBIAN_MARKDOWN} + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/CHANGELOG.md OUTPUT_FILE NEWS.html - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian + WORKING_DIRECTORY + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian ) execute_process( @@ -72,11 +103,16 @@ execute_process( WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} ) -file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/res/linux/mixxx-usb-uaccess.rules - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian) -file(RENAME - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev) +file( + COPY + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/res/linux/mixxx-usb-uaccess.rules + DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian +) +file( + RENAME + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev +) if(DEB_BUILD) execute_process( @@ -86,48 +122,72 @@ if(DEB_BUILD) ) endif() -foreach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) - - if (RELEASE STREQUAL "bionic") +foreach(release ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) + if(release STREQUAL "bionic") set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS_EXTRA "libmp4v2-dev,") else() set(CPACK_DEBIAN_PACKAGE_BUILD_DEPENDS_EXTRA "libavformat-dev,") endif() - configure_file(${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/debian/control.in - ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control - @ONLY) - - file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/debian/changelog - DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian) - execute_process(COMMAND ${CPACK_DEBIAN_DEBCHANGE} -v "${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}~${RELEASE}" -M "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) - execute_process(COMMAND ${CPACK_DEBIAN_DEBCHANGE} -r -D ${RELEASE} -M "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) - - if (DEB_UPLOAD_PPA OR DEB_SOURCEPKG) - execute_process(COMMAND ${CPACK_DEBIAN_DEBUILD} -S -sa -d ${CPACK_DEBIAN_DEBUILD_NOSIGN} - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} - RESULT_VARIABLE CPACK_DEBIAN_DEBUILD_RET) + configure_file( + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/debian/control.in + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control + @ONLY + ) + + file( + COPY + ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/debian/changelog + DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian + ) + execute_process( + COMMAND + ${CPACK_DEBIAN_DEBCHANGE} -v + "${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}~${release}" + -M "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} + ) + execute_process( + COMMAND + ${CPACK_DEBIAN_DEBCHANGE} -r -D ${release} -M + "Build of ${CPACK_DEBIAN_PACKAGE_VERSION}" + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} + ) + + if(DEB_UPLOAD_PPA OR DEB_SOURCEPKG) + execute_process( + COMMAND ${CPACK_DEBIAN_DEBUILD} -S -sa -d ${CPACK_DEBIAN_DEBUILD_NOSIGN} + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} + RESULT_VARIABLE CPACK_DEBIAN_DEBUILD_RET + ) if(NOT CPACK_DEBIAN_DEBUILD_RET EQUAL "0") - message(FATAL_ERROR "${CPACK_DEBIAN_DEBUILD} returned exit code ${CPACK_DEBIAN_DEBUILD_RET}") + message( + FATAL_ERROR + "${CPACK_DEBIAN_DEBUILD} returned exit code ${CPACK_DEBIAN_DEBUILD_RET}" + ) endif() endif() - if (BUILD_MACHINE_RELEASE STREQUAL RELEASE AND DEB_BUILD) - execute_process(COMMAND ${CPACK_DEBIAN_DEBUILD} -b ${CPACK_DEBIAN_DEBUILD_NOSIGN} - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}) + if(BUILD_MACHINE_RELEASE STREQUAL release AND DEB_BUILD) + execute_process( + COMMAND ${CPACK_DEBIAN_DEBUILD} -b ${CPACK_DEBIAN_DEBUILD_NOSIGN} + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME} + ) endif() if(DEB_UPLOAD_PPA) - execute_process(COMMAND ${CPACK_DEBIAN_DPUT} ${DEB_UPLOAD_PPA} "mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}~${RELEASE}_source.changes" - WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}) + execute_process( + COMMAND + ${CPACK_DEBIAN_DPUT} ${DEB_UPLOAD_PPA} + "mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}~${release}_source.changes" + WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY} + ) endif() - -endforeach(RELEASE ${CPACK_DEBIAN_DISTRIBUTION_RELEASES}) +endforeach() if(DEB_SOURCEPKG OR DEB_BUILD) - file(GLOB ARTIFACTS - "${CPACK_TOPLEVEL_DIRECTORY}/mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}*" - "${CPACK_TOPLEVEL_DIRECTORY}/mixxx-dbgsym_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}*") - file(COPY ${ARTIFACTS} - DESTINATION ${CPACK_PACKAGE_DIRECTORY}) + file( + GLOB ARTIFACTS + "${CPACK_TOPLEVEL_DIRECTORY}/mixxx_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}*" + "${CPACK_TOPLEVEL_DIRECTORY}/mixxx-dbgsym_${CPACK_DEBIAN_PACKAGE_VERSION}-${CPACK_DEBIAN_PACKAGE_RELEASE}*" + ) + file(COPY ${ARTIFACTS} DESTINATION ${CPACK_PACKAGE_DIRECTORY}) endif() diff --git a/src/proto/CMakeLists.txt b/src/proto/CMakeLists.txt index 4f2995e685a..cfa00ccef52 100644 --- a/src/proto/CMakeLists.txt +++ b/src/proto/CMakeLists.txt @@ -10,11 +10,14 @@ endif() add_library(mixxx-proto OBJECT) if(TARGET protobuf::libprotobuf-lite) - target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf-lite) + target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf-lite) elseif(TARGET protobuf::libprotobuf) - target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf) + target_link_libraries(mixxx-proto PUBLIC protobuf::libprotobuf) else() - message(FATAL_ERROR "Protobuf or Protobuf-lite libraries are required to compile Mixxx.") + message( + FATAL_ERROR + "Protobuf or Protobuf-lite libraries are required to compile Mixxx." + ) endif() if(EMSCRIPTEN)