Build: add GCC-13, Clang-14, Clang-15, Clang-16, Clang-17
[marnav.git] / conanfile.py
blobbde31aaf21a88b70c4021f5edcaa609461615fef
1 from conans import ConanFile, CMake, tools
2 import os, re
5 class Package(ConanFile):
6 license = "BSD"
7 description = "This is a C++ library for MARitime NAVigation purposes."
8 url = "https://github.com/mariokonrad/marnav"
10 settings = "os", "arch", "compiler", "build_type"
12 options = {"shared": [True, False]}
13 default_options = {"shared": False}
15 exports_sources = [
16 'LICENSE',
17 'CMakeLists.txt',
18 'README.md',
19 'include/*',
20 'src/*',
21 'cmake/*',
22 'doc/*'
25 __cmake = None
27 def __cmake_info(self):
28 cmakelists = tools.load(os.path.join(self.recipe_folder, 'CMakeLists.txt'))
29 result = re.search(r'project\s*\(\s*([a-zA-Z0-9-_]+)\s+\bVERSION\b\s+(\d+\.\d+\.\d+)(.|\s)*\)',
30 cmakelists)
31 return result.group(1), result.group(2)
33 def __setup_cmake(self):
34 if not self.__cmake:
35 self.__cmake = CMake(self)
36 self.__cmake.definitions['ENABLE_PROFILING'] = "FALSE"
37 self.__cmake.definitions['ENABLE_BENCHMARK'] = "FALSE"
38 self.__cmake.definitions['ENABLE_SANITIZER'] = "FALSE"
39 self.__cmake.definitions['ENABLE_EXAMPLES'] = "FALSE"
40 self.__cmake.definitions['ENABLE_TESTS'] = "FALSE"
41 self.__cmake.definitions['ENABLE_TOOLS'] = "FALSE"
42 self.__cmake.definitions['ENABLE_IWYU'] = "FALSE"
43 return self.__cmake
45 def set_name(self):
46 name, version = self.__cmake_info()
47 self.name = name
49 def set_version(self):
50 name, version = self.__cmake_info()
51 self.version = version
53 def build(self):
54 cmake = self.__setup_cmake()
55 cmake.configure()
56 cmake.build()
58 def package(self):
59 cmake = self.__setup_cmake()
60 cmake.configure()
61 cmake.install()
63 def package_info(self):
64 self.cpp_info.libs = [self.name]