96 lines
2.4 KiB
CMake
96 lines
2.4 KiB
CMake
cmake_minimum_required(VERSION 4.1)
|
|
project(game)
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
|
|
include(FetchContent)
|
|
|
|
FetchContent_Declare(
|
|
raylib
|
|
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
|
GIT_TAG c1ab645ca298a2801097931d1079b10ff7eb9df8
|
|
)
|
|
|
|
FetchContent_MakeAvailable(raylib)
|
|
|
|
target_compile_definitions(raylib PRIVATE SUPPORT_CUSTOM_FRAME_CONTROL)
|
|
|
|
FetchContent_Declare(
|
|
freetype
|
|
GIT_REPOSITORY https://github.com/freetype/freetype.git
|
|
GIT_TAG 526ec5c47b9ebccc4754c85ac0c0cdf7c85a5e9b
|
|
)
|
|
|
|
set(FT_DISABLE_ZLIB TRUE CACHE BOOL "" FORCE)
|
|
set(FT_DISABLE_BZIP2 TRUE CACHE BOOL "" FORCE)
|
|
set(FT_DISABLE_PNG TRUE CACHE BOOL "" FORCE)
|
|
set(FT_DISABLE_HARFBUZZ TRUE CACHE BOOL "" FORCE)
|
|
set(FT_DISABLE_BROTLI TRUE CACHE BOOL "" FORCE)
|
|
|
|
FetchContent_MakeAvailable(freetype)
|
|
|
|
FetchContent_Declare(
|
|
harfbuzz
|
|
GIT_REPOSITORY https://github.com/harfbuzz/harfbuzz.git
|
|
GIT_TAG b42511e071162fe76102f613a6ccc009726c99af
|
|
)
|
|
|
|
set(HB_HAVE_FREETYPE ON CACHE BOOL "" FORCE)
|
|
set(HB_HAVE_GLIB OFF CACHE BOOL "" FORCE)
|
|
set(HB_HAVE_ICU OFF CACHE BOOL "" FORCE)
|
|
|
|
FetchContent_Declare(
|
|
stb
|
|
GIT_REPOSITORY https://github.com/nothings/stb.git
|
|
GIT_TAG master
|
|
)
|
|
|
|
FetchContent_MakeAvailable(stb)
|
|
|
|
if(NOT TARGET stb)
|
|
# 3. Create a header-only "Interface" target
|
|
add_library(stb INTERFACE)
|
|
|
|
# 4. Point the target to the downloaded folder
|
|
target_include_directories(stb INTERFACE ${stb_SOURCE_DIR})
|
|
endif()
|
|
|
|
FetchContent_Declare(
|
|
tracy
|
|
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
|
|
GIT_TAG 05cceee0df3b8d7c6fa87e9638af311dbabc63cb
|
|
)
|
|
|
|
FetchContent_MakeAvailable(tracy)
|
|
|
|
FetchContent_Declare(
|
|
kb
|
|
GIT_REPOSITORY https://github.com/JimmyLefevre/kb.git
|
|
GIT_TAG main
|
|
)
|
|
|
|
FetchContent_MakeAvailable(kb)
|
|
|
|
if(NOT TARGET kb)
|
|
add_library(kb INTERFACE)
|
|
target_include_directories(kb INTERFACE "${kb_SOURCE_DIR}")
|
|
endif()
|
|
|
|
add_executable(game src/main.cpp
|
|
src/font.cpp
|
|
src/misc.cpp
|
|
src/misc.h
|
|
src/entity.cpp
|
|
src/entity.h
|
|
src/font.h)
|
|
target_link_libraries(game PRIVATE raylib freetype harfbuzz stb Tracy::TracyClient kb)
|
|
target_compile_definitions(game PUBLIC TRACY_ENABLE)
|
|
|
|
add_custom_command(
|
|
TARGET game POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
${CMAKE_CURRENT_SOURCE_DIR}/assets
|
|
${CMAKE_CURRENT_BINARY_DIR}/assets
|
|
COMMENT "Copying assets to build directory"
|
|
)
|