created sicxe emulator project
This commit is contained in:
parent
cb38efe586
commit
3332b2971b
18 changed files with 1051 additions and 0 deletions
45
simulator_SIC_XE/CMakeLists.txt
Normal file
45
simulator_SIC_XE/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
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 as requested
|
||||
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()
|
||||
|
||||
# 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
|
||||
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}")
|
||||
Loading…
Add table
Add a link
Reference in a new issue