-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
55 lines (48 loc) · 1.32 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
cmake_minimum_required(VERSION 3.1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
project(chip8)
# project sources
set(IMGUI_SFML ${CMAKE_CURRENT_SOURCE_DIR}/external/imgui-sfml/imgui-SFML.cpp)
file(GLOB_RECURSE SRC_FILES src/*.cpp)
add_executable(chip8 ${SRC_FILES} ${IMGUI_SFML})
# imgui setup
add_library(imgui STATIC
external/imgui/imgui.cpp
external/imgui/imgui_demo.cpp
external/imgui/imgui_draw.cpp
external/imgui/imgui_tables.cpp
external/imgui/imgui_widgets.cpp
)
target_include_directories(imgui
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/external/imgui-sfml
)
target_link_libraries(imgui
PUBLIC
sfml-system
sfml-window
sfml-graphics
)
# sfml
IF(WIN32) # static link only on windows xddd
set(SFML_STATIC_LIBRARIES TRUE)
ENDIF()
find_package(SFML 2.5.1 COMPONENTS system window graphics REQUIRED)
# opengl (fixes some linking error from imgui-sfml lol)
find_package(OpenGL REQUIRED)
# include headers
target_include_directories(chip8
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src/
${CMAKE_CURRENT_SOURCE_DIR}/external/imgui-sfml
${CMAKE_CURRENT_SOURCE_DIR}/external/imgui
)
# link everything
target_link_libraries(chip8
sfml-system
sfml-window
sfml-graphics
imgui
${OPENGL_LIBRARIES}
)