summaryrefslogtreecommitdiff
path: root/conanfile.py
diff options
context:
space:
mode:
authorRobin Linden <dev@robinlinden.eu>2020-05-14 01:50:43 +0200
committerRobin Linden <dev@robinlinden.eu>2020-05-29 15:36:26 +0200
commit56992b099eb5b77adfca15678ada9ec4011d8dd3 (patch)
tree4500cb5650fccff7294de22a2f72743984292d83 /conanfile.py
parent03a511482ffa643a636cd5bcce596f110ca2d8e0 (diff)
Add support for the conan C/C++ package manager
* Don't overwrite the CMAKE_MODULE_PATH * Allow linking libsodium statically with MSVC * Allow finding libsodium the normal way on MSVC * Allow using pthreads4w for pthreads on MSVC * Fall back to find_package if pkg_find_module fails * Don't pass incompatible compile flags to MSVC * Also try to find Opus and libvpx using their canonical names * Support building using conan * Allow pkg_use_module to take a list of libraries to look for * Build for Windows on Appveyor using conan
Diffstat (limited to 'conanfile.py')
-rw-r--r--conanfile.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/conanfile.py b/conanfile.py
new file mode 100644
index 00000000..2beee180
--- /dev/null
+++ b/conanfile.py
@@ -0,0 +1,33 @@
1# pylint: disable=not-callable
2from conans import CMake
3from conans import ConanFile
4
5
6class ToxConan(ConanFile):
7 settings = "os", "compiler", "build_type", "arch"
8 requires = "libsodium/1.0.18", "opus/1.3.1", "libvpx/1.8.0@bincrafters/stable"
9 generators = "cmake_find_package"
10
11 def requirements(self):
12 if self.settings.os == "Windows":
13 self.requires("pthreads4w/3.0.0")
14
15 def source(self):
16 self.run("git clone https://github.com/toktok/c-toxcore.git")
17
18 def build(self):
19 cmake = CMake(self)
20 cmake.definitions["AUTOTEST"] = True
21 cmake.definitions["BUILD_MISC_TESTS"] = True
22 cmake.definitions["MUST_BUILD_TOXAV"] = True
23 if self.settings.compiler == "Visual Studio":
24 cmake.definitions["MSVC_STATIC_SODIUM"] = True
25
26 if self.should_configure:
27 cmake.configure()
28
29 if self.should_build:
30 cmake.build()
31
32 if self.should_test:
33 cmake.test()