# # CMakeLists.txt - CMake configuration file for swmm-solver/library # # Created: Jul 11, 2019 # Updated: Dec 1, 2021 # # Author: Michael E. Tryby # US EPA ORD/CESER # if(APPLE) set( CMAKE_PREFIX_PATH ../../deps/openmp-16.0.0-Darwin/ ) endif() find_package( OpenMP COMPONENTS C REQUIRED ) # configure file groups set(SWMM_PUBLIC_HEADERS include/swmm5.h ) file(GLOB SWMM_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.c *.h ) if(BUILD_DEF) # Build library with def file interface for backward compatibility set_source_files_properties(${PROJECT_SOURCE_DIR}/bindings/swmm5.def PROPERTIES_HEADER_FILE_ONLY TRUE ) add_library(swmm5 SHARED ${SWMM_SOURCES} ${PROJECT_SOURCE_DIR}/bindings/swmm5.def ) else() add_library(swmm5 SHARED ${SWMM_SOURCES} ) endif() target_compile_options(swmm5 PUBLIC $<$: $<$:/GL> $<$:/fp:fast> $<$:/Zi> > ) target_link_options(swmm5 PUBLIC $<$: $<$:/LTCG:incremental> > ) target_link_libraries(swmm5 PUBLIC $<$>>:m> $<$:OpenMP::OpenMP_C> ) target_include_directories(swmm5 PUBLIC $ $ ) install(TARGETS swmm5 EXPORT swmm5Targets RUNTIME DESTINATION "${TOOL_DIST}" LIBRARY DESTINATION "${TOOL_DIST}" ARCHIVE DESTINATION "${LIBRARY_DIST}" FRAMEWORK DESTINATION "${TOOL_DIST}" ) # Create target import scripts so other cmake projects can use swmm libraries install( EXPORT swmm5Targets DESTINATION "${CONFIG_DIST}" FILE swmm5-config.cmake ) install( FILES ${SWMM_PUBLIC_HEADERS} DESTINATION "${INCLUDE_DIST}" ) # copy swmm5 to build tree for testing add_custom_command(TARGET swmm5 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_BINARY_DIR}/bin/$/$ )