saved snapshot for naloga2
This commit is contained in:
parent
e764bf53e7
commit
9e7a9101b0
35 changed files with 4928 additions and 0 deletions
60
ass2/simulator_SIC_XE/CMakeLists.txt
Normal file
60
ass2/simulator_SIC_XE/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
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
|
||||
set(OUTPUT_DIR ${CMAKE_SOURCE_DIR}/target/bin)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_DIR})
|
||||
|
||||
# Collect all .cpp sources under src/
|
||||
file(GLOB_RECURSE SOURCES "${PROJECT_SOURCE_DIR}/src/*.cpp")
|
||||
|
||||
if(NOT SOURCES)
|
||||
message(WARNING "No source files found in ${PROJECT_SOURCE_DIR}/src — the build will create an empty library")
|
||||
endif()
|
||||
|
||||
# Build a static library from all sources
|
||||
add_library(simulator_lib STATIC ${SOURCES})
|
||||
target_include_directories(simulator_lib PUBLIC ${PROJECT_SOURCE_DIR}/include)
|
||||
set_target_properties(simulator_lib PROPERTIES OUTPUT_NAME "simulator")
|
||||
|
||||
# If a main.cpp exists, create an executable that links the library.
|
||||
if(EXISTS "${PROJECT_SOURCE_DIR}/src/main.cpp")
|
||||
add_executable(simulator_exec "${PROJECT_SOURCE_DIR}/src/main.cpp")
|
||||
target_link_libraries(simulator_exec PRIVATE simulator_lib)
|
||||
endif()
|
||||
|
||||
|
||||
if(TARGET simulator_exec)
|
||||
add_custom_target(run
|
||||
DEPENDS simulator_exec
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "Running simulator_exec..."
|
||||
COMMAND $<TARGET_FILE:simulator_exec>
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMENT "Builds and runs simulator_exec"
|
||||
)
|
||||
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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue