Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove openfast_cpp target if BUILD_OPENFAST_CPP_API not selected #1586

Merged
merged 5 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
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_API AND BUILD_OPENFAST_CPP_DRIVER)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openfast_cpp_driverdoesn't use the openfastcpplib, does it need to check for BUILD_OPENFAST_CPP_API?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to make another pass through the logic here. There are a couple other minor things I think should be addressed.

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(BUILD_OPENFAST_CPP_API AND BUILD_OPENFAST_CPP_DRIVER)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we not repeat the condition at the end of the block? endif() is sufficient for CMake.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, old habits ;)



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
6 changes: 4 additions & 2 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 @@ -291,7 +291,9 @@ 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
Loading