-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCMakeLists.txt
59 lines (45 loc) · 1.42 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
cmake_minimum_required (VERSION 3.8)
project(MineCube CXX)
set(CMAKE_CXX_STANDARD 11)
# OS config
if (WIN32)
option(CMAKE_USE_WIN32_THREADS_INIT "using WIN32 threads" ON)
endif()
if(NOT WIN32)
find_package(OpenGL REQUIRED)
endif()
# config glfw
set( GLFW_BUILD_EXAMPLES OFF CACHE BOOL "GLFW lib only" )
set( GLFW_BUILD_TESTS OFF CACHE BOOL "GLFW lib only" )
set( GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" )
set( GLFW_BUILD_INSTALL OFF CACHE BOOL "GLFW lib only" )
add_subdirectory(3rd_party/glfw)
include_directories(3rd_party/glfw/include)
LIST(APPEND LIBS glfw ${GLFW_LIBRARIES})
# config freetype2
add_subdirectory(3rd_party/freetype)
include_directories(3rd_party/freetype/include)
LIST(APPEND LIBS freetype ${FREETYPE_LIBRARIES})
# config glad
set(GLAD_SRC 3rd_party/glad/src/glad.c)
if (NOT WIN32)
LIST(APPEND LIBS dl)
endif()
include_directories(3rd_party/glad/include)
# config nlohmann::json
include_directories(3rd_party/nlohmann)
# config glm
include_directories(3rd_party/glm)
# config imgui
include_directories(3rd_party/imgui)
include_directories(3rd_party/imgui/examples/opengl3_example)
aux_source_directory(3rd_party/imgui IMGUI_SRC)
# include our headers
include_directories(include)
# get MineCube src files
aux_source_directory(./src MINECUBE_SRC)
set(SOURCE_FILES ${MINECUBE_SRC} ${IMGUI_SRC} ${GLAD_SRC})
# Compile
add_executable(MineCube ${SOURCE_FILES})
# Link
target_link_libraries(MineCube ${LIBS})