diff --git a/.gitignore b/.gitignore index c39a631c2..1d9da5722 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ # Common build directories used in the source tree /build +/build-* /.build + # Temporary files *~ \#*\# diff --git a/INSTALL b/INSTALL index 3060da905..7b61e14f9 100644 --- a/INSTALL +++ b/INSTALL @@ -51,7 +51,7 @@ Installation -DSC_BUILD_SCHEMAS=ALL - Added to make use of ctest easier. If SC_BUILD_SCHEMAS == ALL, then CMake adds each *.exp file found in data/. - -DSC_BUILD_TYPE=Release + -DCMAKE_BUILD_TYPE=Release - this causes binaries to be built without debugging information - without this, cmake defaults to a Debug build diff --git a/cmake/SC_CXX_schema_macros.cmake b/cmake/SC_CXX_schema_macros.cmake index eab9174a7..54e252c80 100644 --- a/cmake/SC_CXX_schema_macros.cmake +++ b/cmake/SC_CXX_schema_macros.cmake @@ -92,9 +92,9 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles) ${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/cllazyfile ${SC_SOURCE_DIR}/src/cllazyfile/judy/src ) - # if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation + # Schema libraries should be installed by default if(BUILD_SHARED_LIBS) - SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils TESTABLE) + SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils) add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME}) if(WIN32) target_compile_definitions("${PROJECT_NAME}" PRIVATE SC_SCHEMA_DLL_EXPORTS) @@ -110,8 +110,8 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles) endif() endif() - if($CACHE{SC_BUILD_STATIC_LIBS}) - SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static TESTABLE) + if(BUILD_STATIC_LIBS) + SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static) add_dependencies(${PROJECT_NAME}-static generate_cpp_${PROJECT_NAME}) target_compile_definitions("${PROJECT_NAME}-static" PRIVATE SC_STATIC) if(MSVC) diff --git a/ctest_matrix.cmake b/ctest_matrix.cmake index d2288acb5..d052e38aa 100644 --- a/ctest_matrix.cmake +++ b/ctest_matrix.cmake @@ -9,7 +9,7 @@ set(CTEST_INITIAL_CACHE " SITE:STRING=${CTEST_SITE} BUILDNAME:STRING=${CTEST_BUILD_NAME} SC_ENABLE_TESTING:BOOL=ON -SC_BUILD_TYPE:STRING=Debug +CMAKE_BUILD_TYPE:STRING=Debug ") diff --git a/example/ap203min/CMakeLists.txt b/example/ap203min/CMakeLists.txt index 5aea13a4b..4f3682dd1 100644 --- a/example/ap203min/CMakeLists.txt +++ b/example/ap203min/CMakeLists.txt @@ -31,7 +31,6 @@ set(SC_IS_SUBBUILD TRUE) if(NOT DEFINED CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug) endif(NOT DEFINED CMAKE_BUILD_TYPE) -set(SC_BUILD_TYPE ${CMAKE_BUILD_TYPE}) # Path to STEPcode set(STEPCODE_BUILD_DIR ${CMAKE_BINARY_DIR}/sc CACHE PATH "STEPcode build subdir") diff --git a/example/ap203min/ExternalProjectBuild/cmake/External_STEPCode.cmake b/example/ap203min/ExternalProjectBuild/cmake/External_STEPCode.cmake index 96fca295b..08a5e306f 100644 --- a/example/ap203min/ExternalProjectBuild/cmake/External_STEPCode.cmake +++ b/example/ap203min/ExternalProjectBuild/cmake/External_STEPCode.cmake @@ -4,9 +4,9 @@ ExternalProject_Add( STEPCODE -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS} - -DSC_BUILD_TYPE=Debug + -DCMAKE_BUILD_TYPE=Debug -DSC_BUILD_SCHEMAS=ap203/ap203.exp - -DSC_BUILD_STATIC_LIBS=ON + -DBUILD_STATIC_LIBS=ON -DSC_PYTHON_GENERATOR=OFF -DSC_INSTALL_PREFIX:PATH= ) diff --git a/lcov.cmake b/lcov.cmake index 4ca1388db..74adc1576 100644 --- a/lcov.cmake +++ b/lcov.cmake @@ -15,7 +15,7 @@ BUILDNAME:STRING=${CTEST_BUILD_NAME} SC_ENABLE_TESTING:BOOL=ON SC_ENABLE_COVERAGE:BOOL=ON SC_BUILD_SCHEMAS:STRING=ALL -SC_BUILD_TYPE:STRING=Debug +CMAKE_BUILD_TYPE:STRING=Debug ") set(LCOV_OUT "${CTEST_BINARY_DIRECTORY}/lcov_html") diff --git a/run_ctest.cmake b/run_ctest.cmake index 7533d7c17..a8d833789 100644 --- a/run_ctest.cmake +++ b/run_ctest.cmake @@ -9,7 +9,7 @@ set(CTEST_INITIAL_CACHE " SITE:STRING=${CTEST_SITE} BUILDNAME:STRING=${CTEST_BUILD_NAME} SC_ENABLE_TESTING:BOOL=ON -SC_BUILD_TYPE:STRING=Debug +CMAKE_BUILD_TYPE:STRING=Debug ") diff --git a/src/exp2cxx/CMakeLists.txt b/src/exp2cxx/CMakeLists.txt index 6ccebb17a..d8fae04cc 100644 --- a/src/exp2cxx/CMakeLists.txt +++ b/src/exp2cxx/CMakeLists.txt @@ -38,7 +38,11 @@ include_directories( ${SC_SOURCE_DIR}/include/express ) -SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp express) +if(BUILD_SHARED_LIBS) + SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp express) +else() + SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp-static express-static) +endif() if(SC_ENABLE_TESTING) add_subdirectory(test) diff --git a/src/exp2python/CMakeLists.txt b/src/exp2python/CMakeLists.txt index 60ced2d77..1395e75a6 100644 --- a/src/exp2python/CMakeLists.txt +++ b/src/exp2python/CMakeLists.txt @@ -28,7 +28,11 @@ if(SC_PYTHON_GENERATOR) ../exp2cxx/write.cc ../exp2cxx/print.cc ) - SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express) + if(BUILD_SHARED_LIBS) + SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express) + else() + SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express-static) + endif() endif(SC_PYTHON_GENERATOR) diff --git a/src/exppp/CMakeLists.txt b/src/exppp/CMakeLists.txt index e58090a1b..7b8d87c51 100644 --- a/src/exppp/CMakeLists.txt +++ b/src/exppp/CMakeLists.txt @@ -42,7 +42,11 @@ if(BUILD_STATIC_LIBS) set_target_properties(libexppp-static PROPERTIES PREFIX "") endif() -SC_ADDEXEC(exppp SOURCES ${EXPPP_SOURCES} LINK_LIBRARIES libexppp express) +if(BUILD_SHARED_LIBS) + SC_ADDEXEC(exppp SOURCES ${EXPPP_SOURCES} LINK_LIBRARIES libexppp express) +else() + SC_ADDEXEC(exppp SOURCES ${EXPPP_SOURCES} LINK_LIBRARIES libexppp-static express-static) +endif() if(SC_ENABLE_TESTING) add_subdirectory(test)