diff options
author | FormerLurker <hochgebe@gmail.com> | 2021-01-18 21:35:20 +0300 |
---|---|---|
committer | FormerLurker <hochgebe@gmail.com> | 2021-01-18 21:35:20 +0300 |
commit | 3af9af2cdc778bbb7f481177cf3c840e6d9d1ee2 (patch) | |
tree | 1a1e4648c5d7a9321d7766ea265aceabe16a8198 | |
parent | b35d6aa16d9dae8350a36ac0256bf68a1ac51cef (diff) |
Simplify cmake
-rw-r--r-- | ArcWelder/CMakeLists.txt | 13 | ||||
-rw-r--r-- | ArcWelderConsole/CMakeLists.txt | 14 | ||||
-rw-r--r-- | ArcWelderInverseProcessor/CMakeLists.txt | 14 | ||||
-rw-r--r-- | CMakeLists.txt | 23 | ||||
-rw-r--r-- | GcodeProcessorLib/CMakeLists.txt | 15 | ||||
-rw-r--r-- | PyArcWelder/CMakeLists.txt | 12 | ||||
-rw-r--r-- | TCLAP/CMakeLists.txt | 6 |
7 files changed, 15 insertions, 82 deletions
diff --git a/ArcWelder/CMakeLists.txt b/ArcWelder/CMakeLists.txt index 3a8dd33..738983c 100644 --- a/ArcWelder/CMakeLists.txt +++ b/ArcWelder/CMakeLists.txt @@ -1,13 +1,5 @@ -cmake_minimum_required (VERSION "3.13") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - project(ArcWelder C CXX) -option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON) - # add definitions from the GcodeProcessorLib project add_definitions(${GcodeProcessorLib_DEFINITIONS}) @@ -21,11 +13,6 @@ include(sourcelist.cmake) # Add a library using our ArcWelderSources variable from our sourcelist file add_library(${PROJECT_NAME} STATIC ${ArcWelderSources}) -if(MSVC) - # link to the msvc runtime statically, keeping debug info if we are in debug config - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") -endif() - install( TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib diff --git a/ArcWelderConsole/CMakeLists.txt b/ArcWelderConsole/CMakeLists.txt index 8ccebcb..5ef3591 100644 --- a/ArcWelderConsole/CMakeLists.txt +++ b/ArcWelderConsole/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required (VERSION "3.13") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - project(ArcWelderConsole C CXX) # add definitions from the GcodeProcessorLib and ArcWelder libraries add_definitions(${GcodeProcessorLib_DEFINITIONS} ${ArcWelder_DEFINITIONS}) -add_definitions("-DHAS_GENERATED_VERSION") +#add_definitions("-DHAS_GENERATED_VERSION") # Include the GcodeProcessorLib and ArcWelder's directories include_directories(${GcodeProcessorLib_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} ${TCLAP_INCLUDE_DIRS}) @@ -17,17 +11,11 @@ include_directories(${GcodeProcessorLib_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} # ArcWelderConsoleSources variable include(sourcelist.cmake) -if(MSVC) - # link to the msvc runtime statically, keeping debug info if we are in debug config - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") -endif() - # Add an executable our ArcWelderConsoleSources variable from our sourcelist file add_executable(${PROJECT_NAME} ${ArcWelderConsoleSources}) # change the executable name to ArcWelder or ArcWelder.exe set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "ArcWelder") - install( TARGETS ${PROJECT_NAME} DESTINATION bin diff --git a/ArcWelderInverseProcessor/CMakeLists.txt b/ArcWelderInverseProcessor/CMakeLists.txt index 6d04eee..8a9de2c 100644 --- a/ArcWelderInverseProcessor/CMakeLists.txt +++ b/ArcWelderInverseProcessor/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required (VERSION "3.13") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - project(ArcWelderInverseProcessor C CXX) # add definitions from the GcodeProcessorLib and ArcWelder libraries add_definitions(${GcodeProcessorLib_DEFINITIONS} ${ArcWelder_DEFINITIONS}) -add_definitions("-DHAS_GENERATED_VERSION") +#add_definitions("-DHAS_GENERATED_VERSION") # Include the GcodeProcessorLib and ArcWelder's directories include_directories(${GcodeProcessorLib_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} ${TCLAP_INCLUDE_DIRS}) @@ -17,12 +11,6 @@ include_directories(${GcodeProcessorLib_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} # ArcWelderConsoleSources variable include(sourcelist.cmake) - -if(MSVC) - # link to the msvc runtime statically, keeping debug info if we are in debug config - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") -endif() - # Add an executable our ArcWelderConsoleSources variable from our sourcelist file add_executable( ${PROJECT_NAME} diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c4bce6..0d4303c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,10 @@ -cmake_minimum_required (VERSION "3.13") +cmake_minimum_required (VERSION "3.15") set(CMAKE_VERBOSE_MAKEFILE ON) -# You can tweak some common (for all subprojects) stuff here. For example: +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release) +endif() + project(Build C CXX) # Use and require C++ 11 @@ -13,18 +16,19 @@ set(CMAKE_DISABLE_SOURCE_CHANGES ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON) -# Add -O0 to remove optimizations when using gcc -IF(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") -ENDIF(CMAKE_COMPILER_IS_GNUCC) - - if(MSVC) + add_compile_options("$<$<CONFIG:RELEASE>:/O2>") # link to the msvc runtime statically, keeping debug info if we are in debug config set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") +else() + add_compile_options("$<$<CONFIG:RELEASE>:-O2>") + #if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + # add_compile_options("-stdlib=libc++") + #else() + #endif() endif() + # add a definition so our libraries know that the version info is available add_definitions("-DHAS_GENERATED_VERSION") # include the generated header. @@ -52,7 +56,6 @@ add_subdirectory(${CMAKE_SOURCE_DIR}/TCLAP) add_subdirectory(${CMAKE_SOURCE_DIR}/GcodeProcessorLib) add_subdirectory(${CMAKE_SOURCE_DIR}/ArcWelder) add_subdirectory(${CMAKE_SOURCE_DIR}/ArcWelderConsole) -#include(${CMAKE_CURRENT_SOURCE_DIR}/ArcWelderConsole/CMakeLists.txt) add_subdirectory(${CMAKE_SOURCE_DIR}/ArcWelderInverseProcessor) add_subdirectory(${CMAKE_SOURCE_DIR}/PyArcWelder) diff --git a/GcodeProcessorLib/CMakeLists.txt b/GcodeProcessorLib/CMakeLists.txt index 4f64c4e..4c178b8 100644 --- a/GcodeProcessorLib/CMakeLists.txt +++ b/GcodeProcessorLib/CMakeLists.txt @@ -1,12 +1,5 @@ -cmake_minimum_required (VERSION "3.13") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - project(GcodeProcessorLib C CXX) - # create a version information header - version.h # First get the current branch and store to GIT_BRANCH variable execute_process( @@ -59,21 +52,13 @@ include_directories("${CMAKE_BINARY_DIR}/GcodeProcessorLib/generated/") file(COPY "${CMAKE_BINARY_DIR}/GcodeProcessorLib/generated/version.generated.h" DESTINATION "${PROJECT_SOURCE_DIR}/deploy") file(RENAME "${PROJECT_SOURCE_DIR}/deploy/version.generated.h" "${PROJECT_SOURCE_DIR}/deploy/version.h") -option(USE_CXX_EXCEPTIONS "Enable C++ exception support" ON) - # include sourcelist.cmake, which contains our source list and exposes it as the # GcodeProcessorLibSources variable include(sourcelist.cmake) -if(MSVC) - # link to the msvc runtime statically, keeping debug info if we are in debug config - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") -endif() - # Add a library using our GcodeProcessorLibSources variable from our sourcelist file add_library(${PROJECT_NAME} STATIC ${GcodeProcessorLibSources}) - install( TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION lib diff --git a/PyArcWelder/CMakeLists.txt b/PyArcWelder/CMakeLists.txt index e0f6147..3d17456 100644 --- a/PyArcWelder/CMakeLists.txt +++ b/PyArcWelder/CMakeLists.txt @@ -1,9 +1,3 @@ -cmake_minimum_required (VERSION "3.13") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - project(PyArcWelder C CXX) # PythonLibs is required to build a python extension @@ -19,12 +13,6 @@ include_directories(${PYTHON_INCLUDE_DIRS} ${ArcWelder_INCLUDE_DIRS} ${GcodeProc # PyArcWelderSources variable include(sourcelist.cmake) - -if(MSVC) - # link to the msvc runtime statically, keeping debug info if we are in debug config - set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") -endif() - # Create our library add_library(${PROJECT_NAME} SHARED ${PyArcWelderSources}) diff --git a/TCLAP/CMakeLists.txt b/TCLAP/CMakeLists.txt index b331b9f..118c870 100644 --- a/TCLAP/CMakeLists.txt +++ b/TCLAP/CMakeLists.txt @@ -1,9 +1,3 @@ -cmake_minimum_required (VERSION "3.13") - -if(NOT CMAKE_BUILD_TYPE) - set(CMAKE_BUILD_TYPE Release) -endif() - project(TCLAP C CXX) # Add a library using our ArcWelderSources variable from our sourcelist file |