forked from xelatihy/yocto-gl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
90 lines (77 loc) · 3.51 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
cmake_minimum_required (VERSION 3.5)
project (yocto-gl)
option(YOCTO_OPENGL "Build OpenGL apps" ON)
option(YOCTO_EXPERIMENTAL "Build experimental apps" OFF)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED on)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(CMAKE_BINARY_DIR ${CMAKE_SOURCE_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
# compile flags
if(APPLE)
add_definitions(-Wno-missing-braces)
endif(APPLE)
if(MSVC)
add_definitions(/D_CRT_SECURE_NO_WARNINGS /wd4018 /wd4244 /wd4305 /wd4800 /wd4267)
set(CMAKE_CXX_FLAGS "/EHsc")
endif(MSVC)
if(YOCTO_OPENGL)
add_definitions(-DYGL_OPENGL=1)
else(YOCTO_OPENGL)
add_definitions(-DYGL_OPENGL=0)
endif(YOCTO_OPENGL)
if(YOCTO_OPENGL)
find_package(OpenGL REQUIRED)
if(APPLE)
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
find_library(GLFW_LIBRARY NAMES glfw3 glfw PATHS /usr/local/lib)
endif(APPLE)
if(WIN32)
include_directories(${CMAKE_SOURCE_DIR}/apps/w32/include)
link_directories(${CMAKE_SOURCE_DIR}/apps/w32/lib-vc2015)
find_library(GLEW_LIBRARIES NAMES glew32 PATHS ${CMAKE_SOURCE_DIR}/apps/w32/lib-vc2015)
find_library(GLFW_LIBRARY NAMES glfw3dll PATHS ${CMAKE_SOURCE_DIR}/apps/w32/lib-vc2015)
endif(WIN32)
if(UNIX AND NOT APPLE)
include_directories(/usr/include /usr/local/include)
find_library(GLFW_LIBRARY NAMES glfw3 glfw PATHS /usr/lib /usr/local/lib64 /usr/lib64 /usr/local/lib /usr/lib/x86_64-linux-gnu)
find_package(GLEW REQUIRED)
endif(UNIX AND NOT APPLE)
add_library(yocto_gl yocto/yocto_gl.h yocto/yocto_gl.cpp yocto/ext/stb_image.cpp yocto/ext/nanosvg.cpp yocto/ext/imgui/imgui.cpp yocto/ext/imgui/imgui_draw.cpp yocto/ext/imgui/imgui_impl_glfw_gl3.cpp yocto/ext/imgui/imgui_extra_fonts.cpp)
target_link_libraries(yocto_gl ${OPENGL_gl_LIBRARY} ${GLFW_LIBRARY} ${GLEW_LIBRARIES})
else(YOCTO_OPENGL)
add_library(yocto_gl yocto/yocto_gl.h yocto/yocto_gl.cpp yocto/ext/stb_image.cpp yocto/ext/nanosvg.cpp)
endif(YOCTO_OPENGL)
if(UNIX AND NOT APPLE)
find_package(Threads REQUIRED)
target_link_libraries(yocto_gl Threads::Threads)
endif(UNIX AND NOT APPLE)
add_executable(ytestgen apps/ytestgen.cpp yocto/yocto_gl.h)
add_executable(ytrace apps/ytrace.cpp yocto/yocto_gl.h)
add_executable(yscnproc apps/yscnproc.cpp yocto/yocto_gl.h)
add_executable(yimproc apps/yimproc.cpp yocto/yocto_gl.h)
add_executable(build_generator apps/build_generator.cpp yocto/yocto_gl.h)
target_link_libraries(ytestgen yocto_gl)
target_link_libraries(ytrace yocto_gl)
target_link_libraries(yscnproc yocto_gl)
target_link_libraries(yimproc yocto_gl)
target_link_libraries(build_generator yocto_gl)
if(YOCTO_OPENGL)
add_executable(yview apps/yview.cpp yocto/yocto_gl.h)
add_executable(yitrace apps/yitrace.cpp yocto/yocto_gl.h)
add_executable(ygltfview apps/ygltfview.cpp yocto/yocto_gl.h yocto/yocto_gltf.h yocto/yocto_gltf.cpp)
add_executable(yimview apps/yimview.cpp yocto/yocto_gl.h)
target_link_libraries(yview yocto_gl)
target_link_libraries(yitrace yocto_gl)
target_link_libraries(ygltfview yocto_gl)
target_link_libraries(yimview yocto_gl)
if(YOCTO_EXPERIMENTAL)
add_executable(yprocview apps/yprocview.cpp yocto/yocto_gl.h)
target_link_libraries(yprocview yocto_gl)
endif(YOCTO_EXPERIMENTAL)
endif(YOCTO_OPENGL)