65 lines
1.4 KiB
CMake
65 lines
1.4 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(factory-hole-core LANGUAGES CXX)
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
include(FetchContent)
|
|
|
|
# Flecs ECS
|
|
FetchContent_Declare(
|
|
flecs
|
|
GIT_REPOSITORY https://github.com/SanderMertens/flecs.git
|
|
GIT_TAG v4.1.4
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
# Doctest
|
|
FetchContent_Declare(
|
|
doctest
|
|
GIT_REPOSITORY https://github.com/doctest/doctest.git
|
|
GIT_TAG v2.4.12
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_MakeAvailable(flecs doctest)
|
|
|
|
# Only compile sources needed for the core library
|
|
set(SOURCES
|
|
src/Components/Config/WorldConfig.cpp
|
|
src/Core/WorldInstance.cpp
|
|
)
|
|
|
|
add_library(factory-hole-core ${SOURCES})
|
|
|
|
# Main executable
|
|
add_executable(factory-hole-app src/main.cpp)
|
|
target_link_libraries(factory-hole-app PRIVATE factory-hole-core)
|
|
|
|
target_include_directories(factory-hole-core PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
)
|
|
|
|
target_link_libraries(factory-hole-core PUBLIC
|
|
flecs::flecs_static
|
|
doctest::doctest
|
|
)
|
|
|
|
# Tests
|
|
enable_testing()
|
|
|
|
file(GLOB_RECURSE TEST_SOURCES tests/*.cpp)
|
|
|
|
add_executable(factory-hole-tests ${TEST_SOURCES})
|
|
|
|
target_include_directories(factory-hole-tests PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
)
|
|
|
|
target_link_libraries(factory-hole-tests PRIVATE
|
|
doctest::doctest_with_main
|
|
)
|
|
|
|
add_test(NAME factory-hole-tests COMMAND factory-hole-tests)
|