Skip to content

Commit

Permalink
add auto generate of Cgismo base on submodules
Browse files Browse the repository at this point in the history
  • Loading branch information
hverhelst committed Nov 11, 2024
1 parent bc20ba0 commit fdb0f0c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,21 @@ if(CMAKE_Fortran_COMPILER AND NOT NOFORTRAN)
add_gismo_executable(${CMAKE_CURRENT_SOURCE_DIR}/examples/geometry_fexample.F90)
endif()

add_custom_target(C_plugins)
add_custom_target(C_plugins)

# Add submodules to Cgismo.h
set(gsOptional_includes "")
foreach(gssm ${GISMO_OPTIONAL})
string(STRIP ${gssm} SUBMODULE)
if (EXISTS "${gismo_SOURCE_DIR}/optional/${SUBMODULE}/src/cinterface")
set(gsOptional_includes "${gsOptional_includes}#ifdef ${SUBMODULE}_ENABLED")
# Loop over the header files in the submodule
file( GLOB SUBMODULE_HEADERS ${gismo_SOURCE_DIR}/optional/${SUBMODULE}/src/cinterface/*.h)
foreach(HEADER ${SUBMODULE_HEADERS})
get_filename_component(HEADER_NAME ${HEADER} NAME)
set(gsOptional_includes "${gsOptional_includes}\n#include <${SUBMODULE}/cinterface/${HEADER_NAME}>")
endforeach()
set(gsOptional_includes "${gsOptional_includes}\n#endif\n")
endif()
endforeach()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/Cgismo.h.in" "${CMAKE_CURRENT_SOURCE_DIR}/Cgismo2.h")
4 changes: 3 additions & 1 deletion src/Cgismo.h → src/Cgismo.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// gsPde
#include <gsCInterface/gsCBoundaryConditions.h>


@gsOptional_includes@

//
// Function Overloads
Expand Down Expand Up @@ -70,6 +70,8 @@

#define destroy(X) _Generic((X), \
gsCFunctionSet * : gsFunctionSet_delete, \
gsCMultiPatch * : gsMultiPatch_delete, \
gsCMultiBasis * : gsMultiBasis_delete, \
gsCBoundaryConditions * : gsBoundaryConditions_delete, \
gsCKnotVector * : gsKnotVector_delete, \
gsCVector * : gsVector_delete, \
Expand Down

0 comments on commit fdb0f0c

Please sign in to comment.