-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
65 lines (55 loc) · 2.52 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
cmake_minimum_required (VERSION 3.5)
project (cities-generator)
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-gl/yocto/yocto_gl.h yocto-gl/yocto/yocto_gl.cpp yocto-gl/yocto/ext/stb_image.cpp yocto-gl/yocto/ext/nanosvg.cpp yocto-gl/yocto/ext/imgui/imgui.cpp yocto-gl/yocto/ext/imgui/imgui_draw.cpp yocto-gl/yocto/ext/imgui/imgui_impl_glfw_gl3.cpp yocto-gl/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(builder builder.cpp yocto-gl/yocto/yocto_gl.h)
target_link_libraries(builder yocto_gl)