-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
56 lines (46 loc) · 1.36 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
cmake_minimum_required(VERSION 3.15)
project(learning-opengl)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(BUILD_GRPC_LISTENER "use GRPC listener for objects" OFF)
option(FORMAT "Format code" ON)
add_definitions(-DGLM_ENABLE_EXPERIMENTAL)
find_package(OpenGL REQUIRED) # openGL library
find_package(GLEW REQUIRED) # openGL <-> GPU function pointers
find_package(glfw3 REQUIRED) # window system
find_package(glm REQUIRED) # For algebra
add_library(gl_lib
lib/renderer.cc
lib/inputProcessor.cc
lib/shaderProgram.cc
lib/camera.cc
lib/entity/factory.cc)
target_link_libraries(gl_lib
OpenGL::GL glfw GLEW::GLEW)
target_include_directories(gl_lib PUBLIC include)
add_executable(app
src/app.cc)
target_link_libraries(app gl_lib)
target_include_directories(app PUBLIC ext)
add_definitions(-DTEST_CLOUD_DIR="${CMAKE_CURRENT_SOURCE_DIR}/clouds")
if( ${FORMAT} )
message(STATUS "using clang-format")
file(GLOB SOURCEFILES
"lib/*.cc"
"grpc/*.cc"
"grpc/*.hh"
"src/*.cc"
"src/*.hh"
"include/*.hh"
)
string (REPLACE ";" " " SOURCEFILES "${SOURCEFILES}")
add_custom_target(format ALL
COMMAND sh -c "clang-format -i ${SOURCEFILES} --verbose")
endif()
#
if(BUILD_GRPC_LISTENER)
add_subdirectory(grpc)
add_executable(grpc_app src/grpc_app.cc)
target_link_libraries(grpc_app gl_lib grpc_listener)
target_include_directories(grpc_app PUBLIC lib grpc)
endif()