OpenGL-utility/CMakeLists.txt

84 lines
1.8 KiB
CMake
Raw Permalink Normal View History

2021-01-19 18:25:46 +00:00
cmake_minimum_required(VERSION 3.10)
2021-01-21 14:30:48 +00:00
project(OpenGLUtility)
2021-01-19 18:25:46 +00:00
2021-01-25 12:33:39 +00:00
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
2021-01-29 16:28:48 +00:00
set(CMAKE_CXX_STANDARD 17)
2021-01-22 00:13:01 +00:00
2021-01-24 19:14:42 +00:00
set(BUILD_EXAMPLES ON CACHE BOOL "Build examples")
set(BUILD_DOCUMENTATION ON CACHE BOOL "Generate documentation")
if(WIN32)
set(EXPOSE_OPENGL OFF CACHE BOOL "If you want to use raw OpenGL functions in your app (e.g. to use ImGui) check this")
endif()
2021-01-21 12:48:24 +00:00
2021-01-25 01:33:21 +00:00
if(${BUILD_DOCUMENTATION})
2021-01-21 12:48:24 +00:00
find_package(Doxygen REQUIRED)
endif()
2021-01-19 18:25:46 +00:00
if(WIN32)
add_compile_definitions(OGLU_WIN32)
2021-01-24 19:14:42 +00:00
if(${EXPOSE_OPENGL})
add_compile_definitions(GLAD_GLAPI_EXPORT)
endif()
2021-01-19 18:25:46 +00:00
endif()
file(GLOB_RECURSE include_files
"include/*.hpp"
)
file(GLOB_RECURSE source_files
"src/*.cpp"
"vendor/src/*.c"
)
add_library(openglu SHARED
${include_files}
${source_files}
2021-01-19 23:18:31 +00:00
"cpp.hint"
2021-01-29 16:28:48 +00:00
"src/core.cpp")
2021-01-19 18:25:46 +00:00
target_compile_definitions(openglu PRIVATE OGLU_BUILD_DLL)
include_directories(
include
vendor/include
)
target_include_directories(openglu PUBLIC
include
vendor/include
)
2021-01-25 01:33:21 +00:00
if(${BUILD_DOCUMENTATION})
2021-01-21 12:48:24 +00:00
configure_file(doxyfile.in ${CMAKE_BINARY_DIR}/doxyfile @ONLY)
add_custom_target(openglu_doc ALL
2021-01-21 14:30:48 +00:00
COMMAND ${DOXYGEN_EXECUTABLE} "${CMAKE_BINARY_DIR}/doxyfile"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
2021-01-21 12:48:24 +00:00
COMMENT "Building documentation..."
)
endif()
2021-01-25 01:33:21 +00:00
if(${BUILD_EXAMPLES})
2021-01-19 18:25:46 +00:00
macro(subdirlist result curdir)
file(GLOB children RELATIVE ${curdir} ${curdir}/*)
set(dirlist "")
foreach(child ${children})
if(IS_DIRECTORY ${curdir}/${child})
list(APPEND dirlist ${child})
endif()
endforeach()
set(${result} ${dirlist})
endmacro()
subdirlist(samples ${CMAKE_SOURCE_DIR}/examples)
foreach(sample ${samples})
add_subdirectory(examples/${sample})
endforeach()
2021-01-25 12:37:27 +00:00
endif()
install(
2021-01-25 12:38:10 +00:00
TARGETS openglu
2021-01-25 12:37:27 +00:00
LIBRARY DESTINATION lib
)