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) ...@@ -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_TESTS "Should we enable the testing suite?" ON)
option(FGGL_DOCS "Should we build documentation?" 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) if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "") CACHE STRING "")
endif() endif()
##
# /windows
##
# Define the project # Define the project
project(fggl project(fggl
VERSION 0.1 VERSION 0.1
DESCRIPTION "" DESCRIPTION "FOSS Galaxy Game Library, for use in Education, and Games"
HOMEPAGE_URL "" HOMEPAGE_URL "https://git.fossgalaxy.com/gamedev/fggl"
LANGUAGES C CXX) LANGUAGES C CXX)
include(GNUInstallDirs) # export compile commands for vim/neovim users
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()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
##
# end windows support
##
# vendor dependencies # vendor dependencies
add_subdirectory( vendor/imgui ) 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( 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 # 3rd party integrations
add_subdirectory( integrations/bullet ) add_subdirectory( integrations/bullet )
# Unit Tests
## 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
if (FGGL_TESTS) if (FGGL_TESTS)
include(CTest)
add_subdirectory(tests) add_subdirectory(tests)
endif() 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) if (FGGL_EXAMPLES)
add_subdirectory(demo) add_subdirectory(demo)
target_compile_options( demo PRIVATE -Wall -Wextra -Wodr -Wdouble-promotion -fno-strict-aliasing -fno-strict-overflow ) target_compile_options( demo PRIVATE -Wall -Wextra -Wodr -Wdouble-promotion -fno-strict-aliasing -fno-strict-overflow )
...@@ -75,13 +75,7 @@ endif() ...@@ -75,13 +75,7 @@ endif()
# INSTALL PHASE # INSTALL PHASE
# see https://decovar.dev/blog/2021/03/08/cmake-cpp-library/ # see https://decovar.dev/blog/2021/03/08/cmake-cpp-library/
## ##
include(GNUInstallDirs)
file(GLOB_RECURSE public_headers
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.hpp
${PROJECT_SOURCE_DIR}/include/${PROJECT_NAME}/*.h
)
#include(CMakePrintHelpers)
# Structure preserving header macro # Structure preserving header macro
foreach(header ${public_headers}) foreach(header ${public_headers})
......
...@@ -5,7 +5,7 @@ find_package( glfw3 REQUIRED ) ...@@ -5,7 +5,7 @@ find_package( glfw3 REQUIRED )
include(CMakePrintHelpers) include(CMakePrintHelpers)
cmake_print_variables(GLFW_TARGETS) cmake_print_variables(GLFW_TARGETS)
target_link_libraries(fggl PUBLIC glfw ) target_link_libraries(fggl PUBLIC glfw fggl-glad)
target_sources(fggl target_sources(fggl
PRIVATE PRIVATE
......
target_include_directories( fggl add_library(fggl-glad INTERFACE)
PUBLIC
target_include_directories( fggl-glad
INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/public> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/public>
$<INSTALL_INTERFACE:include/fggl> $<INSTALL_INTERFACE:include/fggl>
) )
...@@ -11,10 +13,15 @@ install( ...@@ -11,10 +13,15 @@ install(
DESTINATION DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/glad ${CMAKE_INSTALL_INCLUDEDIR}/fggl/glad
) )
install( install(
FILES FILES
public/KHR/khrplatform.h public/KHR/khrplatform.h
DESTINATION DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/fggl/KHR ${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