Changeset View
Changeset View
Standalone View
Standalone View
CMakeLists.txt
Show First 20 Lines • Show All 258 Lines • ▼ Show 20 Line(s) | |||||
259 | include(ECMAddAppIcon) | 259 | include(ECMAddAppIcon) | ||
260 | include(ECMSetupVersion) | 260 | include(ECMSetupVersion) | ||
261 | include(ECMMarkNonGuiExecutable) | 261 | include(ECMMarkNonGuiExecutable) | ||
262 | include(ECMGenerateHeaders) | 262 | include(ECMGenerateHeaders) | ||
263 | include(GenerateExportHeader) | 263 | include(GenerateExportHeader) | ||
264 | include(ECMMarkAsTest) | 264 | include(ECMMarkAsTest) | ||
265 | include(ECMInstallIcons) | 265 | include(ECMInstallIcons) | ||
266 | 266 | | |||
267 | include(CMakeDependentOption) | ||||
267 | include(CMakePackageConfigHelpers) | 268 | include(CMakePackageConfigHelpers) | ||
268 | include(WriteBasicConfigVersionFile) | 269 | include(WriteBasicConfigVersionFile) | ||
269 | include(CheckFunctionExists) | 270 | include(CheckFunctionExists) | ||
270 | 271 | | |||
271 | include(KDEInstallDirs) | 272 | include(KDEInstallDirs) | ||
272 | include(KDECMakeSettings) | 273 | include(KDECMakeSettings) | ||
273 | include(KDECompilerSettings) | 274 | include(KDECompilerSettings) | ||
274 | 275 | | |||
▲ Show 20 Lines • Show All 126 Lines • ▼ Show 20 Line(s) | |||||
401 | # | 402 | # | ||
402 | # The reason for this mode is that the Debug mode disable inlining | 403 | # The reason for this mode is that the Debug mode disable inlining | ||
403 | # | 404 | # | ||
404 | if(CMAKE_COMPILER_IS_GNUCXX) | 405 | if(CMAKE_COMPILER_IS_GNUCXX) | ||
405 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals") | 406 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fext-numeric-literals") | ||
406 | endif() | 407 | endif() | ||
407 | 408 | | |||
408 | option(KRITA_DEVS "For Krita developers. This modifies the DEBUG build type to use -O3 -g, while still enabling Q_ASSERT. This is necessary because the Qt5 cmake modules normally append QT_NO_DEBUG to any build type that is not labeled Debug") | 409 | option(KRITA_DEVS "For Krita developers. This modifies the DEBUG build type to use -O3 -g, while still enabling Q_ASSERT. This is necessary because the Qt5 cmake modules normally append QT_NO_DEBUG to any build type that is not labeled Debug") | ||
410 | CMAKE_DEPENDENT_OPTION(KRITA_DEVS_SANITIZER "Activate ASAN memory sanitizer for the build (available only with KRITA_DEVS)" ON | ||||
411 | "KRITA_DEVS" OFF) | ||||
412 | | ||||
409 | if (KRITA_DEVS) | 413 | if (KRITA_DEVS) | ||
414 | if (NOT KRITA_DEVS_SANITIZER) | ||||
410 | set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g" CACHE STRING "" FORCE) | 415 | set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g " CACHE STRING "" FORCE) | ||
416 | else() | ||||
417 | set(CMAKE_CXX_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE) | ||||
418 | set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE) | ||||
419 | set(CMAKE_MODULE_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE) | ||||
420 | set(CMAKE_C_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE) | ||||
421 | set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE) | ||||
422 | set(CMAKE_STATIC_LINKER_FLAGS_DEBUG "-O3 -g -fsanitize=address -lasan -fno-omit-frame-pointer" CACHE STRING "" FORCE) | ||||
423 | endif() | ||||
411 | endif() | 424 | endif() | ||
412 | 425 | | |||
413 | if(UNIX) | 426 | if(UNIX) | ||
414 | set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m") | 427 | set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m") | ||
415 | endif() | 428 | endif() | ||
416 | 429 | | |||
417 | if(WIN32) | 430 | if(WIN32) | ||
418 | if(MSVC) | 431 | if(MSVC) | ||
419 | # C4522: 'class' : multiple assignment operators specified | 432 | # C4522: 'class' : multiple assignment operators specified | ||
420 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4522") | 433 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4522") | ||
421 | endif() | 434 | endif() | ||
422 | endif() | 435 | endif() | ||
423 | 436 | | |||
424 | # KDECompilerSettings adds the `--export-all-symbols` linker flag. | 437 | # KDECompilerSettings adds the `--export-all-symbols` linker flag. | ||
425 | # We don't really need it. | 438 | # We don't really need it. | ||
426 | if(MINGW) | 439 | if(MINGW) | ||
427 | string(REPLACE "-Wl,--export-all-symbols" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") | 440 | string(REPLACE "-Wl,--export-all-symbols" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") | ||
428 | string(REPLACE "-Wl,--export-all-symbols" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") | 441 | string(REPLACE "-Wl,--export-all-symbols" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") | ||
429 | endif(MINGW) | 442 | endif(MINGW) | ||
430 | 443 | | |||
444 | if (KRITA_DEVS_SANITIZER) | ||||
445 | string(REPLACE "-Wl,--no-undefined" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}") | ||||
446 | string(REPLACE "-Wl,--no-undefined" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}") | ||||
447 | endif() | ||||
448 | | ||||
431 | # enable exceptions globally | 449 | # enable exceptions globally | ||
432 | kde_enable_exceptions() | 450 | kde_enable_exceptions() | ||
433 | 451 | | |||
434 | set(KRITA_DEFAULT_TEST_DATA_DIR ${CMAKE_SOURCE_DIR}/sdk/tests/data/) | 452 | set(KRITA_DEFAULT_TEST_DATA_DIR ${CMAKE_SOURCE_DIR}/sdk/tests/data/) | ||
435 | macro(macro_add_unittest_definitions) | 453 | macro(macro_add_unittest_definitions) | ||
436 | add_definitions(-DFILES_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/") | 454 | add_definitions(-DFILES_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data/") | ||
437 | add_definitions(-DFILES_OUTPUT_DIR="${CMAKE_CURRENT_BINARY_DIR}") | 455 | add_definitions(-DFILES_OUTPUT_DIR="${CMAKE_CURRENT_BINARY_DIR}") | ||
438 | add_definitions(-DFILES_DEFAULT_DATA_DIR="${KRITA_DEFAULT_TEST_DATA_DIR}") | 456 | add_definitions(-DFILES_DEFAULT_DATA_DIR="${KRITA_DEFAULT_TEST_DATA_DIR}") | ||
▲ Show 20 Lines • Show All 311 Lines • Show Last 20 Lines |