Skip to content
Snippets Groups Projects
Commit 5818f672 authored by Tim Übelhör's avatar Tim Übelhör
Browse files

created conan package

parent b0e86b58
No related branches found
No related tags found
No related merge requests found
install/
build/
log/
install
build
log
*.blend1
\ No newline at end of file
cmake_minimum_required(VERSION 3.12)
project(scigl_render)
# Default ROS2 configurations for compilation
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
cmake_minimum_required(VERSION 2.8.3)
# using conan to manage dependencies
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
......@@ -13,15 +8,15 @@ if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/v0.13/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(
REQUIRES
Assimp/4.1.0@jacmoe/stable
gl3w/0.1@tuebel/experimental
glm/0.9.9.1@g-truc/stable
glfw/3.2.1@bincrafters/stable
BASIC_SETUP CMAKE_TARGETS
BUILD missing)
if(CONAN_EXPORTED) # when packaging
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
else() # in user space
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.py
BASIC_SETUP
BUILD missing)
endif()
# prefer new ABI for OpenGL
set(OpenGL_GL_PREFERENCE "GLVND")
......@@ -41,15 +36,8 @@ target_sources(scigl_render PRIVATE
src/shader/depth_shader.cpp
src/shader/shader.cpp
src/shader/single_texture_shader.cpp)
target_include_directories(scigl_render PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(scigl_render PUBLIC
CONAN_PKG::gl3w
CONAN_PKG::glfw
CONAN_PKG::glm
CONAN_PKG::Assimp)
target_compile_options(scigl_render PRIVATE -Wall -Wextra)
target_include_directories(scigl_render PUBLIC include)
target_link_libraries(scigl_render ${CONAN_LIBS})
# example apps
add_executable(scigl_viewer
......@@ -63,31 +51,3 @@ add_executable(scigl_depth_viewer
src/example/example_render.cpp)
target_link_libraries(scigl_depth_viewer
scigl_render)
# install target
install(DIRECTORY include/scigl_render DESTINATION include)
install(TARGETS scigl_render scigl_viewer scigl_depth_viewer
EXPORT scigl_render_targets
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
RUNTIME DESTINATION bin
INCLUDES DESTINATION include)
# versioning
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
scigl_renderConfigVersion.cmake
VERSION 0.1
COMPATIBILITY AnyNewerVersion)
# for find_package support
install(EXPORT scigl_render_targets
FILE scigl_render_targets.cmake
DESTINATION lib/cmake/scigl_render)
configure_file(scigl_renderConfig.cmake.in scigl_renderConfig.cmake @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/scigl_renderConfigVersion.cmake"
DESTINATION lib/cmake/scigl_render)
# export for source tree
export(TARGETS scigl_render FILE scigl_render_targets.cmake)
export(PACKAGE scigl_render)
......@@ -9,7 +9,7 @@ in ROS2.
The dependencies are handled via [conan.io](https://conan.io/).
Please add the following repositories:
```bash
conan remote add tuebel https://api.bintray.com/conan/tuebel/gl3w
conan remote add tuebel-gl3w https://api.bintray.com/conan/tuebel/gl3w
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
conan remote add conan-transit https://api.bintray.com/conan/conan/conan-transit
```
......
from conans import ConanFile, CMake
class SciglRenderConan(ConanFile):
name = "scigl_render"
version = "0.1"
license = "MIT"
url = "https://git.rwth-aachen.de/robo_guide/scigl_render"
description = ("Library to simplify rendering objects via OpenGL."
"The intendet use case is scientific "
"(e.g. probabalistic filtering).")
settings = "os", "compiler", "build_type", "arch"
requires = ("Assimp/4.1.0@jacmoe/stable",
"gl3w/0.2@tuebel/testing",
"glm/0.9.9.1@g-truc/stable",
"glfw/3.2.1@bincrafters/stable")
generators = "cmake"
exports = "CMakeLists.txt"
exports_sources = "src/*", "include/*"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = "shared=False", "fPIC=True"
def configure(self):
if self.settings.compiler == 'Visual Studio':
del self.options.fPIC
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
self.copy("*.h", dst="include", src="include", keep_path=True)
self.copy("*.hpp", dst="include", src="include", keep_path=True)
self.copy("*.lib", dst="lib", keep_path=False)
self.copy("*.dll", dst="bin", keep_path=False)
self.copy("*.dylib*", dst="lib", keep_path=False)
self.copy("*.so", dst="lib", keep_path=False)
self.copy("*.a", dst="lib", keep_path=False)
def package_info(self):
self.cpp_info.libs = ["scigl_render"]
......@@ -20,6 +20,7 @@
<doc_depend>doxygen</doc_depend>
<buildtool_depend>cmake</buildtool_depend>
<buildtool_depend>conan</buildtool_depend>
<build_depend>gl3w</build_depend>
<depend>OpenGL</depend>
<depend>glfw</depend>
......
get_filename_component(scigl_render_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(scigle_render_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@")
include(CMakeFindDependencyMacro)
find_dependency(gl3w REQUIRED)
find_dependency(glfw3 REQUIRED)
find_dependency(assimp REQUIRED)
find_dependency(glm REQUIRED)
if(NOT TARGET scigl_render)
include(${CMAKE_CURRENT_LIST_DIR}/scigl_render_targets.cmake)
endif()
set(scigl_render_LIBRARIES scigl_render)
set(scigl_render_EXECUTABLE scigl_viewer scigl_depth_viewer)
\ No newline at end of file
project(PackageTest)
cmake_minimum_required(VERSION 2.8.12)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(example example.cpp)
target_link_libraries(example ${CONAN_LIBS})
from conans import ConanFile, CMake
import os
class Gl3wTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = "shared=False", "fPIC=True"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
def test(self):
os.chdir("bin")
self.run(".%sexample" % os.sep)
#include <cstdlib>
#include <scigl_render/gl_context.hpp>
int main(int argc, char **argv)
{
scigl_render::GLContext gl_context(true, false, 640, 480);
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment