diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-03-16 17:41:07 +0100 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2020-03-16 17:41:07 +0100 |
commit | cb82a4d97d8aa29be817164ecee94844a37051b8 (patch) | |
tree | 3ce31541b8367c261b57177e8883fd332391a8fb /CMakeLists.txt | |
parent | 9ada84a329dc5c772dda2c897908e0694fac2b44 (diff) | |
parent | e16b6a63b28eab4d3c3ce919ed661a91d7fc664d (diff) |
Merge branch 'master' into basetracktablemodel
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 61 |
1 files changed, 43 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c5e73dfe2..c40e6ab00d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,10 +13,39 @@ if(POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() +# CMAKE_CXX_COMPILER_ID: Distinguish between "AppleClang" and "Clang" +if(POLICY CMP0025) + cmake_policy(SET CMP0025 NEW) +endif() +set(CMAKE_POLICY_WARNING_CMP0025 ON) + +####################################################################### +# Compilers and toolchains + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + # GNU is GNU GCC + set(GNU_GCC true) +else() + set(GNU_GCC false) +endif() + +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # using regular Clang or AppleClang + set(LLVM_CLANG true) +else() + set(LLVM_CLANG false) +endif() + +# CMake implicitly sets the variable MSVC to true for Microsoft +# Visual C++ or another compiler simulating Visual C++. +# https://cmake.org/cmake/help/latest/variable/MSVC.html + +####################################################################### + set(CMAKE_CXX_STANDARD 17) # Speed up builds on HDDs -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # GNU is GNU GCC +if(GNU_GCC) add_compile_options(-pipe) endif() @@ -106,8 +135,7 @@ else() endif() cmake_dependent_option(CCACHE_SUPPORT "Enable ccache support" ON "CCACHE_EXECUTABLE" OFF) if(CCACHE_SUPPORT) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC - OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + 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=auto") endif() @@ -131,13 +159,6 @@ if(CMAKE_VERSION VERSION_LESS "3.7.0") set(CMAKE_INCLUDE_CURRENT_DIR ON) endif() -if(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") - # using regular Clang or AppleClang - set(CLANG ON) -else() - set(CLANG OFF) -endif() - # Mixxx itself add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/analyzer/analyzerbeats.cpp @@ -167,7 +188,8 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/control/controlproxy.cpp src/control/controlpushbutton.cpp src/control/controlttrotary.cpp - src/controllers/colorjsproxy.cpp + src/controllers/colormapper.cpp + src/controllers/colormapperjsproxy.cpp src/controllers/controller.cpp src/controllers/controllerdebug.cpp src/controllers/controllerengine.cpp @@ -313,7 +335,6 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/errordialoghandler.cpp src/library/analysisfeature.cpp src/library/analysislibrarytablemodel.cpp - src/library/trackloader.cpp src/library/autodj/autodjfeature.cpp src/library/autodj/autodjprocessor.cpp src/library/autodj/dlgautodj.cpp @@ -412,6 +433,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/library/tableitemdelegate.cpp src/library/trackcollection.cpp src/library/trackcollectionmanager.cpp + src/library/trackloader.cpp src/library/traktor/traktorfeature.cpp src/library/treeitem.cpp src/library/treeitemmodel.cpp @@ -478,6 +500,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/preferences/dialog/dlgprefwaveformdlg.ui src/preferences/dlgpreferencepage.cpp src/preferences/effectsettingsmodel.cpp + src/preferences/colorpalettesettings.cpp src/preferences/replaygainsettings.cpp src/preferences/settingsmanager.cpp src/preferences/upgrade.cpp @@ -540,7 +563,7 @@ add_library(mixxx-lib STATIC EXCLUDE_FROM_ALL src/util/cache.cpp src/util/cmdlineargs.cpp src/util/color/color.cpp - src/util/color/predefinedcolor.cpp + src/util/color/colorpalette.cpp src/util/console.cpp src/util/db/dbconnection.cpp src/util/db/dbconnectionpool.cpp @@ -708,8 +731,7 @@ if(UNIX AND NOT APPLE) endif() # Disable warnings in generated source files -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" # GNU is GNU GCC - OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") +if(GNU_GCC OR LLVM_CLANG) set_property( SOURCE src/library/rekordbox/rekordbox_anlz.cpp APPEND_STRING @@ -928,6 +950,9 @@ add_executable(mixxx-test src/test/broadcastsettings_test.cpp src/test/cache_test.cpp src/test/channelhandle_test.cpp + src/test/colorconfig_test.cpp + src/test/colormapperjsproxy_test.cpp + src/test/colorpalette_test.cpp src/test/compatibility_test.cpp src/test/configobject_test.cpp src/test/controller_preset_validation_test.cpp @@ -1591,7 +1616,7 @@ endif() # Clang Color Diagnostics option(CLANG_COLORDIAG "Clang color diagnostics" OFF) if(CLANG_COLORDIAG) - if(NOT CLANG) + if(NOT LLVM_CLANG) message(FATAL_ERROR "Color Diagnostics are only available when using Clang.") endif() target_compile_options(mixxx-lib PUBLIC -fcolor-diagnostics) @@ -1612,7 +1637,7 @@ if(CLANG_TSAN) list(APPEND CLANG_SANITIZERS "thread") endif() if(NOT CLANG_SANITIZERS STREQUAL "") - if(NOT CLANG) + if(NOT LLVM_CLANG) message(FATAL_ERROR "Clang Sanitizers are only available when using Clang.") endif() list(JOIN CLANG_SANITIZERS "," CLANG_SANITZERS_JOINED) @@ -2045,7 +2070,7 @@ if(NOT OPTIMIZE STREQUAL "off") else() message(FATAL_ERROR "Invalid value passed to OPTIMIZE option: ${OPTIMIZE}") endif() - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + elseif(GNU_GCC) # Common flags to all optimizations. # -ffast-math will prevent a performance penalty by denormals # (floating point values almost Zero are treated as Zero) |