102 lines
2.8 KiB
CMake
102 lines
2.8 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
|
|
)
|
|
|
|
# GLFW (windowing for node-editor tool)
|
|
FetchContent_Declare(
|
|
glfw
|
|
GIT_REPOSITORY https://github.com/glfw/glfw.git
|
|
GIT_TAG 3.4
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
|
|
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
|
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
|
|
|
# Dear ImGui
|
|
FetchContent_Declare(
|
|
imgui
|
|
GIT_REPOSITORY https://github.com/ocornut/imgui.git
|
|
GIT_TAG v1.91.6
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
# imnodes
|
|
FetchContent_Declare(
|
|
imnodes
|
|
GIT_REPOSITORY https://github.com/Nelarius/imnodes.git
|
|
GIT_TAG v0.5
|
|
GIT_SHALLOW TRUE
|
|
)
|
|
|
|
FetchContent_MakeAvailable(flecs doctest glfw imgui imnodes)
|
|
|
|
# ── Core library ──────────────────────────────────────────────────────────────
|
|
|
|
set(SOURCES
|
|
src/Components/Config/WorldConfig.cpp
|
|
src/Components/Support.cpp
|
|
src/Components/WorldGraph.cpp
|
|
src/Core/WorldInstance.cpp
|
|
)
|
|
|
|
add_library(factory-hole-core ${SOURCES})
|
|
|
|
target_include_directories(factory-hole-core PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
|
)
|
|
|
|
target_link_libraries(factory-hole-core PUBLIC
|
|
flecs::flecs_static
|
|
doctest::doctest
|
|
)
|
|
|
|
# ── Main executable ───────────────────────────────────────────────────────────
|
|
|
|
add_executable(factory-hole-app src/main.cpp)
|
|
target_link_libraries(factory-hole-app PRIVATE factory-hole-core)
|
|
|
|
# ── 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
|
|
factory-hole-core
|
|
doctest::doctest_with_main
|
|
)
|
|
|
|
add_test(NAME factory-hole-tests COMMAND factory-hole-tests)
|
|
|
|
# ── Node editor tool ──────────────────────────────────────────────────────────
|
|
|
|
add_subdirectory(tools/node-editor)
|