This commit is contained in:
zanostro 2025-12-07 11:27:01 +01:00
parent 18a14d204c
commit 717568b6d0
30 changed files with 4093 additions and 209 deletions

View file

@ -4,7 +4,7 @@ project(simulator_SIC_XE VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Put all build outputs under target/bin as requested
# Put all build outputs under target/bin
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/target/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR})
@ -28,8 +28,7 @@ if(EXISTS "${PROJECT_SOURCE_DIR}/src/main.cpp")
target_link_libraries(simulator_exec PRIVATE simulator_lib)
endif()
# Convenience target: `cmake --build build --target run`
# This target will build `simulator_exec` (if present) and then execute it.
if(TARGET simulator_exec)
add_custom_target(run
DEPENDS simulator_exec
@ -43,3 +42,19 @@ endif()
message(STATUS "Project: ${PROJECT_NAME}")
message(STATUS "Sources found: ${SOURCES}")
message(STATUS "Output directory: ${OUTPUT_DIR}")
if(EXISTS "${CMAKE_SOURCE_DIR}/gui/qt/CMakeLists.txt")
add_subdirectory(gui/qt)
endif()
# Copy resources directory (if present) to target/res so build output includes them
if(EXISTS "${CMAKE_SOURCE_DIR}/res")
add_custom_target(copy_resources
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/target/res
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res ${CMAKE_SOURCE_DIR}/target/res
COMMENT "Copying resources from res/ to target/res/"
)
if(TARGET simulator_exec)
add_dependencies(simulator_exec copy_resources)
endif()
endif()