-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (57 loc) · 2.05 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
cmake_minimum_required(VERSION 3.8)
project("ghost-manager" LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# add c++ files
file(GLOB_RECURSE CXX_SOURCE "src/*.cpp")
# imgui
file(GLOB IMGUI_SOURCE
"dep/imgui/imgui.cpp"
"dep/imgui/imgui_widgets.cpp"
"dep/imgui/imgui_tables.cpp"
"dep/imgui/imgui_draw.cpp"
"dep/imgui/imgui_demo.cpp"
"dep/imgui/backends/imgui_impl_sdlrenderer2.cpp"
"dep/imgui/backends/imgui_impl_sdl2.cpp"
)
# osdialog, for specifically linux builds
if (UNIX)
file(GLOB OSDIALOG_SOURCE
"dep/osdialog/osdialog.c"
"dep/osdialog/osdialog_gtk2.c"
)
set_source_files_properties(${OSDIALOG_SOURCE} PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
add_executable(${PROJECT_NAME} ${OSDIALOG_SOURCE} ${CXX_SOURCE} ${IMGUI_SOURCE})
target_precompile_headers(${PROJECT_NAME} PRIVATE "src/pch.h")
target_sources(${PROJECT_NAME} PRIVATE "resource.rc")
# packages
# sdl2
find_package(SDL2 REQUIRED)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2 SDL2::SDL2main)
# sdl2_image
find_package(SDL2_image REQUIRED)
target_link_libraries(${PROJECT_NAME} ${SDL2_IMAGE_LIBRARY})
target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_IMAGE_INCLUDE_DIR})
# unix packages
if (UNIX)
# osdialog
target_include_directories(${PROJECT_NAME} PRIVATE "dep/osdialog")
# gtkmm 2.4
find_package(PkgConfig)
pkg_check_modules(GTKMM gtkmm-2.4)
target_link_libraries(${PROJECT_NAME} ${GTKMM_LIBRARIES})
target_link_directories(${PROJECT_NAME} PUBLIC ${GTKMM_LIBRARY_DIRS})
target_include_directories(${PROJECT_NAME} PRIVATE ${GTKMM_INCLUDE_DIRS})
endif()
target_include_directories(${PROJECT_NAME} PRIVATE
"src"
"dep/imgui"
"dep/spdlog/include"
)
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/res" "${CMAKE_BINARY_DIR}/res"
)