mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-30 02:17:07 +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:
|
||||
- chmod +x ./build/conan/.travis/install.sh
|
||||
- ./build/conan/.travis/install.sh
|
||||
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" ":")
|
||||
- cp -rf ./build/conan/* .
|
||||
- cp -rf ./build/conan/.travis .
|
||||
- chmod +x .travis/run.sh
|
||||
- .travis/run.sh
|
||||
|
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
|
||||
from conans import ConanFile, CMake, VisualStudioBuildEnvironment, tools
|
||||
from conans.tools import build_sln_command, vcvars_command, download, unzip, replace_in_file, os_info, SystemPackageTool
|
||||
from conans import ConanFile, CMake
|
||||
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):
|
||||
name = "glew"
|
||||
version = "2.0.0"
|
||||
version = "master"
|
||||
description = "The GLEW library"
|
||||
ZIP_FOLDER_NAME = "%s-%s" % (name, version)
|
||||
generators = "cmake", "txt"
|
||||
settings = "os", "arch", "build_type", "compiler"
|
||||
options = {"shared": [True, False]}
|
||||
default_options = "shared=False"
|
||||
url="http://github.com/dimi309/conan-packages"
|
||||
requires = ""
|
||||
url="http://github.com/nigels-com/glew"
|
||||
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):
|
||||
if os_info.is_linux:
|
||||
if os_info.with_apt:
|
||||
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")
|
||||
elif os_info.with_yum:
|
||||
installer = SystemPackageTool()
|
||||
installer.install("libXmu-devel")
|
||||
installer.install("libXi-devel")
|
||||
installer.install("libGL-devel")
|
||||
installer.install("mesa-libGLU-devel")
|
||||
else:
|
||||
self.output.warn("Could not determine Linux package manager, skipping system requirements installation.")
|
||||
@ -30,35 +41,31 @@ class GlewConan(ConanFile):
|
||||
def configure(self):
|
||||
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):
|
||||
if self.settings.compiler == "Visual Studio":
|
||||
env = VisualStudioBuildEnvironment(self)
|
||||
with tools.environment_append(env.vars):
|
||||
version = min(12, int(self.settings.compiler.version.value))
|
||||
version = 10 if version == 11 else version
|
||||
cd_build = "cd %s\\%s\\build\\vc%s" % (self.conanfile_directory, self.ZIP_FOLDER_NAME, version)
|
||||
build_command = build_sln_command(self.settings, "glew.sln")
|
||||
vcvars = vcvars_command(self.settings)
|
||||
self.run("%s && %s && %s" % (vcvars, cd_build, build_command.replace("x86", "Win32")))
|
||||
raise ConanException("Windows builds do not work yet.")
|
||||
# env = VisualStudioBuildEnvironment(self)
|
||||
# with tools.environment_append(env.vars):
|
||||
# version = min(12, int(self.settings.compiler.version.value))
|
||||
# version = 10 if version == 11 else version
|
||||
# cd_build = "cd %s\\%s\\build\\vc%s" % (self.conanfile_directory, self.ZIP_FOLDER_NAME, version)
|
||||
# build_command = build_sln_command(self.settings, "glew.sln")
|
||||
# vcvars = vcvars_command(self.settings)
|
||||
# self.run("%s && %s && %s" % (vcvars, cd_build, build_command.replace("x86", "Win32")))
|
||||
else:
|
||||
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 MSVC AND (NOT MSVC_VERSION LESS 1600)")
|
||||
self.run("make extensions")
|
||||
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()
|
||||
|
||||
def package(self):
|
||||
self.copy("FindGLEW.cmake", ".", ".")
|
||||
self.copy("include/*", ".", "%s" % (self.ZIP_FOLDER_NAME), keep_path=True)
|
||||
self.copy("%s/license*" % self.ZIP_FOLDER_NAME, dst="licenses", ignore_case=True, keep_path=False)
|
||||
self.copy("FindGLEW.cmake", ".", "%s/build/conan" % self.conanfile_directory, keep_path=False)
|
||||
self.copy("include/*", ".", ".", keep_path=True)
|
||||
self.copy("license*", src=".", dst="licenses", ignore_case=True, keep_path=False)
|
||||
|
||||
if self.settings.os == "Windows":
|
||||
if self.settings.compiler == "Visual Studio":
|
||||
|
@ -2,11 +2,11 @@ from conans import ConanFile, CMake
|
||||
import os
|
||||
|
||||
channel = os.getenv("CONAN_CHANNEL", "testing")
|
||||
username = os.getenv("CONAN_USERNAME", "dimi309")
|
||||
username = os.getenv("CONAN_USERNAME", "nigels-com")
|
||||
|
||||
class TestGlew(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
requires = "glew/2.0.0@%s/%s" % (username, channel)
|
||||
requires = "glew/master@%s/%s" % (username, channel)
|
||||
generators = "cmake"
|
||||
|
||||
def build(self):
|
||||
|
Loading…
Reference in New Issue
Block a user