-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
44 lines (38 loc) · 1.18 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
cmake_minimum_required(VERSION 3.14)
project(golf)
# raylib
find_package(raylib QUIET)
if (NOT raylib_FOUND)
include(FetchContent)
FetchContent_Declare(
raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 5.0
GIT_SHALLOW 1
)
FetchContent_MakeAvailable(raylib)
endif()
# raylib-cpp
find_package(raylib_cpp QUIET)
if (NOT raylib_cpp_FOUND)
include(FetchContent)
FetchContent_Declare(
raylib_cpp
GIT_REPOSITORY https://github.com/RobLoach/raylib-cpp.git
GIT_TAG v5.0.1
)
FetchContent_MakeAvailable(raylib_cpp)
endif()
set(SOURCES
src/main.cpp
)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
target_link_libraries(${PROJECT_NAME} PUBLIC raylib raylib_cpp)
# Web Configurations
if (${PLATFORM} STREQUAL "Web")
# Tell Emscripten to build an example.html file.
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
# Required linker flags for using Raylib with Emscripten
target_link_options(${PROJECT_NAME} PRIVATE -sEXPORTED_FUNCTIONS=['_main','_malloc'] -sEXPORTED_RUNTIME_METHODS=ccall -sUSE_GLFW=3)
endif()