hyporo-cpp/source/hpr/gpu/CMakeLists.txt

69 lines
1.9 KiB
CMake

cmake_minimum_required(VERSION 3.16)
project(gpu
VERSION "${HPR_PROJECT_VERSION}"
LANGUAGES CXX
)
add_library(${PROJECT_NAME})
add_library(${CMAKE_PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
add_module(${PROJECT_NAME})
file(GLOB ${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS
"../gpu.hpp" "*.hpp" "opengl/*.hpp"
)
foreach(_header_path ${${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS})
list(APPEND ${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS_INTERFACE "$<BUILD_INTERFACE:${_header_path}>")
endforeach()
file(GLOB ${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_SOURCES
"*.cpp" "opengl/*.cpp"
)
target_sources(${PROJECT_NAME}
INTERFACE
${${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_HEADERS_INTERFACE}
$<INSTALL_INTERFACE:include/${CMAKE_PROJECT_NAME}/${PROJECT_NAME}>
PRIVATE
${${CMAKE_PROJECT_NAME}_${PROJECT_NAME}_SOURCES}
)
target_link_libraries(${PROJECT_NAME}
glad
stb
)
install(
TARGETS ${PROJECT_NAME}
EXPORT ${PROJECT_NAME}Targets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
NAMELINK_SKIP
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
EXPORT ${PROJECT_NAME}Targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMAKE_PROJECT_NAME}-${HPR_PROJECT_VERSION}
NAMESPACE ${CMAKE_PROJECT_NAME}::
)
install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${PROJECT_NAME}
NAMELINK_ONLY
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
COMPONENT devel
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "tests" EXCLUDE
)
install(
FILES ../${PROJECT_NAME}.hpp
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${CMAKE_PROJECT_NAME}
COMPONENT devel
)