Commit e503b4c9 authored by Tim Übelhör's avatar Tim Übelhör

cleaned up cmake files

parent 18331a5e
......@@ -71,5 +71,6 @@
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"C_Cpp.configurationWarnings": "Disabled"
"C_Cpp.configurationWarnings": "Disabled",
"ros.distro": "melodic"
}
\ No newline at end of file
cmake_minimum_required(VERSION 2.8.3)
project(scigl_render)
cmake_minimum_required(VERSION 2.8.3)
set (CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 11)
set(SCIGL_RENDER_VERSION 0.6.1)
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
find_package(gl3w REQUIRED)
find_package(assimp REQUIRED)
find_package(glfw3 REQUIRED)
......@@ -14,7 +18,11 @@ set(OpenGL_GL_PREFERENCE "GLVND")
# -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# use GNUInstalDirs for CMAKE_INSTALL_ variables
include(GNUInstallDirs)
# the core library
set (scigl_render_INCLUDE_DIRS include)
add_library(scigl_render
src/gl_context.cpp
src/buffer/frame_buffer.cpp
......@@ -33,8 +41,8 @@ add_library(scigl_render
src/shader/shader_builder.cpp
src/shader/single_color_shader.cpp)
target_include_directories(scigl_render PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${scigl_render_INCLUDE_DIRS}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
target_link_libraries(scigl_render
PUBLIC assimp glfw glm gl3w)
......@@ -50,41 +58,45 @@ add_executable(scigl_depth_viewer
target_link_libraries(scigl_depth_viewer
scigl_render)
# install, use GNUInstalDirs for CMAKE_INSTALL_ variables
include(GNUInstallDirs)
# install
install(TARGETS scigl_render scigl_viewer scigl_depth_viewer
EXPORT scigl_renderTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(DIRECTORY include/scigl_render
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
INSTALL(
DIRECTORY include/scigl_render
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
# CMake package
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfigVersion.cmake
VERSION ${SCIGL_RENDER_VERSION}
COMPATIBILITY SameMajorVersion)
export(EXPORT scigl_renderTargets
FILE ${CMAKE_CURRENT_BINARY_DIR}/scigl_renderTargets.cmake
NAMESPACE scigl_render::)
# in tree build
set (scigl_render_INCLUDE_DIRS "include")
set(ConfigPackageLocation ${CMAKE_INSTALL_DATAROOTDIR}/scigl_render/cmake)
configure_package_config_file(
scigl_renderConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/scigl_render/cmake
INSTALL_DESTINATION ${ConfigPackageLocation}
PATH_VARS scigl_render_INCLUDE_DIRS)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfigVersion.cmake
VERSION ${SCIGL_RENDER_VERSION}
COMPATIBILITY SameMajorVersion)
export(TARGETS scigl_render
FILE ${CMAKE_CURRENT_BINARY_DIR}/scigl_renderTargets.cmake)
export(PACKAGE scigl_render)
# out of tree build
install (EXPORT scigl_renderTargets
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/scigl_render/cmake FILE "scigl_renderTargets.cmake" )
install(EXPORT scigl_renderTargets
FILE
scigl_renderTargets.cmake
NAMESPACE
scigl_render::
DESTINATION
${ConfigPackageLocation})
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfigVersion.cmake
DESTINATION
${CMAKE_INSTALL_DATAROOTDIR}/scigl_render/cmake)
${ConfigPackageLocation})
from cpt.packager import ConanMultiPackager
if __name__ == "__main__":
builder = ConanMultiPackager(
username='tuebel', channel="testing", stable_channel="testing",
gcc_versions=['7'], archs=['x86_64'])
builder.add_common_builds()
builder.run()
\ No newline at end of file
@PACKAGE_INIT@
set_and_check(scigl_render_INCLUDE_DIRS "@PACKAGE_scigl_render_INCLUDE_DIRS@")
set_and_check(SCIGL_RENDER_INCLUDE_DIRS "@PACKAGE_scigl_render_INCLUDE_DIRS@")
include (${CMAKE_CURRENT_LIST_DIR}/scigl_renderTargets.cmake)
check_required_components(Foo)
\ No newline at end of file
include(${CMAKE_CURRENT_LIST_DIR}/scigl_renderTargets.cmake)
check_required_components(scigl_render)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment