-
Notifications
You must be signed in to change notification settings - Fork 30
/
CMakeLists.txt
70 lines (55 loc) · 1.58 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
cmake_minimum_required(VERSION 3.5.1)
set(BUILD_TARGET "viewer")
find_package(OpenGL REQUIRED)
find_package(Threads REQUIRED)
if(WIN32)
# nothing.
elseif(APPLE)
find_library(COCOA Cocoa REQUIRED)
else()
find_package(X11 REQUIRED)
endif()
set(SOURCES
main.cc
imgui.cpp
imgui_draw.cpp
imgui_impl_btgui.cpp
)
if(WIN32)
set(SOURCES ${SOURCES}
OpenGLWindow/Win32OpenGLWindow.cpp
OpenGLWindow/Win32Window.cpp
)
elseif(APPLE)
set(SOURCES ${SOURCES} OpenGLWindow/MacOpenGLWindow.mm)
else()
set(SOURCES ${SOURCES} OpenGLWindow/X11OpenGLWindow.cpp)
endif()
set(SOURCES ${SOURCES} ThirdPartyLibs/Glew/glew.c)
add_executable(${BUILD_TARGET} ${SOURCES})
target_include_directories(${BUILD_TARGET} PRIVATE ${OPENGL_INCLUDE_DIR})
target_include_directories(${BUILD_TARGET} PRIVATE ${X11_INCLUDE_DIR})
target_include_directories(${BUILD_TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../../)
target_include_directories(${BUILD_TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# local Glew
target_include_directories(${BUILD_TARGET} PRIVATE "${CMAKE_SOURCE_DIR}/ThirdPartyLibs/Glew")
target_compile_definitions(${BUILD_TARGET} PRIVATE GLEW_STATIC)
target_link_libraries(
${BUILD_TARGET}
${OPENGL_LIBRARIES}
Threads::Threads
)
if(WIN32)
# nothing.
elseif(APPLE)
target_link_libraries(
${BUILD_TARGET}
${COCOA}
)
else()
target_link_libraries(
${BUILD_TARGET}
${X11_LIBRARIES}
)
endif()
source_group("Source Files" FILES ${SOURCES})