toxcore/conanfile.py
Robin Linden 56992b099e
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
2020-05-29 15:36:26 +02:00

34 lines
990 B
Python

# pylint: disable=not-callable
from conans import CMake
from conans import ConanFile
class ToxConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
requires = "libsodium/1.0.18", "opus/1.3.1", "libvpx/1.8.0@bincrafters/stable"
generators = "cmake_find_package"
def requirements(self):
if self.settings.os == "Windows":
self.requires("pthreads4w/3.0.0")
def source(self):
self.run("git clone https://github.com/toktok/c-toxcore.git")
def build(self):
cmake = CMake(self)
cmake.definitions["AUTOTEST"] = True
cmake.definitions["BUILD_MISC_TESTS"] = True
cmake.definitions["MUST_BUILD_TOXAV"] = True
if self.settings.compiler == "Visual Studio":
cmake.definitions["MSVC_STATIC_SODIUM"] = True
if self.should_configure:
cmake.configure()
if self.should_build:
cmake.build()
if self.should_test:
cmake.test()