colysis/CMakeLists.txt

72 lines
1.7 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(cmake/CPM.cmake)
CPMAddPackage(
NAME raylib
GITHUB_REPOSITORY raysan5/raylib
GIT_TAG 5.5
)
CPMAddPackage(
NAME flecs
GITHUB_REPOSITORY SanderMertens/flecs
GIT_TAG v4.0.4
)
## 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)