diff --git a/CMakeLists.txt b/CMakeLists.txt index 19add0c0..434d1261 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,12 +1,14 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.11) project(Bomberman) set(CMAKE_CXX_STANDARD 20) add_subdirectory(${PROJECT_SOURCE_DIR}/lib/wal) +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/lib/raylib) add_executable(bomberman sources/main.cpp ) -target_link_libraries(bomberman wal) \ No newline at end of file +find_package(raylib REQUIRED) +target_link_libraries(bomberman wal raylib) \ No newline at end of file diff --git a/lib/raylib/Findraylib.cmake b/lib/raylib/Findraylib.cmake new file mode 100644 index 00000000..4baf8bd8 --- /dev/null +++ b/lib/raylib/Findraylib.cmake @@ -0,0 +1,20 @@ +# Usage: +# FIND_PACKAGE(raylib REQUIRED) +# [...] +# TARGET_LINK_LIBRARIES(target_name raylib) + +CMAKE_MINIMUM_REQUIRED(VERSION 3.11) + +if (NOT raylib_FOUND) + INCLUDE(FetchContent) + + FetchContent_Declare(raylib URL https://github.com/raysan5/raylib/archive/master.tar.gz) + FetchContent_GetProperties(raylib) + if (NOT raylib_POPULATED) + SET(FETCHCONTENT_QUIET NO) + FetchContent_Populate(raylib) + SET(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) + ADD_SUBDIRECTORY(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR}) + SET(raylib_FOUND TRUE) + endif() +endif() diff --git a/lib/wal/CMakeLists.txt b/lib/wal/CMakeLists.txt index 36267b7b..b10c94d9 100644 --- a/lib/wal/CMakeLists.txt +++ b/lib/wal/CMakeLists.txt @@ -24,13 +24,20 @@ add_library(wal sources/Component/Position/PositionComponent.cpp sources/Component/Position/PositionComponent.hpp sources/Models/Vector3.hpp - sources/Component/Movable/MovableComponent.cpp sources/Component/Movable/MovableComponent.hpp sources/System/Movable/MovableSystem.cpp sources/System/Movable/MovableSystem.hpp sources/System/System.cpp) + sources/Component/Movable/MovableComponent.cpp + sources/Component/Movable/MovableComponent.hpp + sources/System/Movable/MovableSystem.cpp + sources/System/Movable/MovableSystem.hpp + sources/System/System.cpp +) target_include_directories(wal PUBLIC sources) add_executable(wal_tests tests/EntityTests.cpp - tests/MainTest.cpp tests/tests.hpp tests/EngineTests.cpp) + tests/MainTest.cpp + tests/EngineTests.cpp +) target_link_libraries(wal_tests PRIVATE wal) find_package(Catch2 REQUIRED)