Skip to content

Commit

Permalink
Merge pull request #1586 from andrew-platt/b/cpp_api_compile
Browse files Browse the repository at this point in the history
Remove openfast_cpp target if BUILD_OPENFAST_CPP_API not selected
  • Loading branch information
deslaughter authored Oct 13, 2023
2 parents 5034481 + 10094c5 commit c55e801
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/automated-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ jobs:
-DVARIABLE_TRACKING=OFF \
-DBUILD_FASTFARM:BOOL=ON \
-DBUILD_OPENFAST_CPP_API:BOOL=ON \
-DBUILD_OPENFAST_CPP_DRIVER:BOOL=ON \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DBUILD_TESTING:BOOL=ON \
-DCTEST_PLOT_ERRORS:BOOL=ON \
Expand Down Expand Up @@ -244,7 +245,7 @@ jobs:
- name: Build OpenFAST C-Interfaces
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake --build . --target openfastlib openfast_cpp openfastcpp aerodyn_inflow_c_binding moordyn_c_binding ifw_c_binding hydrodyn_c_binding regression_test_controllers
cmake --build . --target openfastlib openfast_cpp_driver openfastcpp aerodyn_inflow_c_binding moordyn_c_binding ifw_c_binding hydrodyn_c_binding regression_test_controllers
- name: Cache the workspace
uses: actions/cache@v3.0.4
with:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ option(FPE_TRAP_ENABLED "Enable FPE trap in compiler options" off)
option(ORCA_DLL_LOAD "Enable OrcaFlex Library Load" on)
option(BUILD_FASTFARM "Enable building FAST.Farm" off)
option(BUILD_OPENFAST_CPP_API "Enable building OpenFAST - C++ API" off)
option(BUILD_OPENFAST_CPP_DRIVER "Enable building OpenFAST C++ driver using C++ API" off)
option(BUILD_OPENFAST_SIMULINK_API "Enable building OpenFAST for use with Simulink" off)
option(OPENMP "Enable OpenMP support" off)
option(USE_LOCAL_STATIC_LAPACK "Enable downloading and building static LAPACK and BLAS libs" off)
Expand Down
15 changes: 11 additions & 4 deletions glue-codes/openfast/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ add_executable(openfast src/FAST_Prog.f90)
target_link_libraries(openfast openfastlib_static)
set_target_properties(openfast PROPERTIES LINKER_LANGUAGE Fortran)

add_executable(openfast_cpp src/FAST_Prog.cpp src/FastLibAPI.cpp)
target_link_libraries(openfast_cpp openfastlib)

string(TOUPPER ${CMAKE_Fortran_COMPILER_ID} _compiler_id)
if (${_compiler_id} STREQUAL "GNU" AND NOT ${VARIABLE_TRACKING})
# With variable tracking enabled, the compile step frequently aborts on large modules and
Expand All @@ -33,5 +30,15 @@ if (${_compiler_id} STREQUAL "GNU" AND NOT ${VARIABLE_TRACKING})
set_source_files_properties(src/FAST_Prog.f90 PROPERTIES COMPILE_FLAGS "-fno-var-tracking -fno-var-tracking-assignments")
endif()

install(TARGETS openfast openfast_cpp
install(TARGETS openfast
RUNTIME DESTINATION bin)

if(BUILD_OPENFAST_CPP_DRIVER)
add_executable(openfast_cpp_driver src/FAST_Prog.cpp src/FastLibAPI.cpp)
target_link_libraries(openfast_cpp_driver openfastlib)

install(TARGETS openfast_cpp_driver
RUNTIME DESTINATION bin)
endif()


2 changes: 1 addition & 1 deletion modules/openfast-library/src/FAST_Registry.txt
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ typedef ^ FAST_ExternInitType ReKi windGrid_pZero 3 - - "fixed position of the X
typedef ^ FAST_ExternInitType CHARACTER(1024) RootName - - - "Root name of FAST output files (overrides normal operation)" -
typedef ^ FAST_ExternInitType IntKi NumActForcePtsBlade - - - "number of actuator line force points in blade" -
typedef ^ FAST_ExternInitType IntKi NumActForcePtsTower - - - "number of actuator line force points in tower" -
typedef ^ FAST_ExternInitType logical NodeClusterType - - - "Node clustering for actuator line (0 - Uniform, 1 - Non-uniform clustered towards tip)" -
typedef ^ FAST_ExternInitType IntKi NodeClusterType - - - "Node clustering for actuator line (0 - Uniform, 1 - Non-uniform clustered towards tip)" -

# ..... FAST Turbine Data (one realization) .......................................................................................................
typedef ^ FAST_TurbineType IntKi TurbID - 1 - "Turbine ID Number" -
Expand Down
4 changes: 2 additions & 2 deletions modules/openfast-library/src/FAST_Types.f90
Original file line number Diff line number Diff line change
Expand Up @@ -48250,7 +48250,7 @@ SUBROUTINE FAST_PackExternInitType( ReKiBuf, DbKiBuf, IntKiBuf, Indata, ErrStat,
Int_Xferred = Int_Xferred + 1
IntKiBuf(Int_Xferred) = InData%NumActForcePtsTower
Int_Xferred = Int_Xferred + 1
IntKiBuf(Int_Xferred) = TRANSFER(InData%NodeClusterType, IntKiBuf(1))
IntKiBuf(Int_Xferred) = InData%NodeClusterType
Int_Xferred = Int_Xferred + 1
END SUBROUTINE FAST_PackExternInitType

Expand Down Expand Up @@ -48367,7 +48367,7 @@ SUBROUTINE FAST_UnPackExternInitType( ReKiBuf, DbKiBuf, IntKiBuf, Outdata, ErrSt
Int_Xferred = Int_Xferred + 1
OutData%NumActForcePtsTower = IntKiBuf(Int_Xferred)
Int_Xferred = Int_Xferred + 1
OutData%NodeClusterType = TRANSFER(IntKiBuf(Int_Xferred), OutData%NodeClusterType)
OutData%NodeClusterType = IntKiBuf(Int_Xferred)
Int_Xferred = Int_Xferred + 1
END SUBROUTINE FAST_UnPackExternInitType

Expand Down
2 changes: 1 addition & 1 deletion reg_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ option(CTEST_NO_RUN_FLAG "Complete the regression test comparison but do not ex
# Set the OpenFAST executable configuration option and default
set(CTEST_OPENFAST_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/openfast/openfast${CMAKE_EXECUTABLE_SUFFIX}" CACHE FILEPATH "Specify the OpenFAST executable to use in testing.")

if(BUILD_OPENFAST_CPP_API)
if(BUILD_OPENFAST_CPP_DRIVER)
# Set the OpenFAST executable configuration option and default
set(CTEST_OPENFASTCPP_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/openfast-cpp/openfastcpp${CMAKE_EXECUTABLE_SUFFIX}" CACHE FILEPATH "Specify the OpenFAST C++ executable to use in testing.")
endif()
Expand Down
8 changes: 5 additions & 3 deletions reg_tests/CTestList.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ endfunction(of_regression)

function(of_fastlib_regression TESTNAME LABEL)
set(TEST_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/executeOpenfastRegressionCase.py")
set(OPENFAST_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/openfast/openfast_cpp")
set(OPENFAST_EXECUTABLE "${CMAKE_BINARY_DIR}/glue-codes/openfast/openfast_cpp_driver")
set(SOURCE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/..")
set(BUILD_DIRECTORY "${CTEST_BINARY_DIR}/glue-codes/openfast")
regression(${TEST_SCRIPT} ${OPENFAST_EXECUTABLE} ${SOURCE_DIRECTORY} ${BUILD_DIRECTORY} "${TESTNAME}_fastlib" "${LABEL}" ${TESTNAME})
Expand Down Expand Up @@ -285,13 +285,15 @@ of_regression("MHK_RM1_Floating" "openfast;elastodyn;aerod
of_regression("Tailfin_FreeYaw1DOF_PolarBased" "openfast;elastodyn;aerodyn15")

# OpenFAST C++ API test
if(BUILD_OPENFAST_CPP_API)
if(BUILD_OPENFAST_CPP_DRIVER)
of_cpp_interface_regression("5MW_Land_DLL_WTurb_cpp" "openfast;fastlib;cpp")
endif()

# OpenFAST C++ Driver test for OpenFAST Library
# This tests the FAST Library and FAST_Library.h
of_fastlib_regression("AWT_YFree_WSt" "fastlib;elastodyn;aerodyn15;servodyn")
if(BUILD_OPENFAST_CPP_DRIVER)
of_fastlib_regression("AWT_YFree_WSt" "fastlib;elastodyn;aerodyn15;servodyn")
endif(BUILD_OPENFAST_CPP_DRIVER)

# OpenFAST Python API test
of_regression_py("5MW_Land_DLL_WTurb_py" "openfast;fastlib;python;elastodyn;aerodyn15;servodyn")
Expand Down

0 comments on commit c55e801

Please sign in to comment.