forked from meemknight/marsMission
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
75 lines (50 loc) · 3.19 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#https://github.com/meemknight/cmakeSetup
#Version 1.0.0
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug$<$<CONFIG:Debug>:Debug>")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
project(mygame)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_INSTALL OFF CACHE BOOL "" FORCE)
add_subdirectory(thirdparty/glfw-3.3.2) #window oppener
add_subdirectory(thirdparty/glad) #opengl loader
add_subdirectory(thirdparty/stb_image) #loading immaged
add_subdirectory(thirdparty/stb_truetype) #loading ttf files
#add_subdirectory(thirdparty/enet-1.3.17) #networking
add_subdirectory(thirdparty/glm) #math
add_subdirectory(thirdparty/imgui-docking) #ui
add_subdirectory(thirdparty/FastNoiseSIMD) #noise
#----------V-----------------------V------------#my libraries
add_subdirectory(thirdparty/profilerLib) #profiling, just a simpe library for measuring elapsed time
add_subdirectory(thirdparty/gl2d) #2D rendering library
add_subdirectory(thirdparty/glui) #ui library, usefull for making game menus
if(WIN32)
add_subdirectory(thirdparty/raudio)
endif()
# Define MY_SOURCES to be a list of all the source files for my game
file(GLOB_RECURSE MY_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
add_executable("${CMAKE_PROJECT_NAME}")
set_property(TARGET "${CMAKE_PROJECT_NAME}" PROPERTY CXX_STANDARD 17)
target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC RESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/") # 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 RESOURCES_PATH="./resources/") # Uncomment this line to setup the ASSETS_PATH macro to the final assets directory when you share the game
#add_definitions(-DRESOURCES_PATH="${CMAKE_CURRENT_SOURCE_DIR}/resources/")
target_sources("${CMAKE_PROJECT_NAME}" PRIVATE ${MY_SOURCES} )
if(MSVC) # If using the VS compiler...
target_compile_definitions("${CMAKE_PROJECT_NAME}" PUBLIC _CRT_SECURE_NO_WARNINGS)
set_target_properties("${CMAKE_PROJECT_NAME}" PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup")
set_property(TARGET "${CMAKE_PROJECT_NAME}" PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreadedDebug<$<CONFIG:Debug>:Debug>")
set_property(TARGET "${CMAKE_PROJECT_NAME}" PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
endif()
target_include_directories("${CMAKE_PROJECT_NAME}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/")
target_include_directories("${CMAKE_PROJECT_NAME}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/gameLayer/")
target_include_directories("${CMAKE_PROJECT_NAME}" PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include/platform/")
if(WIN32)
target_link_libraries("${CMAKE_PROJECT_NAME}" PRIVATE glm glfw
glad stb_image stb_truetype gl2d imgui profilerLib glui raudio fastNoiseSIMD)
else()
target_link_libraries("${CMAKE_PROJECT_NAME}" PRIVATE glm glfw
glad stb_image stb_truetype gl2d imgui profilerLib glui fastNoiseSIMD)
endif()