-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
44 lines (34 loc) · 1.3 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
cmake_minimum_required(VERSION 3.0)
project(lis_vr_app)
if (POLICY CMP0072)
cmake_policy (SET CMP0072 NEW)
endif(POLICY CMP0072)
find_package(X11 REQUIRED)
find_package(OpenGL REQUIRED)
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
add_executable(lis_vr_app main.c)
include(FindPkgConfig)
pkg_search_module(OPENXR openxr)
if (OPENXR_FOUND)
MESSAGE("OpenXR found with pkg-config")
target_link_libraries(lis_vr_app PRIVATE ${OPENXR_LIBRARIES})
else()
MESSAGE("OpenXR not found with pkg-config, trying cmake script")
# current issue in upstream OpenXR cmake files requires us to find Threads on our own
find_package(Threads REQUIRED)
find_package(OpenXR REQUIRED)
if (NOT OpenXR_FOUND)
MESSAGE(FATAL_ERROR "OpenXR not found!")
endif()
target_include_directories(lis_vr_app PRIVATE ${OpenXR_INCLUDE_DIR})
target_link_libraries(lis_vr_app PRIVATE OpenXR::openxr_loader)
endif()
target_link_libraries(lis_vr_app PRIVATE Xrandr ${X11_LIBRARIES} ${OPENGL_LIBRARIES} ${SDL2_LIBRARIES} m)
target_include_directories(lis_vr_app PRIVATE ${SDL2_INCLUDE_DIRS})
if(MSVC)
target_compile_options(lis_vr_app PRIVATE /W4 /WX)
else(MSVC)
target_compile_options(lis_vr_app PRIVATE -pedantic -Wall -Wextra -Wno-unused-parameter)
endif(MSVC)
install(TARGETS lis_vr_app RUNTIME DESTINATION bin)