Update the cmake include vendor project

This commit is contained in:
Rob Loach
2020-04-21 14:51:31 -04:00
parent 2b4224a0db
commit a6117d25e8
6 changed files with 19 additions and 20 deletions

1
.gitmodules vendored
View File

@@ -1,3 +1,4 @@
[submodule "vendor/raylib"]
path = vendor/raylib
url = https://github.com/raysan5/raylib.git
ignore = dirty

View File

@@ -6,14 +6,6 @@ project (raylib-cpp
HOMEPAGE_URL "https://github.com/robloach/raylib-cpp"
LANGUAGES C CXX)
# raylib
find_package(raylib 3.0.0 QUIET)
if (NOT raylib_FOUND)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games
add_subdirectory(vendor/raylib)
endif()
# Options
option(BUILD_RAYLIB_CPP_STATIC "Static Library" ON)
option(BUILD_RAYLIB_CPP_EXAMPLES "Examples" ON)
@@ -21,14 +13,15 @@ option(BUILD_RAYLIB_CPP_EXAMPLES "Examples" ON)
# Include Directory
add_subdirectory(include)
# Static Library
if(BUILD_RAYLIB_CPP_STATIC)
add_subdirectory(lib)
endif()
# Examples
if(BUILD_RAYLIB_CPP_EXAMPLES)
add_subdirectory(examples)
set(BUILD_RAYLIB_CPP_STATIC ON)
endif()
# Static Library
if(BUILD_RAYLIB_CPP_STATIC)
add_subdirectory(lib)
endif()
# Testing

View File

@@ -1,5 +1,3 @@
find_package(Raylib)
# Get the sources together
set(example_dirs audio core models shapes text textures)
set(example_sources)
@@ -23,6 +21,7 @@ foreach(example_source ${example_sources})
# Setup the example
add_executable(${example_name} ${example_source})
# Link against the static library.
target_link_libraries(${example_name} PUBLIC libraylib-cpp)
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})

View File

@@ -1,6 +1,14 @@
# libraylib-cpp static library
add_library(libraylib-cpp STATIC libraylib-cpp)
# raylib
find_package(raylib 3.0.0 QUIET)
if (NOT raylib_FOUND)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../vendor/raylib ${CMAKE_CURRENT_SOURCE_DIR}/../vendor/raylib)
endif()
# Link raylib and raylib-cpp
target_link_libraries(libraylib-cpp PUBLIC raylib raylib-cpp)

View File

@@ -34,9 +34,9 @@ if (NOT raylib-cpp_FOUND)
if (NOT raylib-cpp_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib-cpp)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_GAMES OFF CACHE BOOL "" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
set(BUILD_RAYLIB_CPP_STATIC OFF CACHE BOOL "" FORCE)
set(BUILD_RAYLIB_CPP_EXAMPLES OFF CACHE BOOL "" FORCE)
set(BUILD_TESTING OFF CACHE BOOL "" FORCE)
add_subdirectory(${raylib-cpp_SOURCE_DIR} ${raylib-cpp_BINARY_DIR})
endif()
endif()

View File

@@ -28,8 +28,6 @@ macro(ADD_CATCH_TESTS executable)
endforeach()
endmacro()
find_package(Raylib)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CTEST_CUSTOM_TESTS_IGNORE pkg-config--static)