Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions cmake/SC_CXX_schema_macros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,29 @@ endmacro(P21_TESTS sfile)
# create p21read_sdai_*, lazy_sdai_*, any exes listed in SC_SDAI_ADDITIONAL_EXES_SRCS
macro(SCHEMA_EXES)
RELATIVE_PATH_TO_TOPLEVEL(${CMAKE_CURRENT_SOURCE_DIR} RELATIVE_PATH_COMPONENT)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc;${RELATIVE_PATH_COMPONENT}/src/test/p21read/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
if(BUILD_SHARED_LIBS)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc;${RELATIVE_PATH_COMPONENT}/src/test/p21read/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
elseif(BUILD_STATIC_LIBS)
SC_ADDEXEC(p21read_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/test/p21read/p21read.cc;${RELATIVE_PATH_COMPONENT}/src/test/p21read/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME}-static stepeditor-static stepcore-static stepdai-static steputils-static TESTABLE)
endif()
if(NOT WIN32)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc;${RELATIVE_PATH_COMPONENT}/src/cllazyfile/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils TESTABLE)
if(BUILD_SHARED_LIBS)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc;${RELATIVE_PATH_COMPONENT}/src/cllazyfile/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME} steplazyfile stepdai stepcore stepeditor steputils TESTABLE)
elseif(BUILD_STATIC_LIBS)
SC_ADDEXEC(lazy_${PROJECT_NAME} SOURCES "${RELATIVE_PATH_COMPONENT}/src/cllazyfile/lazy_test.cc;${RELATIVE_PATH_COMPONENT}/src/cllazyfile/sc_benchmark.cc" LINK_LIBRARIES ${PROJECT_NAME}-static steplazyfile-static stepeditor-static stepcore-static stepdai-static steputils-static TESTABLE)
endif()
endif(NOT WIN32)

#add user-defined executables
foreach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
get_filename_component(name ${src} NAME_WE)
get_filename_component(path ${src} ABSOLUTE)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
if(BUILD_SHARED_LIBS)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME} stepdai stepcore stepeditor steputils TESTABLE)
elseif(BUILD_STATIC_LIBS)
SC_ADDEXEC(${name}_${PROJECT_NAME} SOURCES ${src} LINK_LIBRARIES ${PROJECT_NAME}-static stepcore-static stepdai-static stepeditor-static steputils-static TESTABLE)
#set_target_properties(${name}_${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "${${PROJECT_NAME}_COMPILE_FLAGS} -I${path}")
endif()
endforeach(src ${SC_SDAI_ADDITIONAL_EXES_SRCS})
ENDMACRO(SCHEMA_EXES)

Expand Down Expand Up @@ -111,7 +123,7 @@ macro(SCHEMA_TARGETS expFile schemaName sourceFiles)
endif()

if(BUILD_STATIC_LIBS)
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepdai-static stepcore-static stepeditor-static steputils-static)
SC_ADDLIB(${PROJECT_NAME}-static STATIC SOURCES ${sourceFiles} LINK_LIBRARIES stepcore-static stepdai-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)
Expand Down
21 changes: 13 additions & 8 deletions cmake/SC_Targets.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ macro(SC_ADDEXEC execname)

add_executable(${execname} ${${_arg_prefix}_SOURCES})

if(BUILD_STATIC_LIBS)
target_compile_definitions(${execname} PRIVATE SC_STATIC)
endif()

if(DEFINED "${_arg_prefix}_LINK_LIBRARIES")
foreach(_lib ${${_arg_prefix}_LINK_LIBRARIES})
if($CACHE{SC_STATIC_UTILS})
if(NOT $<TARGET_PROPERTY:${_lib},TYPE> STREQUAL "STATIC_LIBRARY")
get_property(_lib_type TARGET ${_lib} PROPERTY TYPE)
if(NOT _lib_type STREQUAL "STATIC_LIBRARY")
message(SEND_ERROR "SC_ADDEXEC usage error - expected STATIC LINK_LIBRARIES targets (${_lib})")
endif()
endif()
target_link_libraries(${execname} ${_lib})
endforeach()
target_link_libraries(${execname} PRIVATE ${${_arg_prefix}_LINK_LIBRARIES})
endif()

if(NOT ${_arg_prefix}_NO_INSTALL AND NOT ${_arg_prefix}_TESTABLE)
Expand All @@ -37,7 +42,7 @@ endmacro()
macro(SC_ADDLIB _addlib_target)
set(_addlib_opts SHARED STATIC NO_INSTALL TESTABLE)
set(_addlib_multikw SOURCES LINK_LIBRARIES)
string(TOUPPER "SC_ADDLIB_${libname}_ARG" _arg_prefix)
string(TOUPPER "SC_ADDLIB_${_addlib_target}_ARG" _arg_prefix)
cmake_parse_arguments(${_arg_prefix} "${_addlib_opts}" "" "${_addlib_multikw}" ${ARGN})

if(NOT DEFINED ${_arg_prefix}_SOURCES)
Expand All @@ -64,20 +69,20 @@ macro(SC_ADDLIB _addlib_target)
if(DEFINED ${_arg_prefix}_LINK_LIBRARIES)
foreach(_lib ${${_arg_prefix}_LINK_LIBRARIES})
if(${_arg_prefix}_STATIC AND TARGET ${_lib})
get_property(_libtype TARGET ${_lib} PROPERTY TYPE)
if(NOT ${_libtype} STREQUAL "STATIC_LIBRARY")
message(SEND_ERROR "SC_ADDLIB usage error - expected (static) LINK_LIBRARIES targets (${_lib})")
get_property(_libtype TARGET ${_lib} PROPERTY TYPE)
if(NOT ${_libtype} STREQUAL "STATIC_LIBRARY")
message(SEND_ERROR "SC_ADDLIB usage error - expected (static) LINK_LIBRARIES targets (${_lib})")
endif()
endif()
target_link_libraries(${_addlib_target} ${_lib})
endforeach()
target_link_libraries(${_addlib_target} ${_lib})
endif()

if(NOT ${_arg_prefix}_NO_INSTALL AND NOT ${_arg_prefix}_TESTABLE)
install(TARGETS ${_addlib_target}
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR}
)
endif()
endmacro()
Expand Down
2 changes: 1 addition & 1 deletion src/cleditor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if(BUILD_SHARED_LIBS)
endif()

if(BUILD_STATIC_LIBS)
SC_ADDLIB(stepeditor-static STATIC SOURCES ${EDITOR_SRCS} LINK_LIBRARIES stepcore-static stepdai-static steputils-static)
SC_ADDLIB(stepeditor-static STATIC SOURCES ${EDITOR_SRCS} LINK_LIBRARIES steputils-static stepdai-static stepcore-static)
endif()

# Local Variables:
Expand Down
11 changes: 8 additions & 3 deletions src/cllazyfile/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,27 @@ include_directories(
${CMAKE_SOURCE_DIR}/include/stepcode
)

set(_libdeps stepcore stepdai steputils stepeditor)


if(BUILD_SHARED_LIBS)
set(_libdeps stepcore stepdai steputils stepeditor)
SC_ADDLIB(steplazyfile SHARED SOURCES ${LAZY_SRCS} LINK_LIBRARIES ${_libdeps})
if(WIN32)
target_compile_definitions(steplazyfile PRIVATE SC_LAZYFILE_DLL_EXPORTS)
endif()
SC_ADDEXEC(lazy_test SOURCES "lazy_test.cc;sc_benchmark.cc" LINK_LIBRARIES steplazyfile stepeditor ${_libdeps} NO_INSTALL)
target_compile_definitions(lazy_test PRIVATE NO_REGISTRY)
endif()

if(BUILD_STATIC_LIBS)
set(_libdeps stepcore-static stepdai-static steputils-static stepeditor-static)
SC_ADDLIB(steplazyfile-static STATIC SOURCES ${LAZY_SRCS} LINK_LIBRARIES ${_libdeps})
if(NOT BUILD_SHARED_LIBS)
SC_ADDEXEC(lazy_test SOURCES "lazy_test.cc;sc_benchmark.cc" LINK_LIBRARIES steplazyfile-static stepeditor-static ${_libdeps} NO_INSTALL)
target_compile_definitions(lazy_test PRIVATE NO_REGISTRY)
endif()
endif()

SC_ADDEXEC(lazy_test SOURCES "lazy_test.cc;sc_benchmark.cc" LINK_LIBRARIES steplazyfile stepeditor NO_INSTALL)
target_compile_definitions(lazy_test PRIVATE NO_REGISTRY)

# Local Variables:
# tab-width: 8
Expand Down
6 changes: 3 additions & 3 deletions src/clstepcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ include_directories(
${CMAKE_SOURCE_DIR}/include/stepcode
)

set(_libdeps steputils stepdai)

if(BUILD_SHARED_LIBS)
set(_libdeps steputils stepdai)
SC_ADDLIB(stepcore SHARED SOURCES ${CORE_SRCS} LINK_LIBRARIES ${_libdeps})
if(WIN32)
target_compile_definitions(stepcore PRIVATE SC_CORE_DLL_EXPORTS)
endif()
endif()

if(BUILD_STATIC_LIBS)
SC_ADDLIB(stepcore-static STATIC SOURCES ${CORE_SRCS} LINK_LIBRARIES $<JOIN:${_libdeps},-static>-static)
set(_libdeps steputils-static stepdai-static)
SC_ADDLIB(stepcore-static STATIC SOURCES ${CORE_SRCS} LINK_LIBRARIES ${_libdeps})
endif()

if(SC_ENABLE_TESTING)
Expand Down
1 change: 1 addition & 0 deletions src/express/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ if(BUILD_SHARED_LIBS OR NOT BUILD_STATIC_LIBS)
target_link_libraries(check-express express)
else()
target_link_libraries(check-express express-static)
target_compile_definitions(check-express PRIVATE SC_STATIC)
endif()
install(TARGETS check-express
RUNTIME DESTINATION ${BIN_DIR}
Expand Down