Skip to content

Commit 74b6fe4

Browse files
authored
Merge pull request #469 from starseeker/cmaketweaks
Complete CMake variable migration, fix schema library installation
2 parents e79c15d + aa595c9 commit 74b6fe4

File tree

11 files changed

+27
-14
lines changed

11 files changed

+27
-14
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# Common build directories used in the source tree
22
/build
3+
/build-*
34
/.build
45

6+
57
# Temporary files
68
*~
79
\#*\#

INSTALL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Installation
5151
-DSC_BUILD_SCHEMAS=ALL
5252
- Added to make use of ctest easier. If SC_BUILD_SCHEMAS == ALL,
5353
then CMake adds each *.exp file found in data/.
54-
-DSC_BUILD_TYPE=Release
54+
-DCMAKE_BUILD_TYPE=Release
5555
- this causes binaries to be built without debugging information
5656
- without this, cmake defaults to a Debug build
5757

cmake/SC_CXX_schema_macros.cmake

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
9292
${SC_SOURCE_DIR}/src/clutils ${SC_SOURCE_DIR}/src/clstepcore ${SC_SOURCE_DIR}/src/cllazyfile
9393
${SC_SOURCE_DIR}/src/cllazyfile/judy/src
9494
)
95-
# if testing is enabled, "TESTABLE" sets property EXCLUDE_FROM_ALL and prevents installation
95+
# Schema libraries should be installed by default
9696
if(BUILD_SHARED_LIBS)
97-
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils TESTABLE)
97+
SC_ADDLIB(${PROJECT_NAME} SHARED SOURCES ${sourceFiles} LINK_LIBRARIES stepdai stepcore stepeditor steputils)
9898
add_dependencies(${PROJECT_NAME} generate_cpp_${PROJECT_NAME})
9999
if(WIN32)
100100
target_compile_definitions("${PROJECT_NAME}" PRIVATE SC_SCHEMA_DLL_EXPORTS)
@@ -110,8 +110,8 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
110110
endif()
111111
endif()
112112
113-
if($CACHE{SC_BUILD_STATIC_LIBS})
114-
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static TESTABLE)
113+
if(BUILD_STATIC_LIBS)
114+
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static)
115115
add_dependencies(${PROJECT_NAME}-static generate_cpp_${PROJECT_NAME})
116116
target_compile_definitions("${PROJECT_NAME}-static" PRIVATE SC_STATIC)
117117
if(MSVC)

ctest_matrix.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CTEST_INITIAL_CACHE "
99
SITE:STRING=${CTEST_SITE}
1010
BUILDNAME:STRING=${CTEST_BUILD_NAME}
1111
SC_ENABLE_TESTING:BOOL=ON
12-
SC_BUILD_TYPE:STRING=Debug
12+
CMAKE_BUILD_TYPE:STRING=Debug
1313
")
1414

1515

example/ap203min/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ set(SC_IS_SUBBUILD TRUE)
3131
if(NOT DEFINED CMAKE_BUILD_TYPE)
3232
set(CMAKE_BUILD_TYPE Debug)
3333
endif(NOT DEFINED CMAKE_BUILD_TYPE)
34-
set(SC_BUILD_TYPE ${CMAKE_BUILD_TYPE})
3534

3635
# Path to STEPcode
3736
set(STEPCODE_BUILD_DIR ${CMAKE_BINARY_DIR}/sc CACHE PATH "STEPcode build subdir")

example/ap203min/ExternalProjectBuild/cmake/External_STEPCode.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ ExternalProject_Add( STEPCODE
44
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
55
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
66
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
7-
-DSC_BUILD_TYPE=Debug
7+
-DCMAKE_BUILD_TYPE=Debug
88
-DSC_BUILD_SCHEMAS=ap203/ap203.exp
9-
-DSC_BUILD_STATIC_LIBS=ON
9+
-DBUILD_STATIC_LIBS=ON
1010
-DSC_PYTHON_GENERATOR=OFF
1111
-DSC_INSTALL_PREFIX:PATH=<INSTALL_DIR>
1212
)

lcov.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ BUILDNAME:STRING=${CTEST_BUILD_NAME}
1515
SC_ENABLE_TESTING:BOOL=ON
1616
SC_ENABLE_COVERAGE:BOOL=ON
1717
SC_BUILD_SCHEMAS:STRING=ALL
18-
SC_BUILD_TYPE:STRING=Debug
18+
CMAKE_BUILD_TYPE:STRING=Debug
1919
")
2020

2121
set(LCOV_OUT "${CTEST_BINARY_DIRECTORY}/lcov_html")

run_ctest.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(CTEST_INITIAL_CACHE "
99
SITE:STRING=${CTEST_SITE}
1010
BUILDNAME:STRING=${CTEST_BUILD_NAME}
1111
SC_ENABLE_TESTING:BOOL=ON
12-
SC_BUILD_TYPE:STRING=Debug
12+
CMAKE_BUILD_TYPE:STRING=Debug
1313
")
1414

1515

src/exp2cxx/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,11 @@ include_directories(
3838
${SC_SOURCE_DIR}/include/express
3939
)
4040

41-
SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp express)
41+
if(BUILD_SHARED_LIBS)
42+
SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp express)
43+
else()
44+
SC_ADDEXEC(exp2cxx SOURCES ${exp2cxx_SOURCES} LINK_LIBRARIES libexppp-static express-static)
45+
endif()
4246

4347
if(SC_ENABLE_TESTING)
4448
add_subdirectory(test)

src/exp2python/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ if(SC_PYTHON_GENERATOR)
2828
../exp2cxx/write.cc
2929
../exp2cxx/print.cc
3030
)
31-
SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express)
31+
if(BUILD_SHARED_LIBS)
32+
SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express)
33+
else()
34+
SC_ADDEXEC(exp2python SOURCES ${exp2python_SOURCES} LINK_LIBRARIES express-static)
35+
endif()
3236

3337
endif(SC_PYTHON_GENERATOR)
3438

0 commit comments

Comments
 (0)