63 lines
1.9 KiB
CMake
63 lines
1.9 KiB
CMake
cmake_minimum_required(VERSION 3.16)
|
|
project(qtrocket LANGUAGES CXX)
|
|
|
|
# Enable testing
|
|
include(CTest)
|
|
enable_testing()
|
|
|
|
# Set C++ standard
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
|
|
|
|
# Include directories
|
|
include_directories(include)
|
|
|
|
# Find all source files
|
|
file(GLOB_RECURSE SIM_SRC src/*.cpp)
|
|
file(GLOB_RECURSE TEST_SRC tests/*.cpp)
|
|
|
|
# Create the rocket simulator library
|
|
add_library(rocketsimlib ${SIM_SRC})
|
|
|
|
# Main example executable
|
|
add_executable(basic_flight_simulation examples/basic_flight_simulation.cpp)
|
|
target_include_directories(basic_flight_simulation
|
|
PRIVATE /usr/lib/python3.13/site-packages/numpy/_core/include/)
|
|
target_link_libraries(basic_flight_simulation PRIVATE rocketsimlib PRIVATE Python3::Python)
|
|
|
|
# Test executable
|
|
add_executable(unit_tests ${TEST_SRC})
|
|
target_link_libraries(unit_tests PRIVATE rocketsimlib)
|
|
|
|
# Register tests with CTest
|
|
add_test(NAME UnitTests COMMAND unit_tests)
|
|
|
|
# ----------------------------------------------------------------------------
|
|
# PlantUML documentation generation
|
|
# ----------------------------------------------------------------------------
|
|
|
|
find_program(PLANTUML_EXECUTABLE plantuml DOC "Path to PlantUML executable")
|
|
|
|
if(PLANTUML_EXECUTABLE)
|
|
file(GLOB UML_FILES "${CMAKE_SOURCE_DIR}/docs/*.puml")
|
|
|
|
foreach(UML_FILE ${UML_FILES})
|
|
get_filename_component(UML_NAME ${UML_FILE} NAME_WE)
|
|
set(UML_OUTPUT "${CMAKE_SOURCE_DIR}/docs/${UML_NAME}.svg")
|
|
|
|
add_custom_command(
|
|
OUTPUT ${UML_OUTPUT}
|
|
COMMAND ${PLANTUML_EXECUTABLE} -tsvg ${UML_FILE}
|
|
DEPENDS ${UML_FILE}
|
|
COMMENT "Generating UML diagram ${UML_NAME}.svg"
|
|
VERBATIM
|
|
)
|
|
|
|
list(APPEND UML_OUTPUTS ${UML_OUTPUT})
|
|
endforeach()
|
|
|
|
add_custom_target(docs_uml ALL DEPENDS ${UML_OUTPUTS})
|
|
endif()
|