85 lines
1.9 KiB
CMake
85 lines
1.9 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(colysis
|
|
LANGUAGES C CXX
|
|
VERSION 0.0.1
|
|
)
|
|
|
|
# Set C/C++ standards
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_C_EXTENSIONS OFF)
|
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
# Set compiler flags
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Generate compile commands (useful for IDEs)
|
|
set(USE_FOLDERS ON) # Organize targets into folders (for IDEs)
|
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # Build static libraries by default
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
|
|
# Raylib 5.5
|
|
find_package(raylib 5.5)
|
|
if(NOT raylib_FOUND)
|
|
FetchContent_Declare(
|
|
raylib
|
|
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
|
GIT_TAG 5.5
|
|
)
|
|
|
|
FetchContent_MakeAvailable(raylib)
|
|
endif()
|
|
|
|
# Flecs
|
|
find_package(flecs QUIET)
|
|
if(NOT flecs_FOUND)
|
|
FetchContent_Declare(
|
|
flecs
|
|
GIT_REPOSITORY https://github.com/SanderMertens/flecs.git
|
|
GIT_TAG v4.0.4
|
|
)
|
|
|
|
FetchContent_MakeAvailable(flecs)
|
|
endif()
|
|
|
|
## alyson engine (needs flecs and raylib)
|
|
set(ASSETS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/assets/")
|
|
add_subdirectory(alyson)
|
|
|
|
|
|
## Colysis .game
|
|
|
|
include(cmake/utils.cmake)
|
|
|
|
# Get files in src/ and add them to the executable
|
|
|
|
find_files(colysis_src src cpp hpp cxx hxx c h)
|
|
add_executable(colysis
|
|
${colysis_src}
|
|
)
|
|
|
|
target_link_libraries(colysis
|
|
raylib
|
|
flecs::flecs_static
|
|
alyson
|
|
)
|
|
|
|
target_include_directories(colysis PUBLIC include
|
|
#${ALYSON_INCLUDE_DIR}
|
|
)
|
|
|
|
# put the assets folder path as a C preprocessor define
|
|
target_compile_definitions(colysis PRIVATE ASSETS_PATH="${ASSETS_PATH}")
|
|
|
|
|
|
# if the os is windows, add the uninstall target to the vendor/raylib folder
|
|
if(WIN32)
|
|
put_targets_into_folder(FOLDER "vendor/raylib" TARGETS uninstall)
|
|
endif()
|
|
put_targets_into_folder(FOLDER "vendor/raylib" TARGETS raylib)
|
|
put_targets_into_folder(FOLDER "vendor/flecs" TARGETS flecs::flecs flecs::flecs_static)
|