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
51 changes: 46 additions & 5 deletions modules/beamdyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,56 @@ add_library(beamdynlib STATIC
)
target_link_libraries(beamdynlib nwtclibs)

add_executable(beamdyn_driver
src/Driver_Beam.f90
# Driver subroutines (also used by the C-bindings interface for writing the output file)
add_library(beamdyn_driver_subs STATIC
src/Driver_Beam_Subs.f90
)
target_link_libraries(beamdyn_driver beamdynlib versioninfolib)
target_link_libraries(beamdyn_driver_subs beamdynlib versioninfolib)

add_executable(beamdyn_driver
src/Driver_Beam.f90
)
target_link_libraries(beamdyn_driver beamdyn_driver_subs)

# C-bindings interface library
# create object instead of directly linking into shared and static -- causes issues in parallel builds
# NOTE: target linking at the object, static, and shared libraries. Different CMake versions handle this
# slightly differently with unpredictable results if I don't.
add_library(beamdyn_c_binding_object OBJECT src/BeamDyn_C_Binding.f90)
target_link_libraries(beamdyn_c_binding_object beamdynlib beamdyn_driver_subs nwtclibs versioninfolib)
set_property(TARGET beamdyn_c_binding_object PROPERTY POSITION_INDEPENDENT_CODE 1) # required for shared libs
if(APPLE OR UNIX)
target_compile_definitions(beamdyn_c_binding_object PRIVATE IMPLICIT_DLLEXPORT)
endif()

# Shared
add_library(beamdyn_c_binding SHARED $<TARGET_OBJECTS:beamdyn_c_binding_object>)
target_link_libraries(beamdyn_c_binding beamdynlib beamdyn_driver_subs nwtclibs versioninfolib)
target_include_directories(beamdyn_c_binding PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
)
set_target_properties(beamdyn_c_binding PROPERTIES PUBLIC_HEADER src/BeamDyn_C_Binding.h)

# C-bindings non-shared interface
add_library(beamdyn_c_bind_static STATIC $<TARGET_OBJECTS:beamdyn_c_binding_object>)
target_link_libraries(beamdyn_c_bind_static beamdynlib beamdyn_driver_subs nwtclibs versioninfolib)
if(APPLE OR UNIX)
target_compile_definitions(beamdyn_c_bind_static PRIVATE IMPLICIT_DLLEXPORT)
endif()

install(TARGETS beamdynlib beamdyn_driver
# C driver for the C-bindings interface (example of driving a standalone beam from C, and checks of the interface)
add_executable(beamdyn_c_binding_driver
src/BeamDyn_C_Binding_Driver.c
)
target_link_libraries(beamdyn_c_binding_driver beamdyn_c_binding)
if(UNIX AND NOT APPLE)
target_link_libraries(beamdyn_c_binding_driver m)
endif()

install(TARGETS beamdynlib beamdyn_driver_subs beamdyn_driver beamdyn_c_binding beamdyn_c_bind_static beamdyn_c_binding_driver
EXPORT "${CMAKE_PROJECT_NAME}Libraries"
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
PUBLIC_HEADER DESTINATION include
)
3 changes: 3 additions & 0 deletions modules/beamdyn/src/BeamDyn.f90
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ SUBROUTINE BD_Init( InitInp, u, p, x, xd, z, OtherState, y, MiscVar, Interval, I
! this routine sets *some* of the parameters (basically the "easy" ones)
call SetParameters(InitInp, InputFileData, p, OtherState, ErrStat2, ErrMsg2); if (Failed()) return

! return the time step BeamDyn uses (DTBeam from the input file, or the suggested Interval when DTBeam is DEFAULT)
Interval = p%dt


! Temporary GLL point intrinsic coordinates array
CALL BD_GenerateGLL(p%nodes_per_elem,GLL_nodes,ErrStat2,ErrMsg2); if (Failed()) return
Expand Down
Loading
Loading