mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-26 16:41:57 +00:00
Added conan packaging support.
This commit is contained in:
parent
25bc79f2b9
commit
cf469ab200
75
.travis.yml
75
.travis.yml
@ -1,29 +1,50 @@
|
|||||||
language: cpp
|
|
||||||
sudo: false
|
env:
|
||||||
|
global:
|
||||||
|
- CONAN_USERNAME="nigels-com"
|
||||||
|
- CONAN_REFERENCE="glew/master"
|
||||||
|
- CONAN_CHANNEL="testing"
|
||||||
|
- CONAN_REMOTES="https://api.bintray.com/conan/dimi309/conan-packages"
|
||||||
|
- CONAN_UPLOAD="https://api.bintray.com/conan/dimi309/conan-packages"
|
||||||
|
|
||||||
|
linux: &linux
|
||||||
|
os: linux
|
||||||
|
sudo: required
|
||||||
|
language: python
|
||||||
|
python: "2.7"
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
osx: &osx
|
||||||
|
os: osx
|
||||||
|
language: generic
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
|
||||||
|
- <<: *linux
|
||||||
|
env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=lasote/conangcc49
|
||||||
|
- <<: *linux
|
||||||
|
env: CONAN_GCC_VERSIONS=5.4 CONAN_DOCKER_IMAGE=lasote/conangcc54
|
||||||
|
- <<: *linux
|
||||||
|
env: CONAN_GCC_VERSIONS=6.3 CONAN_DOCKER_IMAGE=lasote/conangcc63
|
||||||
|
- <<: *linux
|
||||||
|
env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=lasote/conanclang39
|
||||||
|
- <<: *linux
|
||||||
|
env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=lasote/conanclang40
|
||||||
|
- <<: *osx
|
||||||
|
osx_image: xcode7.3
|
||||||
|
env: CONAN_APPLE_CLANG_VERSIONS=7.3
|
||||||
|
- <<: *osx
|
||||||
|
osx_image: xcode8.2
|
||||||
|
env: CONAN_APPLE_CLANG_VERSIONS=8.0
|
||||||
|
- <<: *osx
|
||||||
|
osx_image: xcode8.3
|
||||||
|
env: CONAN_APPLE_CLANG_VERSIONS=8.1
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- chmod +x ./build/conan/.travis/install.sh
|
||||||
|
- ./build/conan/.travis/install.sh
|
||||||
script:
|
script:
|
||||||
- make -C auto clobber
|
- cp -rf ./build/conan/* .
|
||||||
- make extensions
|
- cp -rf ./build/conan/.travis .
|
||||||
- make dist-src
|
- chmod +x .travis/run.sh
|
||||||
- make clean; SYSTEM=linux make
|
- .travis/run.sh
|
||||||
- make clean; SYSTEM=linux-osmesa make
|
|
||||||
- make clean; SYSTEM=linux-egl make
|
|
||||||
- make clean; SYSTEM=linux-clang make
|
|
||||||
- make clean; SYSTEM=linux-clang-egl make
|
|
||||||
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' . ; make; popd
|
|
||||||
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' -DGLEW_OSMESA=1 . ; make; popd
|
|
||||||
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' -DGLEW_EGL=1 . ; make; popd
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- git
|
|
||||||
- cmake
|
|
||||||
- dos2unix
|
|
||||||
- libosmesa6-dev
|
|
||||||
- libegl1-mesa-dev
|
|
||||||
artifacts:
|
|
||||||
bucket: glew
|
|
||||||
s3_region: "us-east-1"
|
|
||||||
paths:
|
|
||||||
- $(ls *.zip *.tgz | tr "\n" ":")
|
|
||||||
- $(find doc -type f | tr "\n" ":")
|
|
||||||
|
29
.travis.yml.main
Normal file
29
.travis.yml.main
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
language: cpp
|
||||||
|
sudo: false
|
||||||
|
install:
|
||||||
|
script:
|
||||||
|
- make -C auto clobber
|
||||||
|
- make extensions
|
||||||
|
- make dist-src
|
||||||
|
- make clean; SYSTEM=linux make
|
||||||
|
- make clean; SYSTEM=linux-osmesa make
|
||||||
|
- make clean; SYSTEM=linux-egl make
|
||||||
|
- make clean; SYSTEM=linux-clang make
|
||||||
|
- make clean; SYSTEM=linux-clang-egl make
|
||||||
|
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' . ; make; popd
|
||||||
|
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' -DGLEW_OSMESA=1 . ; make; popd
|
||||||
|
- pushd build/cmake; git clean -xdf .; cmake -G 'Unix Makefiles' -DGLEW_EGL=1 . ; make; popd
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- git
|
||||||
|
- cmake
|
||||||
|
- dos2unix
|
||||||
|
- libosmesa6-dev
|
||||||
|
- libegl1-mesa-dev
|
||||||
|
artifacts:
|
||||||
|
bucket: glew
|
||||||
|
s3_region: "us-east-1"
|
||||||
|
paths:
|
||||||
|
- $(ls *.zip *.tgz | tr "\n" ":")
|
||||||
|
- $(find doc -type f | tr "\n" ":")
|
24
build/conan/.travis/install.sh
Normal file
24
build/conan/.travis/install.sh
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == 'Darwin' ]]; then
|
||||||
|
brew update || brew update
|
||||||
|
brew outdated pyenv || brew upgrade pyenv
|
||||||
|
brew install pyenv-virtualenv
|
||||||
|
brew install cmake || true
|
||||||
|
|
||||||
|
if which pyenv > /dev/null; then
|
||||||
|
eval "$(pyenv init -)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
pyenv install 2.7.10
|
||||||
|
pyenv virtualenv 2.7.10 conan
|
||||||
|
pyenv rehash
|
||||||
|
pyenv activate conan
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
pip install conan_package_tools
|
||||||
|
conan user
|
13
build/conan/.travis/run.sh
Executable file
13
build/conan/.travis/run.sh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
set -x
|
||||||
|
|
||||||
|
if [[ "$(uname -s)" == 'Darwin' ]]; then
|
||||||
|
if which pyenv > /dev/null; then
|
||||||
|
eval "$(pyenv init -)"
|
||||||
|
fi
|
||||||
|
pyenv activate conan
|
||||||
|
fi
|
||||||
|
|
||||||
|
python build.py
|
12
build/conan/build.py
Normal file
12
build/conan/build.py
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
from conan.packager import ConanMultiPackager
|
||||||
|
import os, platform
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
builder = ConanMultiPackager(args="--build missing")
|
||||||
|
builder.add_common_builds()
|
||||||
|
filtered_builds = []
|
||||||
|
for settings, options, env_vars, build_requires in builder.builds:
|
||||||
|
if not (settings["arch"] == "x86"):
|
||||||
|
filtered_builds.append([settings, options, env_vars, build_requires])
|
||||||
|
builder.builds = filtered_builds
|
||||||
|
builder.run()
|
@ -1,28 +1,39 @@
|
|||||||
import os
|
import os
|
||||||
from conans import ConanFile, CMake, VisualStudioBuildEnvironment, tools
|
from conans import ConanFile, CMake
|
||||||
from conans.tools import build_sln_command, vcvars_command, download, unzip, replace_in_file, os_info, SystemPackageTool
|
from conans.tools import os_info, SystemPackageTool, ConanException
|
||||||
|
# from conans import tools, VisualStudioBuildEnvironment
|
||||||
|
from conans.tools import build_sln_command, vcvars_command, replace_in_file
|
||||||
|
|
||||||
class GlewConan(ConanFile):
|
class GlewConan(ConanFile):
|
||||||
name = "glew"
|
name = "glew"
|
||||||
version = "2.0.0"
|
version = "master"
|
||||||
description = "The GLEW library"
|
description = "The GLEW library"
|
||||||
ZIP_FOLDER_NAME = "%s-%s" % (name, version)
|
|
||||||
generators = "cmake", "txt"
|
generators = "cmake", "txt"
|
||||||
settings = "os", "arch", "build_type", "compiler"
|
settings = "os", "arch", "build_type", "compiler"
|
||||||
options = {"shared": [True, False]}
|
options = {"shared": [True, False]}
|
||||||
default_options = "shared=False"
|
default_options = "shared=False"
|
||||||
url="http://github.com/dimi309/conan-packages"
|
url="http://github.com/nigels-com/glew"
|
||||||
requires = ""
|
|
||||||
license="https://github.com/nigels-com/glew#copyright-and-licensing"
|
license="https://github.com/nigels-com/glew#copyright-and-licensing"
|
||||||
exports = "FindGLEW.cmake"
|
if os.path.isfile("Makefile"):
|
||||||
|
exports = "*"
|
||||||
|
else:
|
||||||
|
exports = os.sep.join([".", "..", "..", "*"])
|
||||||
|
|
||||||
def system_requirements(self):
|
def system_requirements(self):
|
||||||
if os_info.is_linux:
|
if os_info.is_linux:
|
||||||
if os_info.with_apt:
|
if os_info.with_apt:
|
||||||
installer = SystemPackageTool()
|
installer = SystemPackageTool()
|
||||||
|
installer.install("build-essential")
|
||||||
|
installer.install("libxmu-dev")
|
||||||
|
installer.install("libxi-dev")
|
||||||
|
installer.install("libgl-dev")
|
||||||
|
installer.install("libosmesa-dev")
|
||||||
installer.install("libglu1-mesa-dev")
|
installer.install("libglu1-mesa-dev")
|
||||||
elif os_info.with_yum:
|
elif os_info.with_yum:
|
||||||
installer = SystemPackageTool()
|
installer = SystemPackageTool()
|
||||||
|
installer.install("libXmu-devel")
|
||||||
|
installer.install("libXi-devel")
|
||||||
|
installer.install("libGL-devel")
|
||||||
installer.install("mesa-libGLU-devel")
|
installer.install("mesa-libGLU-devel")
|
||||||
else:
|
else:
|
||||||
self.output.warn("Could not determine Linux package manager, skipping system requirements installation.")
|
self.output.warn("Could not determine Linux package manager, skipping system requirements installation.")
|
||||||
@ -30,35 +41,31 @@ class GlewConan(ConanFile):
|
|||||||
def configure(self):
|
def configure(self):
|
||||||
del self.settings.compiler.libcxx
|
del self.settings.compiler.libcxx
|
||||||
|
|
||||||
def source(self):
|
|
||||||
zip_name = "%s.tgz" % self.ZIP_FOLDER_NAME
|
|
||||||
download("https://sourceforge.net/projects/glew/files/glew/%s/%s/download" % (self.version, zip_name), zip_name)
|
|
||||||
unzip(zip_name)
|
|
||||||
os.unlink(zip_name)
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
if self.settings.compiler == "Visual Studio":
|
if self.settings.compiler == "Visual Studio":
|
||||||
env = VisualStudioBuildEnvironment(self)
|
raise ConanException("Windows builds do not work yet.")
|
||||||
with tools.environment_append(env.vars):
|
# env = VisualStudioBuildEnvironment(self)
|
||||||
version = min(12, int(self.settings.compiler.version.value))
|
# with tools.environment_append(env.vars):
|
||||||
version = 10 if version == 11 else version
|
# version = min(12, int(self.settings.compiler.version.value))
|
||||||
cd_build = "cd %s\\%s\\build\\vc%s" % (self.conanfile_directory, self.ZIP_FOLDER_NAME, version)
|
# version = 10 if version == 11 else version
|
||||||
build_command = build_sln_command(self.settings, "glew.sln")
|
# cd_build = "cd %s\\%s\\build\\vc%s" % (self.conanfile_directory, self.ZIP_FOLDER_NAME, version)
|
||||||
vcvars = vcvars_command(self.settings)
|
# build_command = build_sln_command(self.settings, "glew.sln")
|
||||||
self.run("%s && %s && %s" % (vcvars, cd_build, build_command.replace("x86", "Win32")))
|
# vcvars = vcvars_command(self.settings)
|
||||||
|
# self.run("%s && %s && %s" % (vcvars, cd_build, build_command.replace("x86", "Win32")))
|
||||||
else:
|
else:
|
||||||
if self.settings.os == "Windows":
|
if self.settings.os == "Windows":
|
||||||
replace_in_file("%s/build/cmake/CMakeLists.txt" % self.ZIP_FOLDER_NAME, \
|
replace_in_file("%s/build/cmake/CMakeLists.txt" % self.conanfile_directory, \
|
||||||
"if(WIN32 AND (NOT MSVC_VERSION LESS 1600)", \
|
"if(WIN32 AND (NOT MSVC_VERSION LESS 1600)", \
|
||||||
"if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600)")
|
"if(WIN32 AND MSVC AND (NOT MSVC_VERSION LESS 1600)")
|
||||||
|
self.run("make extensions")
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
cmake.configure(source_dir="%s/build/cmake" % self.ZIP_FOLDER_NAME, defs={"BUILD_UTILS": "OFF"})
|
cmake.configure(source_dir="%s/build/cmake" % self.conanfile_directory, defs={"BUILD_UTILS": "OFF"})
|
||||||
cmake.build()
|
cmake.build()
|
||||||
|
|
||||||
def package(self):
|
def package(self):
|
||||||
self.copy("FindGLEW.cmake", ".", ".")
|
self.copy("FindGLEW.cmake", ".", "%s/build/conan" % self.conanfile_directory, keep_path=False)
|
||||||
self.copy("include/*", ".", "%s" % (self.ZIP_FOLDER_NAME), keep_path=True)
|
self.copy("include/*", ".", ".", keep_path=True)
|
||||||
self.copy("%s/license*" % self.ZIP_FOLDER_NAME, dst="licenses", ignore_case=True, keep_path=False)
|
self.copy("license*", src=".", dst="licenses", ignore_case=True, keep_path=False)
|
||||||
|
|
||||||
if self.settings.os == "Windows":
|
if self.settings.os == "Windows":
|
||||||
if self.settings.compiler == "Visual Studio":
|
if self.settings.compiler == "Visual Studio":
|
||||||
|
@ -2,11 +2,11 @@ from conans import ConanFile, CMake
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
channel = os.getenv("CONAN_CHANNEL", "testing")
|
channel = os.getenv("CONAN_CHANNEL", "testing")
|
||||||
username = os.getenv("CONAN_USERNAME", "dimi309")
|
username = os.getenv("CONAN_USERNAME", "nigels-com")
|
||||||
|
|
||||||
class TestGlew(ConanFile):
|
class TestGlew(ConanFile):
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
requires = "glew/2.0.0@%s/%s" % (username, channel)
|
requires = "glew/master@%s/%s" % (username, channel)
|
||||||
generators = "cmake"
|
generators = "cmake"
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user