feat: replaced premake5 with CMake to vendor SDL3

This commit is contained in:
Sara Gerretsen 2025-09-22 20:50:48 +02:00
parent 75455102ed
commit 98e4932a43
3 changed files with 28 additions and 30 deletions

25
CMakeLists.txt Normal file
View file

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.21)
project(GameOfLife)
set(CMAKE_BINARY_DIR "${CMAKE_SOURCE_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_C_STANDARD 23)
file(GLOB_RECURSE source_files . src/**.cpp src/**.c vendor/renderer/**.c)
include_directories(vendor/)
add_subdirectory(vendor/SDL3/ EXCLUDE_FROM_ALL)
set(SDLTTF_VENDORED ON)
add_subdirectory(vendor/SDL3_ttf/ EXCLUDE_FROM_ALL)
add_executable(GameOfLife ${source_files})
target_link_libraries(GameOfLife PRIVATE SDL3_ttf::SDL3_ttf SDL3::SDL3)
add_custom_target(copy_assets
COMMAND ${CMAKE_COMMAND} -E
copy_directory ${CMAKE_SOURCE_DIR}/assets/ ${CMAKE_BINARY_DIR}/assets
)
add_dependencies(GameOfLife copy_assets)

View file

@ -1,13 +1,13 @@
build: build:
# BUILDING # BUILDING
bear -- make bear -- cmake --build build
run: run:
bin/DiceGui cd bin/ && DiceGui
configure: configure:
# CONFIGURING WITH PREMAKE # CONFIGURING WITH PREMAKE
premake5 gmake cmake -S. -Bbuild
clean: clean:
rm -r bin/** rm -r bin/**

View file

@ -1,27 +0,0 @@
workspace "GameOfLife"
configurations { "debug", "release" }
location "."
project "GameOfLife"
kind "ConsoleApp"
language "C++"
cppdialect "c++23"
cdialect "c23"
location "build/"
files { "src/**.cpp", "src/**.c", "vendor/**.cpp", "vendor/**.c" }
includedirs { "include/", "vendor/" }
links { "m", "stdc++", "SDL3", "SDL3_ttf", "SDL3_image" }
buildoptions { "-Wall" }
targetdir "bin/"
postbuildcommands {
"{RMDIR} %{cfg.targetdir}/assets",
"{COPYDIR} %{wks.location}/assets/ %{cfg.targetdir}/assets/"
}
filter "configurations:debug"
defines { "DEBUG" }
symbols "On"
optimize "Off"
filter "configurations:release"
defines { "NDEBUG" }
optimize "On"
symbols "Off"