Last active
May 15, 2025 16:08
-
-
Save nezvers/f1213ed2c1be8e8047ceea0daa239684 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.28) | |
| include(FetchContent) | |
| # NAME | |
| set(PROJECT_NAME RaylibTemplate) | |
| project(${PROJECT_NAME} LANGUAGES C) | |
| set(CMAKE_C_STANDARD 99) | |
| # set(CMAKE_CXX_STANDARD 17) | |
| # Raylib | |
| FetchContent_Declare( | |
| raylib | |
| DOWNLOAD_EXTRACT_TIMESTAMP OFF | |
| URL https://github.com/raysan5/raylib/archive/refs/tags/5.5.zip | |
| ) | |
| #FetchContent_GetProperties(raylib) | |
| set(FETCHCONTENT_QUIET NO) | |
| 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_MakeAvailable(raylib) | |
| include_directories(${CMAKE_SOURCE_DIR}/include) | |
| file(GLOB APP_SOURCE_FILES src/*.cpp src/*.hpp src/*.c src/*.h) | |
| add_executable(${PROJECT_NAME} ${APP_SOURCE_FILES}) | |
| target_link_libraries(${PROJECT_NAME} raylib) | |
| set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") | |
| # Setting ASSETS_PATH | |
| if(CMAKE_BUILD_TYPE STREQUAL "Debug") | |
| target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/") # Set the asset path macro to the absolute path on the dev machine | |
| else() | |
| target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="./assets/") # Set the asset path macro in release mode to a relative path that assumes the assets folder is in the same directory as the game executable | |
| endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment