Skip to content
Snippets Groups Projects
Commit f4884423 authored by Joseph Walton-Rivers's avatar Joseph Walton-Rivers
Browse files

make header-only glad an export target

parent 5a2a9b3c
No related branches found
No related tags found
No related merge requests found
......@@ -8,63 +8,63 @@ option(FGGL_EXAMPLES "Should we build examples or just the library" ON)
option(FGGL_TESTS "Should we enable the testing suite?" ON)
option(FGGL_DOCS "Should we build documentation?" ON)
##
# Windows
# When on windows, integrate vcpkg
##
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
endif()
##
# /windows
##
# Define the project
project(fggl
VERSION 0.1
DESCRIPTION ""
HOMEPAGE_URL ""
DESCRIPTION "FOSS Galaxy Game Library, for use in Education, and Games"
HOMEPAGE_URL "https://git.fossgalaxy.com/gamedev/fggl"
LANGUAGES C CXX)
include(GNUInstallDirs)
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
# testing support
include(CTest)
# Documentation support
if (FGGL_DOCS)
find_package(Doxygen)
if (Doxygen_FOUND)
add_subdirectory( docs )
else()
message(STATUS "Doxygen not found, not building docs")
endif()
endif()
endif()
# export compile commands for vim/neovim users
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
##
# end windows support
##
# vendor dependencies
add_subdirectory( vendor/imgui )
add_subdirectory( vendor/header_only )
# engine
# engine headers
file(GLOB_RECURSE public_headers
${PROJECT_SOURCE_DIR}/include/fggl/*.hpp
)
# engine sources, enable strict compiler warnings
add_subdirectory( fggl )
add_subdirectory( vendor/header_only )
target_compile_options( fggl PRIVATE -Wall -Wpedantic -Wextra -Wodr -fno-strict-aliasing -fno-strict-overflow )
set_property(TARGET fggl PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
# 3rd party integrations
add_subdirectory( integrations/bullet )
## G++ enable insane checks
target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -Wpedantic -Wextra -Wodr -fno-strict-aliasing -fno-strict-overflow )
set_property(TARGET fggl PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
# extras
# Unit Tests
if (FGGL_TESTS)
include(CTest)
add_subdirectory(tests)
endif()
# Documentation support
if (FGGL_DOCS)
find_package(Doxygen)
if (Doxygen_FOUND)
add_subdirectory( docs )
else()
message(STATUS "Doxygen not found, not building docs")
endif()
endif()
# Demo project
if (FGGL_EXAMPLES)
add_subdirectory(demo)
target_compile_options( demo PRIVATE -Wall -Wextra -Wodr -Wdouble-promotion -fno-strict-aliasing -fno-strict-overflow )
......@@ -75,13 +75,7 @@ endif()
# INSTALL PHASE
# see https://decovar.dev/blog/2021/03/08/cmake-cpp-library/
##
file(GLOB_RECURSE public_headers
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.hpp
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.h
)
#include(CMakePrintHelpers)
include(GNUInstallDirs)
# Structure preserving header macro
foreach(header ${public_headers})
......
......@@ -5,7 +5,7 @@ find_package( glfw3 REQUIRED )
include(CMakePrintHelpers)
cmake_print_variables(GLFW_TARGETS)
target_link_libraries(fggl PUBLIC glfw )
target_link_libraries(fggl PUBLIC glfw fggl-glad)
target_sources(fggl
PRIVATE
......
target_include_directories( fggl
PUBLIC
add_library(fggl-glad INTERFACE)
target_include_directories( fggl-glad
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/public>
$<INSTALL_INTERFACE:include/fggl>
)
......@@ -11,10 +13,15 @@ install(
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/glad
)
install(
FILES
public/KHR/khrplatform.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/KHR
)
install(TARGETS fggl-glad
EXPORT fgglTargets
DESTINATION
${CMAKE_INSTALL_LIBDIR}/fggl/glad
)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment