-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
47 lines (43 loc) · 1.58 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
cmake_minimum_required(VERSION 3.23)
project(LudumDare51)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Dependencies
include(FetchContent)
find_package(raylib 4.2.0 QUIET)
if (NOT raylib_FOUND)
FetchContent_Declare(raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 2e26cf48e8bf2b60209175fad47dfb030d29e2be
)
FetchContent_GetProperties(raylib)
if (NOT raylib_POPULATED)
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(raylib)
set(BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(${raylib_SOURCE_DIR} ${raylib_BINARY_DIR})
endif()
endif()
FetchContent_Declare(glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
GIT_TAG cc98465e3508535ba8c7f6208df934c156a018dc) # April 20, 2022
FetchContent_MakeAvailable(glm)
# Our Project
include_directories(include src)
file(GLOB_RECURSE all_SRCS
"${PROJECT_SOURCE_DIR}/src/*.cpp"
"${PROJECT_SOURCE_DIR}/src/*.c")
add_executable(${PROJECT_NAME} ${all_SRCS})
target_link_libraries(${PROJECT_NAME} glm raylib -static)
# Web Configuration
if (${PLATFORM} STREQUAL "Web")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --preload-file assets -s USE_GLFW=3 -s WASM=1 -s ASYNCIFY -s ALLOW_MEMORY_GROWTH=1")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
endif()
# Apple Configuration
if (APPLE)
target_link_libraries(${PROJECT_NAME} "-framework IOKit")
target_link_libraries(${PROJECT_NAME} "-framework Cocoa")
target_link_libraries(${PROJECT_NAME} "-framework OpenGL")
endif()