diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dadb19..950e988 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,6 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}") ############################# OPTIONS SECTION ########################## -option(ENABLE_FULL_DEBUG "Build with all possible debug [default: OFF]" OFF) option(ENABLE_ALSA "Enable ALSA mixer backend [default: AUTO]" OFF) option(ENABLE_OSS "Enable OSSv3 mixer backend [default: AUTO]" OFF) @@ -115,6 +114,7 @@ endif() # Plugins specific. if (ENABLE_ALSA) + message(STATUS "Plugin: ALSA") find_package(ALSA REQUIRED) if (ALSA_FOUND) add_definitions(-DHAVE_ALSA) @@ -124,6 +124,7 @@ if (ENABLE_ALSA) endif() if (ENABLE_OSS) + message(STATUS "Plugin: OSS") find_package(OSS REQUIRED) if (OSS_FOUND) add_definitions(-DHAVE_OSS) @@ -138,24 +139,54 @@ endif() try_c_flag(PIPE "-pipe") try_c_flag(NO_DEL_NULL_PTR_CHKS "-fno-delete-null-pointer-checks") -# Process with warn flags. -if (NOT CMAKE_C_OPT_FLAGS AND ENABLE_FULL_DEBUG) + +if (CMAKE_BUILD_TYPE MATCHES "Debug") + # Process with warn flags. try_c_flag(W "-W") try_c_flag(WALL "-Wall") - try_c_flag(WPOINTER "-Wpointer-arith") - try_c_flag(WPARAM "-Wno-unused-parameter") - try_c_flag(WFUNCTION "-Wno-unused-function") - try_c_flag(WUNUSED_VAR "-Wno-unused-variable") - try_c_flag(WPOINTER_SIGN "-Wno-pointer-sign") - try_c_flag(WSIGN_COMPARE "-Wno-sign-compare") - try_c_flag(WSTRICT_PROTOTYPES "-Wstrict-prototypes") - try_c_flag(PEDANTIC "-pedantic") - try_c_flag(WNO_UNUSED_CONST "-Wno-unused-const-variable") - try_c_flag(WNULL_DEREFERENCE "-Wnull-dereference") - try_c_flag(WDUPLICATED_COND "-Wduplicated-cond") - try_c_flag(WIMPLICIT_FALLTHROUGH "-Wimplicit-fallthrough") + try_c_flag(WEVERYTHING "-Weverything") + if (NOT C_FLAG_WEVERYTHING) + try_c_flag(WPOINTER "-Wpointer-arith") + try_c_flag(WSTRICT_PROTOTYPES "-Wstrict-prototypes") + try_c_flag(PEDANTIC "-pedantic") + try_c_flag(WNULL_DEREFERENCE "-Wnull-dereference") + try_c_flag(WDUPLICATED_COND "-Wduplicated-cond") + try_c_flag(WIMPLICIT_FALLTHROUGH "-Wimplicit-fallthrough") + endif() + + try_c_flag(WCAST_FN_TYPE_STRICT "-Wno-cast-function-type-strict") + try_c_flag(WCAST_QUAL "-Wno-cast-qual") + try_c_flag(WDOCUMENTATION "-Wno-documentation") + try_c_flag(WDOC_UNKNOWN_CMD "-Wno-documentation-unknown-command") + try_c_flag(WPADDED "-Wno-padded") + #try_c_flag(WPOINTER_SIGN "-Wno-pointer-sign") + #try_c_flag(WRESERVED_ID_MACRO "-Wno-reserved-id-macro") + try_c_flag(WRESERVED_IDENTIFIER "-Wno-reserved-identifier") + #try_c_flag(WSIGN_COMPARE "-Wno-sign-compare") + try_c_flag(WSWITCH_ENUM "-Wno-switch-enum") + #try_c_flag(WUNUSED_CONST "-Wno-unused-const-variable") + #try_c_flag(WUNUSED_FUNCTION "-Wno-unused-function") + #try_c_flag(WUNUSED_PARAM "-Wno-unused-parameter") + #try_c_flag(WUNUSED_VAR "-Wno-unused-variable") + try_c_flag(WUNSAFE_BUFFER_USAGE "-Wno-unsafe-buffer-usage") + #try_c_flag(WVARIADIC_MACROS "-Wno-variadic-macros") + #try_c_flag(WGNU_ZERO_VAR_MACRO_ARGS "-Wno-gnu-zero-variadic-macro-arguments") + try_c_flag(WZERO_LENGTH_ARRAY "-Wno-zero-length-array") + + set(CMAKE_INSTALL_DO_STRIP FALSE) + set(CMAKE_C_OPT_FLAGS "-g3 -ggdb -O0") + message(STATUS "Adding -DDEBUG to definitions.") + add_definitions(-DDEBUG) +else() + set(CMAKE_INSTALL_DO_STRIP TRUE) + message(STATUS "Adding -DNDEBUG to definitions.") + add_definitions(-DNDEBUG) endif() +message(STATUS "Building in ${CMAKE_BUILD_TYPE} mode.") +message(STATUS "CMAKE_INSTALL_DO_STRIP is ${CMAKE_INSTALL_DO_STRIP}.") + + if (NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro) try_c_flag(STD11 "-std=c11") if (NOT C_FLAG_STD11) @@ -183,20 +214,11 @@ try_linker_flag(ZNOW "-Wl,-z,now") try_linker_flag(ZNOEXECSTACK "-Wl,-z,noexecstack") -# Optimization flags -if (NOT CMAKE_C_OPT_FLAGS) - if (ENABLE_FULL_DEBUG) - set(CMAKE_C_OPT_FLAGS "-g -O0 -fstrict-aliasing") - else() - set(CMAKE_C_OPT_FLAGS "-g -O2 -fstrict-aliasing") - endif() -endif() - # Check platform API. chk_function_exists(reallocarray) -set(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS}") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_OPT_FLAGS}") # Silently strip whitespace string(STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS) string(STRIP "${CMAKE_EXE_LINKER_FLAGS}" CMAKE_EXE_LINKER_FLAGS) diff --git a/gtk-mixer.project b/gtk-mixer.project index d764734..dd1d7e9 100644 --- a/gtk-mixer.project +++ b/gtk-mixer.project @@ -40,11 +40,11 @@ - + - - + + @@ -55,15 +55,25 @@ - - - - + + mkdir $(ProjectPath)/$(ConfigurationName) && +cd $(ProjectPath)/$(ConfigurationName) && +cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=true -DENABLE_ALSA=true .. + + rm -rf $(ProjectPath)/$(ConfigurationName) && +mkdir $(ProjectPath)/$(ConfigurationName) && +cd $(ProjectPath)/$(ConfigurationName) && +cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_VERBOSE_MAKEFILE=true -DENABLE_ALSA=true .. && +make -C $(ProjectPath)/$(ConfigurationName) -j`getconf NPROCESSORS_ONLN` + + rm -rf $(ProjectPath)/$(ConfigurationName) + make -C $(ProjectPath)/$(ConfigurationName) -j`getconf NPROCESSORS_ONLN` + None - + $(WorkspacePath) @@ -82,7 +92,7 @@ - + @@ -95,13 +105,14 @@ + mkdir $(ProjectPath)/$(ConfigurationName) && +cd $(ProjectPath)/$(ConfigurationName) && +cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=true .. + + - rm -rf build - mkdir build && -cd build && -cmake -D CMAKE_VERBOSE_MAKEFILE=true .. && -cmake --build . -- -j`getconf NPROCESSORS_ONLN` - + rm -rf $(ProjectPath)/$(ConfigurationName) + make -C $(ProjectPath)/$(ConfigurationName) -j`getconf NPROCESSORS_ONLN`