Skip to content

Commit

Permalink
Merge pull request #1630 from deslaughter/f/cmake-static
Browse files Browse the repository at this point in the history
Make CMake module libs STATIC
  • Loading branch information
andrew-platt authored Jun 20, 2023
2 parents 5542dc9 + 84dc02f commit e182063
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 30 deletions.
5 changes: 4 additions & 1 deletion glue-codes/openfast-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ find_package(ZLIB REQUIRED)
find_package(HDF5 REQUIRED COMPONENTS C HL)
find_package(yaml-cpp REQUIRED)

add_library(openfastcpplib src/OpenFAST.cpp src/SC.cpp)
add_library(openfastcpplib
src/OpenFAST.cpp
src/SC.cpp
)
set_property(TARGET openfastcpplib PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(openfastcpplib
openfastlib
Expand Down
4 changes: 2 additions & 2 deletions modules/aerodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (GENERATE_TYPES)
endif()

# AeroDyn Library
add_library(aerodynlib
add_library(aerodynlib STATIC
src/AeroDyn.f90
src/AeroDyn_IO_Params.f90
src/AeroDyn_IO.f90
Expand Down Expand Up @@ -71,7 +71,7 @@ add_library(aerodynlib
target_link_libraries(aerodynlib ifwlib nwtclibs)

# AeroDyn Driver Subs Library
add_library(aerodyn_driver_subs
add_library(aerodyn_driver_subs STATIC
src/AeroDyn_Driver_Subs.f90
src/AeroDyn_Driver_Types.f90
)
Expand Down
2 changes: 1 addition & 1 deletion modules/aerodyn14/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/Registry-DWM.txt ${CMAKE_CURRENT_LIST_DIR}/src/DWM_Types.f90)
endif()

add_library(aerodyn14lib
add_library(aerodyn14lib STATIC
src/AeroDyn14.f90
src/AeroSubs.f90
src/DWM.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/awae/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/AWAE_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/AWAE_Types.f90 -noextrap)
endif()

add_library(awaelib
add_library(awaelib STATIC
src/AWAE.f90
src/AWAE_IO.f90
src/AWAE_Types.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/beamdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/Registry_BeamDyn.txt ${CMAKE_CURRENT_LIST_DIR}/src/BeamDyn_Types.f90)
endif()

add_library(beamdynlib
add_library(beamdynlib STATIC
src/BeamDyn.f90
src/BeamDyn_IO.f90
src/BeamDyn_BldNdOuts_IO.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/elastodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/ElastoDyn_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/ElastoDyn_Types.f90)
endif()

add_library(elastodynlib
add_library(elastodynlib STATIC
src/ElastoDyn.f90
src/ElastoDyn_IO.f90
src/ElastoDyn_AllBldNdOuts_IO.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/extptfm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/ExtPtfm_MCKF_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/ExtPtfm_MCKF_Types.f90)
endif()

add_library(extptfm_mckflib
add_library(extptfm_mckflib STATIC
src/ExtPtfm_MCKF.f90
src/ExtPtfm_MCKF_IO.f90
src/ExtPtfm_MCKF_Types.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/feamooring/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/FEAM_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/FEAMooring_Types.f90)
endif()

add_library(feamlib
add_library(feamlib STATIC
src/FEAM.f90
src/FEAMooring_Types.f90
)
Expand Down
4 changes: 2 additions & 2 deletions modules/hydrodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/WAMIT2.txt ${CMAKE_CURRENT_LIST_DIR}/src/WAMIT2_Types.f90)
endif()

add_library(hydrodynlib
add_library(hydrodynlib STATIC
src/Conv_Radiation.f90
src/HydroDyn.f90
src/HydroDyn_Input.f90
Expand All @@ -47,7 +47,7 @@ add_library(hydrodynlib
target_link_libraries(hydrodynlib seastlib nwtclibs)

# HydroDyn Driver Subs Library
add_library(hydrodyn_driver_subs
add_library(hydrodyn_driver_subs STATIC
src/HydroDyn_DriverSubs.f90
)
target_link_libraries(hydrodyn_driver_subs hydrodynlib)
Expand Down
2 changes: 1 addition & 1 deletion modules/icedyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/Registry_IceDyn.txt ${CMAKE_CURRENT_LIST_DIR}/src/IceDyn_Types.f90)
endif()

add_library(icedynlib
add_library(icedynlib STATIC
src/IceDyn.f90
src/IceDyn_Types.f90
)
Expand Down
2 changes: 1 addition & 1 deletion modules/icefloe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/interfaces/FAST/IceFloe_FASTRegistry.inp ${CMAKE_CURRENT_LIST_DIR}/src/icefloe/IceFloe_Types.f90)
endif()

add_library(icefloelib
add_library(icefloelib STATIC
src/icefloe/IceFlexBase.F90
src/icefloe/IceFlexIEC.f90
src/icefloe/IceFlexISO.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/inflowwind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (GENERATE_TYPES)
endif()

# InflowWind object library
add_library(ifwlib
add_library(ifwlib STATIC
src/IfW_FlowField_Types.f90
src/IfW_FlowField.f90
src/InflowWind_IO_Types.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/map/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ endif()
file(GLOB MAP_CLIB_SOURCES src/*.c src/*.cc src/*/*.c src/*/*.cc)
file(GLOB MAP_C_HEADERS src/*.h src/*/*.h)

add_library(maplib
add_library(maplib STATIC
src/map.f90
src/MAP_Types.f90
src/MAP_Fortran_Types.f90
Expand Down
2 changes: 1 addition & 1 deletion modules/moordyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/MoorDyn_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/MoorDyn_Types.f90)
endif()

add_library(moordynlib
add_library(moordynlib STATIC
src/MoorDyn.f90
src/MoorDyn_Body.f90
src/MoorDyn_IO.f90
Expand Down
5 changes: 4 additions & 1 deletion modules/nwtc-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
endif()

# Create NWTC Library
add_library(nwtclibs ${NWTC_SYS_FILE} ${NWTCLIBS_SOURCES})
add_library(nwtclibs STATIC
${NWTC_SYS_FILE}
${NWTCLIBS_SOURCES}
)
target_link_libraries(nwtclibs PUBLIC
${LAPACK_LIBRARIES}
${CMAKE_DL_LIBS}
Expand Down
10 changes: 7 additions & 3 deletions modules/openfast-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ elseif (${_compiler_id} MATCHES "^INTEL" AND ${_build_type} STREQUAL "RELEASE" A
set_source_files_properties(src/FAST_Types.f90 PROPERTIES COMPILE_FLAGS "-O2")
endif()

add_library(openfast_prelib src/FAST_Types.f90)
add_library(openfast_prelib STATIC
src/FAST_Types.f90
)
target_link_libraries(openfast_prelib
nwtclibs
versioninfolib
Expand All @@ -61,7 +63,7 @@ target_link_libraries(openfast_prelib
subdynlib
)

add_library(openfast_postlib
add_library(openfast_postlib STATIC
src/FAST_Lin.f90
src/FAST_Mods.f90
src/FAST_Subs.f90
Expand All @@ -78,7 +80,9 @@ add_library(openfastlib_static INTERFACE)
target_link_libraries(openfastlib_static INTERFACE openfast_postlib)

# OpenFAST Library shared (Python, openfast_cpp, openfastcpplib)
add_library(openfastlib SHARED src/FAST_Library.f90)
add_library(openfastlib SHARED
src/FAST_Library.f90
)
target_link_libraries(openfastlib openfast_postlib)
if(APPLE OR UNIX)
target_compile_definitions(openfastlib PRIVATE IMPLICIT_DLLEXPORT)
Expand Down
8 changes: 6 additions & 2 deletions modules/openfoam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,14 @@ if (GENERATE_TYPES)
generate_f90_types(src/OpenFOAM_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/OpenFOAM_Types.f90 -ccode)
endif()

add_library(foamtypeslib src/OpenFOAM_Types.f90)
add_library(foamtypeslib STATIC
src/OpenFOAM_Types.f90
)
target_link_libraries(foamtypeslib nwtclibs)

add_library(foamfastlib src/OpenFOAM.f90)
add_library(foamfastlib STATIC
src/OpenFOAM.f90
)
target_link_libraries(foamfastlib openfast_prelib)
target_include_directories(foamfastlib PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
Expand Down
2 changes: 1 addition & 1 deletion modules/orcaflex-interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/OrcaFlexInterface.txt ${CMAKE_CURRENT_LIST_DIR}/src/OrcaFlexInterface_Types.f90)
endif()

add_library(orcaflexlib
add_library(orcaflexlib STATIC
src/OrcaFlexInterface.f90
src/OrcaFlexInterface_Types.f90
)
Expand Down
2 changes: 1 addition & 1 deletion modules/seastate/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/SeaState.txt ${CMAKE_CURRENT_LIST_DIR}/src/SeaState_Types.f90 -noextrap)
endif()

add_library(seastlib
add_library(seastlib STATIC
src/Current.f90
src/Waves.f90
src/Waves2.f90
Expand Down
4 changes: 3 additions & 1 deletion modules/servodyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ set(SERVODYN_SRCS
src/ServoDyn_Types.f90
)

add_library(servodynlib ${SERVODYN_SRCS})
add_library(servodynlib STATIC
${SERVODYN_SRCS}
)
target_link_libraries(servodynlib nwtclibs)

# Driver
Expand Down
2 changes: 1 addition & 1 deletion modules/subdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/SubDyn_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/SubDyn_Types.f90)
endif()

add_library(subdynlib
add_library(subdynlib STATIC
src/SubDyn.f90
src/FEM.f90
src/SD_FEM.f90
Expand Down
4 changes: 2 additions & 2 deletions modules/supercontroller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ if (GENERATE_TYPES)
generate_f90_types(src/SC_DataEx_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/SCDataEx_Types.f90 -ccode -noextrap)
endif()

add_library(sctypeslib
add_library(sctypeslib STATIC
src/SCDataEx_Types.f90
)
target_link_libraries(sctypeslib nwtclibs)

add_library(scfastlib
add_library(scfastlib STATIC
src/SC_DataEx.f90
src/SuperController_Types.f90
src/SuperController.f90
Expand Down
4 changes: 3 additions & 1 deletion modules/version/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ else()
endif()
add_definitions(-DGIT_VERSION_INFO="${GIT_DESCRIBE}")

add_library(versioninfolib src/VersionInfo.f90)
add_library(versioninfolib STATIC
src/VersionInfo.f90
)
target_link_libraries(versioninfolib nwtclibs)

install(TARGETS versioninfolib
Expand Down
2 changes: 1 addition & 1 deletion modules/wakedynamics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (GENERATE_TYPES)
generate_f90_types(src/WakeDynamics_Registry.txt ${CMAKE_CURRENT_LIST_DIR}/src/WakeDynamics_Types.f90 -noextrap)
endif()

add_library(wdlib
add_library(wdlib STATIC
src/WakeDynamics.f90
#src/WakeDynamics_IO.f90
src/WakeDynamics_Types.f90
Expand Down

0 comments on commit e182063

Please sign in to comment.