From 37857b02fe6cfed4397557c0347ade6e0968bb5d Mon Sep 17 00:00:00 2001 From: dimitri Date: Sat, 24 Jun 2017 09:20:14 +0200 Subject: [PATCH] Added conan packaging configuration. --- util/conan-package/.gitignore | 18 +++++++++++++++++ util/conan-package/README.md | 8 ++++++++ util/conan-package/conanfile.py | 20 +++++++++++++++++++ util/conan-package/lib_licenses/LICENSE1.txt | 11 ++++++++++ util/conan-package/lib_licenses/LICENSE2.txt | 9 +++++++++ .../conan-package/test_package/CMakeLists.txt | 13 ++++++++++++ util/conan-package/test_package/conanfile.py | 19 ++++++++++++++++++ util/conan-package/test_package/main.cpp | 6 ++++++ 8 files changed, 104 insertions(+) create mode 100644 util/conan-package/.gitignore create mode 100644 util/conan-package/README.md create mode 100644 util/conan-package/conanfile.py create mode 100644 util/conan-package/lib_licenses/LICENSE1.txt create mode 100644 util/conan-package/lib_licenses/LICENSE2.txt create mode 100644 util/conan-package/test_package/CMakeLists.txt create mode 100644 util/conan-package/test_package/conanfile.py create mode 100644 util/conan-package/test_package/main.cpp diff --git a/util/conan-package/.gitignore b/util/conan-package/.gitignore new file mode 100644 index 00000000..d4478c02 --- /dev/null +++ b/util/conan-package/.gitignore @@ -0,0 +1,18 @@ +#Backup files +*\~ +*swp + +#OSX +Thumbs.db +.DS_Store + +#Emacs buffers +\#*\# +\.#* + +#Conan +test_package/build +conanfile.pyc +conaninfo.txt +conanbuildinfo.txt +conanbuildinfo.cmake \ No newline at end of file diff --git a/util/conan-package/README.md b/util/conan-package/README.md new file mode 100644 index 00000000..5c57221a --- /dev/null +++ b/util/conan-package/README.md @@ -0,0 +1,8 @@ +Conan package for the [GLM](https://github.com/g-truc/glm) library + +The package is hosted on [bintray](https://bintray.com/dimi309/conan-packages/glm%3Ag-truc). Until it gets accepted to the conan-center repository, in order to use it, you need to add this repository as a remote to your conan installation: + + conan remote add bintraydimi309 https://api.bintray.com/conan/dimi309/conan-packages + +It works on Windows (Visual Studio or MinGW), MacOS/OSX and Linux. + diff --git a/util/conan-package/conanfile.py b/util/conan-package/conanfile.py new file mode 100644 index 00000000..8d609a62 --- /dev/null +++ b/util/conan-package/conanfile.py @@ -0,0 +1,20 @@ +import os +from conans import ConanFile + +class GlmConan(ConanFile): + name = "glm" + version = "master" + generators = "txt" + url="https://github.com/g-truc/glm" + description="OpenGL Mathematics (GLM)" + license = "https://github.com/g-truc/glm/blob/manual/copying.txt" + exports = ["FindGLM.cmake", "lib_licenses/*", os.sep.join([".", "..", "..", "*"])] + + def build(self): + self.output.warn("No compilation necessary for GLM") + self.output.warn(os.sep.join([".", "..", "..", "*"])) + + def package(self): + self.copy("FindGLM.cmake", ".", ".") + self.copy("*", src="glm", dst=os.sep.join([".", "include", "glm"])) + self.copy("lib_licenses/license*", dst="licenses", ignore_case=True, keep_path=False) diff --git a/util/conan-package/lib_licenses/LICENSE1.txt b/util/conan-package/lib_licenses/LICENSE1.txt new file mode 100644 index 00000000..aa41c521 --- /dev/null +++ b/util/conan-package/lib_licenses/LICENSE1.txt @@ -0,0 +1,11 @@ +The Happy Bunny License (Modified MIT License) + +Copyright (c) 2005 - 2017 G-Truc Creation + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +Restrictions: By making use of the Software for military purposes, you choose to make a Bunny unhappy. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/conan-package/lib_licenses/LICENSE2.txt b/util/conan-package/lib_licenses/LICENSE2.txt new file mode 100644 index 00000000..d639ce8b --- /dev/null +++ b/util/conan-package/lib_licenses/LICENSE2.txt @@ -0,0 +1,9 @@ +The MIT License + +Copyright (c) 2005 - 2017 G-Truc Creation + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/conan-package/test_package/CMakeLists.txt b/util/conan-package/test_package/CMakeLists.txt new file mode 100644 index 00000000..c2b30814 --- /dev/null +++ b/util/conan-package/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +project(GlmTest) +cmake_minimum_required(VERSION 3.0.0) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +set(CMAKE_C_FLAGS "${CONAN_C_FLAGS}") +set(CMAKE_CXX_FLAGS "${CONAN_CXX_FLAGS}") +set(CMAKE_SHARED_LINKER_FLAGS "${CONAN_SHARED_LINKER_FLAGS}") + +add_executable(testGlm main.cpp) +TARGET_COMPILE_DEFINITIONS(testGlm PUBLIC "${CONAN_DEFINES}") +TARGET_LINK_LIBRARIES(testGlm PUBLIC "${CONAN_LIBS}") +SET_TARGET_PROPERTIES(testGlm PROPERTIES LINK_FLAGS "${CONAN_EXE_LINKER_FLAGS}") diff --git a/util/conan-package/test_package/conanfile.py b/util/conan-package/test_package/conanfile.py new file mode 100644 index 00000000..7189f150 --- /dev/null +++ b/util/conan-package/test_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +import os + +channel = os.getenv("CONAN_CHANNEL", "testing") +username = os.getenv("CONAN_USERNAME", "g-truc") + +class TestGlm(ConanFile): + settings = "os", "compiler", "build_type", "arch" + requires = "glm/master@%s/%s" % (username, channel) + generators = "cmake" + + def build(self): + cmake = CMake(self) + self.run('cmake "%s" %s' % (self.conanfile_directory, cmake.command_line)) + self.run("cmake --build . %s" % cmake.build_config) + + def test(self): + self.run(os.sep.join([".","bin", "testGlm"])) + diff --git a/util/conan-package/test_package/main.cpp b/util/conan-package/test_package/main.cpp new file mode 100644 index 00000000..70836fe9 --- /dev/null +++ b/util/conan-package/test_package/main.cpp @@ -0,0 +1,6 @@ +#include "glm/glm.hpp" + +int main (){ + glm::mat4x4 aMatrix; + return 0; +}