Merge pull request #29 from RobLoach/submodule

Switch to submodule for the raylib dependency
This commit is contained in:
Rob Loach
2020-04-11 13:27:44 -04:00
committed by GitHub
10 changed files with 42 additions and 28 deletions

View File

@@ -8,7 +8,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Install Dependencies
run: sudo apt-get install xorg-dev libglu1-mesa-dev

3
.gitmodules vendored Normal file
View File

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

View File

@@ -1,20 +1,40 @@
cmake_minimum_required(VERSION 3.11)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
project (raylib-cpp)
project (raylib-cpp
VERSION 0.3.0
DESCRIPTION "raylib-cpp C++ Object Oriented Wrapper for raylib"
HOMEPAGE_URL "https://github.com/robloach/raylib-cpp"
LANGUAGES C CXX)
option(BUILD_STATIC "Static Library" ON)
option(BUILD_EXAMPLES "Examples" ON)
# CMake configuration
configure_file(${CMAKE_SOURCE_DIR}/cmake/CTestCustom.cmake ${CMAKE_BINARY_DIR})
# 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)
# Include Directory
add_subdirectory(include)
if(BUILD_STATIC)
# Static Library
if(BUILD_RAYLIB_CPP_STATIC)
add_subdirectory(lib)
endif()
if(BUILD_EXAMPLES)
# Examples
if(BUILD_RAYLIB_CPP_EXAMPLES)
add_subdirectory(examples)
endif()
# Testing
include(CTest)
enable_testing()
if(BUILD_TESTING)

View File

@@ -179,6 +179,7 @@ There is a [CMake sample project template](projects/CMake) that you can use a st
*raylib-cpp* uses [CMake](https://cmake.org) as a primary target for development. To build it, and run the tests/examples, use...
``` bash
git submodule update --init
mkdir build
cd build
cmake ..

3
cmake/CTestCustom.cmake Normal file
View File

@@ -0,0 +1,3 @@
set(CTEST_CUSTOM_TESTS_IGNORE
pkg-config--static
)

View File

@@ -1,17 +0,0 @@
find_package(raylib 3.0.0 QUIET)
if (NOT raylib_FOUND)
include(FetchContent)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 6a8b1079c13b7d5e1bddc0ecc86ad7e16fc2556d
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples
set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # or games
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()
endif()

View File

@@ -23,7 +23,7 @@ foreach(example_source ${example_sources})
# Setup the example
add_executable(${example_name} ${example_source})
target_link_libraries(${example_name} PUBLIC raylib-cpp raylib)
target_link_libraries(${example_name} PUBLIC libraylib-cpp)
string(REGEX MATCH ".*/.*/" resources_dir ${example_source})
string(APPEND resources_dir "resources")

View File

@@ -4,8 +4,9 @@
*
* This is a static C++ built library to make linking easier.
*
* Copyright (c) 2015 Rob Loach (@RobLoach)
* Copyright (c) 2020 Rob Loach (@RobLoach)
*
********************************************************************************************/
// raylib-cpp
#include "raylib/raylib.hpp"

View File

@@ -7,7 +7,7 @@ if (NOT raylib_FOUND)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 6a8b1079c13b7d5e1bddc0ecc86ad7e16fc2556d
GIT_TAG 7ef114d1da2c34a70bba5442497103441647d8f3
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED) # Have we downloaded raylib yet?
@@ -20,13 +20,13 @@ if (NOT raylib_FOUND)
endif()
endif()
find_package(raylib-cpp 0.2.0 QUIET)
find_package(raylib-cpp 0.3.0 QUIET)
if (NOT raylib-cpp_FOUND)
include(FetchContent)
FetchContent_Declare(
raylib-cpp
GIT_REPOSITORY https://github.com/RobLoach/raylib-cpp.git
GIT_TAG eddfc01dfc1ae9419683cacd81965c6a07b8aacd
GIT_TAG 64c39d6d6b1ab2f68cb3669b0a3ff57857d5cdf7
)
FetchContent_GetProperties(raylib-cpp)
if (NOT raylib-cpp_POPULATED) # Have we downloaded raylib yet?

1
vendor/raylib vendored Submodule

Submodule vendor/raylib added at 7ef114d1da