-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
31 lines (25 loc) · 1.11 KB
/
Copy pathCMakeLists.txt
File metadata and controls
31 lines (25 loc) · 1.11 KB
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
cmake_minimum_required(VERSION 3.13)
SET(CMAKE_INSTALL_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/install)
SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_ROOT})
# Build GL3W from sources since it is not available at Ubuntu package
find_package(PythonInterp REQUIRED)
include(FetchContent)
FetchContent_Declare(gl3w GIT_REPOSITORY "https://github.com/skaslev/gl3w.git" GIT_TAG "master")
FetchContent_Populate(gl3w)
# GL3W builds the source and header from gl3w_gen.py script
execute_process(COMMAND ${PYTHON_EXECUTABLE} gl3w_gen.py WORKING_DIRECTORY ${gl3w_SOURCE_DIR} OUTPUT_QUIET)
add_library(gl3w INTERFACE)
target_sources(gl3w INTERFACE
$<BUILD_INTERFACE:${gl3w_SOURCE_DIR}/src/gl3w.c>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_DATAROOTDIR}/gl3w/src/gl3w.c>)
target_sources(gl3w INTERFACE FILE_SET HEADERS
BASE_DIRS
${gl3w_source_dir}/include
FILES
${gl3w_headers})
find_package(OpenGL REQUIRED)
target_include_directories(gl3w INTERFACE
$<BUILD_INTERFACE:${gl3w_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/gl3w>)
target_link_libraries(gl3w INTERFACE OpenGL::GL ${CMAKE_DL_LIBS})
add_subdirectory(opengl)