netgen/rules/CMakeLists.txt

41 lines
1.2 KiB
CMake
Raw Permalink Normal View History

# this file is included from the parent directory (otherwise generated source files are not recognized properly by cmake)
# generate .cpp files containing the string of the .rls meshing rule files
2023-07-28 16:01:41 +05:00
if(EMSCRIPTEN)
add_custom_command(OUTPUT makerls
COMMAND g++ ${CMAKE_CURRENT_SOURCE_DIR}/rules/makerlsfile.cpp -o ${CMAKE_CURRENT_BINARY_DIR}/makerls
)
set(rules_command ${CMAKE_BINARY_DIR}/makerls)
else(EMSCRIPTEN)
add_executable(makerls rules/makerlsfile.cpp)
2024-06-14 13:50:42 +05:00
if(USE_CCACHE)
set_target_properties(makerls PROPERTIES RULE_LAUNCH_COMPILE "")
endif(USE_CCACHE)
2023-07-28 16:01:41 +05:00
set(rules_command makerls)
endif()
set(rules
hexrules
prismrules2
pyramidrules
pyramidrules2
quadrules
tetrules
triarules
)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/rules/)
foreach(rule ${rules})
list(APPEND rules_sources ${CMAKE_CURRENT_BINARY_DIR}/rules/rule_${rule}.cpp)
set(rule_file ${CMAKE_CURRENT_SOURCE_DIR}/rules/${rule}.rls)
set(rule_cpp ${CMAKE_CURRENT_BINARY_DIR}/rules/rule_${rule}.cpp)
add_custom_command(OUTPUT ${rule_cpp}
2023-07-28 16:01:41 +05:00
COMMAND ${rules_command} ${rule_file} ${rule_cpp} ${rule}
DEPENDS makerls ${rule_file}
)
endforeach()
target_sources(nglib PRIVATE ${rules_sources})