From 8e27cf1b37c6cf7495125aa09df075f53a3aa950 Mon Sep 17 00:00:00 2001 From: gilzoide Date: Sun, 5 May 2024 07:49:09 -0300 Subject: Import raylib as a Git submodule --- .gitmodules | 3 +++ libs/raylib | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 libs/raylib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c3b76a7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "libs/raylib"] + path = libs/raylib + url = https://github.com/raysan5/raylib.git diff --git a/libs/raylib b/libs/raylib new file mode 160000 index 0000000..f100755 --- /dev/null +++ b/libs/raylib @@ -0,0 +1 @@ +Subproject commit f1007554a0a8145060797c0aa8169bdaf2c1c6b8 -- cgit v1.2.3 From d78391bcf9d9730a70298c39871b60314629ed66 Mon Sep 17 00:00:00 2001 From: gilzoide Date: Sun, 5 May 2024 08:01:22 -0300 Subject: Use raylib Git submodule in CMake build --- .editorconfig | 4 ++++ CMakeLists.txt | 19 ++----------------- libs/CMakeLists.txt | 9 +++++++++ 3 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 libs/CMakeLists.txt diff --git a/.editorconfig b/.editorconfig index 335540e..3ab36f3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,3 +8,7 @@ insert_final_newline = true [*.{c,h}] indent_style = space indent_size = 2 + +[CMake*.txt] +indent_style = space +indent_size = 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index db4081d..8be905e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,23 +2,8 @@ cmake_minimum_required(VERSION 3.0) project(slgj C) set(CMAKE_C_STANDARD 99) -# the `pkg_check_modules` function is created with this call -find_package(PkgConfig REQUIRED) - -# Adding Raylib -include(FetchContent) -set(FETCHCONTENT_QUIET FALSE) -set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) # don't build the supplied examples -set(BUILD_GAMES OFF CACHE BOOL "" FORCE) # don't build the supplied example games - -FetchContent_Declare( - raylib - GIT_REPOSITORY "https://github.com/raysan5/raylib.git" - GIT_TAG "master" - GIT_PROGRESS TRUE -) - -FetchContent_MakeAvailable(raylib) +# Third party libs (currently only raylib) +add_subdirectory(libs) # Adding our source files file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/sources/*.c") # Define PROJECT_SOURCES as a list of all source files diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt new file mode 100644 index 0000000..4b4489c --- /dev/null +++ b/libs/CMakeLists.txt @@ -0,0 +1,9 @@ +set(BUILD_SHARED_LIBS OFF) # link third party libraries statically + +# raylib +if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/raylib") + message(FATAL_ERROR "Could not find raylib folder. Did you clone the Git submodules?") +endif() + +add_subdirectory(raylib) +target_compile_options(raylib PRIVATE "-w") # disable warnings -- cgit v1.2.3