update cmake for CPM.cmake
This commit is contained in:
parent
9f616e196c
commit
bf0c7ab8ef
6 changed files with 2636 additions and 26 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,6 +7,6 @@ bin
|
||||||
build
|
build
|
||||||
.cache
|
.cache
|
||||||
.idea
|
.idea
|
||||||
cmake-**
|
cmake-**/
|
||||||
.kdev4
|
.kdev4
|
||||||
*.kdev4
|
*.kdev4
|
|
@ -20,33 +20,20 @@ set(USE_FOLDERS ON) # Organize targets into fold
|
||||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # Build static libraries by default
|
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) # Build static libraries by default
|
||||||
|
|
||||||
|
|
||||||
include(FetchContent)
|
include(cmake/CPM.cmake)
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
# Raylib 5.5
|
NAME raylib
|
||||||
find_package(raylib 5.5)
|
GITHUB_REPOSITORY raysan5/raylib
|
||||||
if(NOT raylib_FOUND)
|
|
||||||
FetchContent_Declare(
|
|
||||||
raylib
|
|
||||||
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
|
||||||
GIT_TAG 5.5
|
GIT_TAG 5.5
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(raylib)
|
CPMAddPackage(
|
||||||
endif()
|
NAME flecs
|
||||||
|
GITHUB_REPOSITORY SanderMertens/flecs
|
||||||
# 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
|
GIT_TAG v4.0.4
|
||||||
)
|
)
|
||||||
|
|
||||||
FetchContent_MakeAvailable(flecs)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
## alyson engine (needs flecs and raylib)
|
## alyson engine (needs flecs and raylib)
|
||||||
set(ASSETS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/assets/")
|
set(ASSETS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/assets/")
|
||||||
add_subdirectory(alyson)
|
add_subdirectory(alyson)
|
||||||
|
|
|
@ -9,11 +9,23 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
include(../cmake/utils.cmake)
|
include(cmake/utils.cmake)
|
||||||
|
|
||||||
add_library(alyson)
|
add_library(alyson)
|
||||||
target_include_directories(alyson PUBLIC includes)
|
target_include_directories(alyson PUBLIC includes)
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME raylib
|
||||||
|
GITHUB_REPOSITORY raysan5/raylib
|
||||||
|
GIT_TAG 5.5
|
||||||
|
)
|
||||||
|
|
||||||
|
CPMAddPackage(
|
||||||
|
NAME flecs
|
||||||
|
GITHUB_REPOSITORY SanderMertens/flecs
|
||||||
|
GIT_TAG v4.0.4
|
||||||
|
)
|
||||||
|
|
||||||
target_link_libraries(alyson PUBLIC raylib)
|
target_link_libraries(alyson PUBLIC raylib)
|
||||||
target_link_libraries(alyson PUBLIC flecs::flecs_static)
|
target_link_libraries(alyson PUBLIC flecs::flecs_static)
|
||||||
|
|
||||||
|
|
1289
alyson/cmake/CPM.cmake
Normal file
1289
alyson/cmake/CPM.cmake
Normal file
File diff suppressed because it is too large
Load diff
33
alyson/cmake/utils.cmake
Normal file
33
alyson/cmake/utils.cmake
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
|
||||||
|
function(put_targets_into_folder)
|
||||||
|
set(oneValueArgs FOLDER)
|
||||||
|
set(multiValueArgs TARGETS)
|
||||||
|
cmake_parse_arguments(ARGS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
foreach(target ${ARGS_TARGETS})
|
||||||
|
# Check if target exists
|
||||||
|
if (NOT TARGET ${target})
|
||||||
|
message(FATAL_ERROR "${target} target not found")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Get the actual target (if it is aliased)
|
||||||
|
get_target_property(actual_target ${target} ALIASED_TARGET)
|
||||||
|
if (NOT actual_target)
|
||||||
|
set(actual_target ${target})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set the folder property for the target
|
||||||
|
set_target_properties(${actual_target} PROPERTIES FOLDER ${ARGS_FOLDER})
|
||||||
|
endforeach()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
|
function(find_files var_name path)
|
||||||
|
set(sources)
|
||||||
|
foreach(ext ${ARGN})
|
||||||
|
file(GLOB_RECURSE files "${path}/*.${ext}")
|
||||||
|
list(APPEND sources ${files})
|
||||||
|
endforeach()
|
||||||
|
set(${var_name} ${${var_name}} ${sources} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
1289
cmake/CPM.cmake
Normal file
1289
cmake/CPM.cmake
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue