-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
55 lines (41 loc) · 1.55 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
# Only for cmake --version >= 3.5.1
cmake_minimum_required(VERSION 3.5.1)
# Project name
project(chip-8)
# Creates the variable EXEC and sets it to chip8
set(EXEC chip8)
# set the C++17 standard
set(CMAKE_CXX_STANDARD 17)
# Set the submodule directory
SET(SUBMODULE_DIR submodules)
# GLFW (https://www.glfw.org/docs/latest/build_guide.html#build_link_cmake_source)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(${SUBMODULE_DIR}/glfw)
# I../includes
include_directories(includes)
include_directories(${SUBMODULE_DIR}/olcPixelGameEngine)
include_directories(${SUBMODULE_DIR}/glfw/include)
include_directories(${SUBMODULE_DIR}/imgui)
include_directories(${SUBMODULE_DIR}/imgui/backends)
include_directories(${SUBMODULE_DIR}/imgui_club)
# Remove OpenGL deprecation warning
add_compile_definitions(GL_SILENCE_DEPRECATION)
find_package(OpenGL REQUIRED)
# Puts all .cpp files inside src
file(GLOB SOURCES_CHIP8 src/*.cpp)
# Put imgui .cpp files to sources
file(GLOB SOURCES_IMGUI ${SUBMODULE_DIR}/imgui/*.cpp)
set(SOURCES
${SOURCES_CHIP8}
${SOURCES_IMGUI}
# Add the GLFW backend
${SUBMODULE_DIR}/imgui/backends/imgui_impl_opengl3.cpp
${SUBMODULE_DIR}/imgui/backends/imgui_impl_glfw.cpp
)
# Compiles the files defined by SOURCES to generante the executable defined by EXEC
add_executable(${EXEC} ${SOURCES})
# Link with glfw
target_link_libraries(${EXEC} glfw)
target_link_libraries(${EXEC} OpenGL::GL)