forked from matrixworld/small3d
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conanfile.py
78 lines (67 loc) · 3.42 KB
/
conanfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
from conans import ConanFile, CMake
from conans.tools import ConanException
class Small3dConan(ConanFile):
name = "small3d"
version = "master"
description = "A small, cross-platform 3D game engine " + \
"(C++, OpenGL, GLFW) - runs on Win/MacOS/Linux"
generators = "cmake"
settings = "os", "arch", "build_type", "compiler"
options = {"development": [True, False]}
default_options = "gtest:shared=False", "development=False"
url="http://github.com/dimi309/conan-packages"
requires = "glfw/3.2.1@bincrafters/stable", \
"freetype/2.8.1@bincrafters/stable", "glm/0.9.8.5@g-truc/stable",\
"vorbis/master@dimi309/stable",\
"portaudio/v190600.20161030@bincrafters/stable",\
"glew/2.1.0@dimi309/stable"
license = "https://github.com/dimi309/small3d/blob/master/LICENSE"
exports_sources = ["small3d/*", "FindSMALL3D.cmake", "CMakeLists.txt"]
exports = ["LICENSE"]
def configure(self):
if self.settings.compiler == "gcc" and \
self.settings.compiler.libcxx != "libstdc++11":
raise ConanException("When using the gcc compiler, small3d " +\
"requires libstdc++11 as compiler.libcxx," +\
" in the conan.conf file or via the -s" +\
" parameter.")
if self.settings.os == "Linux" and \
self.settings.compiler == "clang" and \
self.settings.compiler.libcxx != "libstdc++11":
raise ConanException("When using the clang compiler on Linux," +\
" small3d requires libstdc++11 as " +\
"compiler.libcxx, in the conan.conf file" +\
" or via the -s parameter.")
if self.options.development:
self.requires("gtest/1.7.0@bincrafters/stable")
def build(self):
cmake = CMake(self)
cmake.definitions['BUILD_TESTS'] = self.options.development
cmake.configure()
cmake.build()
def package(self):
self.copy("FindSMALL3D.cmake", ".", ".")
self.copy(pattern="*", dst="shaders", \
src="%s/small3d/resources/shaders" % self.build_folder,\
keep_path=True)
self.copy(pattern="*.hpp", dst="include",\
src="%s/small3d/include" % self.build_folder, keep_path=True)
self.copy("LICENSE*", dst="licenses", ignore_case=True, keep_path=False)
if self.settings.compiler == "Visual Studio":
self.copy(pattern="*.pdb", dst="bin", keep_path=False)
self.copy(pattern="*.lib", dst="lib", keep_path=False)
else:
self.copy(pattern="*.a", dst="lib", keep_path=False)
def imports(self):
if self.options.development and self.settings.os == "Windows":
self.copy(pattern="*.dll", dst="bin", src="bin")
self.copy(pattern="*.pdb", dst="bin", src="bin")
def package_info(self):
self.cpp_info.libs = ['small3d']
if self.settings.os == "Windows":
if self.settings.compiler == "Visual Studio":
self.cpp_info.cppflags.append("/EHsc")
self.cpp_info.exelinkflags.append('-NODEFAULTLIB:LIBCMTD')
self.cpp_info.exelinkflags.append('-NODEFAULTLIB:LIBCMT')
else:
self.cpp_info.cppflags.append("-std=c++11")