mirror of
https://github.com/Perlmint/glew-cmake.git
synced 2024-11-26 16:41:57 +00:00
Support for building released versions added.
This commit is contained in:
parent
cf469ab200
commit
b7fbaec9b3
@ -4,8 +4,6 @@ env:
|
|||||||
- CONAN_USERNAME="nigels-com"
|
- CONAN_USERNAME="nigels-com"
|
||||||
- CONAN_REFERENCE="glew/master"
|
- CONAN_REFERENCE="glew/master"
|
||||||
- CONAN_CHANNEL="testing"
|
- 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
|
linux: &linux
|
||||||
os: linux
|
os: linux
|
||||||
@ -44,7 +42,12 @@ install:
|
|||||||
- chmod +x ./build/conan/.travis/install.sh
|
- chmod +x ./build/conan/.travis/install.sh
|
||||||
- ./build/conan/.travis/install.sh
|
- ./build/conan/.travis/install.sh
|
||||||
script:
|
script:
|
||||||
|
# Building master
|
||||||
- cp -rf ./build/conan/* .
|
- cp -rf ./build/conan/* .
|
||||||
- cp -rf ./build/conan/.travis .
|
- cp -rf ./build/conan/.travis .
|
||||||
- chmod +x .travis/run.sh
|
- chmod +x .travis/run.sh
|
||||||
- .travis/run.sh
|
- .travis/run.sh
|
||||||
|
|
||||||
|
# Building released version
|
||||||
|
#- chmod +x ./build/conan/.travis/run.sh
|
||||||
|
#- cd ./build/conan && .travis/run.sh
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
import os
|
import os
|
||||||
from conans import ConanFile, CMake
|
from conans import ConanFile, CMake
|
||||||
from conans.tools import os_info, SystemPackageTool, ConanException
|
from conans.tools import os_info, SystemPackageTool, ConanException
|
||||||
# from conans import tools, VisualStudioBuildEnvironment
|
from conans import tools, VisualStudioBuildEnvironment
|
||||||
from conans.tools import build_sln_command, vcvars_command, replace_in_file
|
from conans.tools import build_sln_command, vcvars_command, replace_in_file, download, unzip
|
||||||
|
|
||||||
class GlewConan(ConanFile):
|
class GlewConan(ConanFile):
|
||||||
name = "glew"
|
name = "glew"
|
||||||
version = "master"
|
version = "master"
|
||||||
|
source_directory = "%s-%s" % (name, version) if version != "master" else "."
|
||||||
description = "The GLEW library"
|
description = "The GLEW library"
|
||||||
generators = "cmake", "txt"
|
generators = "cmake", "txt"
|
||||||
settings = "os", "arch", "build_type", "compiler"
|
settings = "os", "arch", "build_type", "compiler"
|
||||||
@ -14,26 +15,31 @@ class GlewConan(ConanFile):
|
|||||||
default_options = "shared=False"
|
default_options = "shared=False"
|
||||||
url="http://github.com/nigels-com/glew"
|
url="http://github.com/nigels-com/glew"
|
||||||
license="https://github.com/nigels-com/glew#copyright-and-licensing"
|
license="https://github.com/nigels-com/glew#copyright-and-licensing"
|
||||||
if os.path.isfile("Makefile"):
|
if version == "master":
|
||||||
exports = "*"
|
if os.path.isfile("Makefile"):
|
||||||
|
exports = "*"
|
||||||
|
else:
|
||||||
|
exports = os.sep.join([".", "..", "..", "*"])
|
||||||
else:
|
else:
|
||||||
exports = os.sep.join([".", "..", "..", "*"])
|
exports = "FindGLEW.cmake"
|
||||||
|
|
||||||
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")
|
if self.version == "master":
|
||||||
installer.install("libxmu-dev")
|
installer.install("build-essential")
|
||||||
installer.install("libxi-dev")
|
installer.install("libxmu-dev")
|
||||||
installer.install("libgl-dev")
|
installer.install("libxi-dev")
|
||||||
installer.install("libosmesa-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")
|
if self.version == "master":
|
||||||
installer.install("libXi-devel")
|
installer.install("libXmu-devel")
|
||||||
installer.install("libGL-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.")
|
||||||
@ -41,31 +47,44 @@ class GlewConan(ConanFile):
|
|||||||
def configure(self):
|
def configure(self):
|
||||||
del self.settings.compiler.libcxx
|
del self.settings.compiler.libcxx
|
||||||
|
|
||||||
|
def source(self):
|
||||||
|
if self.version != "master":
|
||||||
|
zip_name = "%s.tgz" % self.source_directory
|
||||||
|
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.os == "Windows" and self.version == "master":
|
||||||
|
raise ConanException("Trunk builds are not supported on Windows (cannot build directly from master git repository).")
|
||||||
|
|
||||||
if self.settings.compiler == "Visual Studio":
|
if self.settings.compiler == "Visual Studio":
|
||||||
raise ConanException("Windows builds do not work yet.")
|
env = VisualStudioBuildEnvironment(self)
|
||||||
# env = VisualStudioBuildEnvironment(self)
|
with tools.environment_append(env.vars):
|
||||||
# with tools.environment_append(env.vars):
|
version = min(12, int(self.settings.compiler.version.value))
|
||||||
# version = min(12, int(self.settings.compiler.version.value))
|
version = 10 if version == 11 else version
|
||||||
# version = 10 if version == 11 else version
|
cd_build = "cd %s\\%s\\build\\vc%s" % (self.conanfile_directory, self.source_directory, 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")
|
||||||
# build_command = build_sln_command(self.settings, "glew.sln")
|
vcvars = vcvars_command(self.settings)
|
||||||
# vcvars = vcvars_command(self.settings)
|
self.run("%s && %s && %s" % (vcvars, cd_build, build_command.replace("x86", "Win32")))
|
||||||
# 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.conanfile_directory, \
|
replace_in_file("%s/build/cmake/CMakeLists.txt" % self.source_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")
|
|
||||||
|
if self.version == "master":
|
||||||
|
self.run("make extensions")
|
||||||
|
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
cmake.configure(source_dir="%s/build/cmake" % self.conanfile_directory, defs={"BUILD_UTILS": "OFF"})
|
cmake.configure(source_dir="%s/build/cmake" % self.source_directory, defs={"BUILD_UTILS": "OFF"})
|
||||||
cmake.build()
|
cmake.build()
|
||||||
|
|
||||||
def package(self):
|
def package(self):
|
||||||
self.copy("FindGLEW.cmake", ".", "%s/build/conan" % self.conanfile_directory, keep_path=False)
|
find_glew_dir = "%s/build/conan" % self.conanfile_directory if self.version == "master" else "."
|
||||||
self.copy("include/*", ".", ".", keep_path=True)
|
self.copy("FindGLEW.cmake", ".", find_glew_dir, keep_path=False)
|
||||||
self.copy("license*", src=".", dst="licenses", ignore_case=True, keep_path=False)
|
self.copy("include/*", ".", "%s" % self.source_directory, keep_path=True)
|
||||||
|
self.copy("%s/license*" % self.source_directory, 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":
|
||||||
|
Loading…
Reference in New Issue
Block a user