-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
29 lines (23 loc) · 1.44 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
cmake_minimum_required(VERSION 3.1)
project(your-project-name-goes-here LANGUAGES C) # Change the name to your project here
set(CMAKE_C_STANDARD 99)
# Setup GLAD
add_library(glad libs/glad/glad.c)
target_include_directories(glad PUBLIC libs)
# Setup rayfork
add_subdirectory(libs/rayfork)
# Setup project
add_executable(${CMAKE_PROJECT_NAME} src/platform.c src/game.c)
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE glad rayfork)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE libs/rayfork libs/sokol)
target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC ASSETS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/") # This is useful to get an ASSETS_PATH in your IDE during development but you should comment this if you compile a release version and uncomment the next line
#target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC ASSETS_PATH="my-path-to-the-assets-directory") # Uncomment this line to setup the ASSETS_PATH macro to the final assets directory when you share the game
# Enable MacOS specific flags and link against it's specific libraries
if (APPLE)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC "-framework Cocoa" "-framework QuartzCore" "-framework OpenGL")
target_compile_options(${CMAKE_PROJECT_NAME} PUBLIC "-fobjc-arc" "-ObjC")
endif()
# Enable Linux specific flags and link against it's specific libraries
if (UNIX AND NOT APPLE)
target_link_libraries(${CMAKE_PROJECT_NAME} PUBLIC m dl pthread X11 Xi Xcursor)
endif()