Created
March 25, 2025 06:29
-
-
Save doccaico/04a4765f527c3ac35311de76358e428a to your computer and use it in GitHub Desktop.
(C) Raylib + Cmake + Ninja (MSYS2 - UCRT64)
This file contains 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.10) | |
# Debug build | |
# $ cmake -S . -B build/debug -GNinja -DCMAKE_BUILD_TYPE=Debug | |
# $ cmake --build build/debug -- basic_window && ./build/debug/basic_window.exe | |
# Release build | |
# $ cmake -S . -B build/release -GNinja -DCMAKE_BUILD_TYPE=Release | |
# $ cmake --build build/release -- basic_window && ./build/release/basic_window.exe | |
project(study-raylib) | |
set(CMAKE_C_STANDARD 99) | |
set(CMAKE_C_STANDARD_REQUIRED True) | |
set(CMAKE_C_EXTENSIONS OFF) | |
set(FILES | |
basic_window; | |
) | |
string(CONCAT CMAKE_C_FLAGS | |
" -Wall" | |
" -Wextra" | |
" -Wpedantic" | |
" -Wconversion" | |
" -Wdouble-promotion" | |
" -Wno-unused-parameter" | |
" -Wno-unused-function" | |
" -Wno-sign-conversion") | |
string(CONCAT CMAKE_C_FLAGS_DEBUG | |
" -DDEBUG" | |
" -g3" | |
) | |
if(MSYS OR MINGW) | |
string(CONCAT CMAKE_C_FLAGS_DEBUG | |
" ${CMAKE_C_FLAGS_DEBUG}" | |
" -fsanitize=undefined" | |
" -fsanitize-trap=undefined" | |
) | |
else() | |
string(CONCAT CMAKE_C_FLAGS_DEBUG | |
" ${CMAKE_C_FLAGS_DEBUG}" | |
" -fsanitize=undefined" | |
" -fsanitize=address" | |
" -fsanitize-trap" | |
) | |
endif() | |
string(CONCAT CMAKE_C_FLAGS_RELEASE | |
" -DNDEBUG" | |
" -O2") | |
foreach(f IN LISTS FILES) | |
add_executable(${f} "src/${f}.c") | |
target_link_libraries(${f} raylib) | |
endforeach() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment