| 73 | # self.tool_requires("cmake/3.29.0") |
| 74 | |
| 75 | def generate(self): |
| 76 | tc = CMakeToolchain(self) |
| 77 | |
| 78 | tc.cache_variables["BUILD_CLI"] = bool(self.options.with_ruby) |
| 79 | tc.cache_variables["BUILD_RUBY_BINDINGS"] = bool(self.options.with_ruby) |
| 80 | tc.cache_variables["BUILD_PYTHON_BINDINGS"] = bool(self.options.with_python) |
| 81 | tc.cache_variables["BUILD_CSHARP_BINDINGS"] = bool(self.options.with_csharp) |
| 82 | # tc.cache_variables["BUILD_NUGET_PACKAGE"] = False |
| 83 | # tc.cache_variables["BUILD_PYTHON_PIP_PACKAGE"] = False |
| 84 | |
| 85 | tc.cache_variables["BUILD_TESTING"] = bool(self.options.with_testing) |
| 86 | tc.cache_variables["BUILD_BENCHMARK"] = bool(self.options.with_benchmark) |
| 87 | |
| 88 | tc.cache_variables["CPACK_BINARY_TGZ"] = True |
| 89 | tc.cache_variables["CPACK_BINARY_IFW"] = False |
| 90 | tc.cache_variables["CPACK_BINARY_DEB"] = False |
| 91 | if self.settings.build_type == "Release": |
| 92 | if is_apple_os(self) or self.settings.os == "Windows": |
| 93 | tc.cache_variables["CPACK_BINARY_IFW"] = True |
| 94 | else: |
| 95 | tc.cache_variables["CPACK_BINARY_DEB"] = True |
| 96 | tc.cache_variables["CPACK_BINARY_NSIS"] = False |
| 97 | tc.cache_variables["CPACK_BINARY_RPM"] = False |
| 98 | tc.cache_variables["CPACK_BINARY_STGZ"] = False |
| 99 | tc.cache_variables["CPACK_BINARY_TBZ2"] = False |
| 100 | tc.cache_variables["CPACK_BINARY_TXZ"] = False |
| 101 | tc.cache_variables["CPACK_BINARY_TZ"] = False |
| 102 | |
| 103 | if self.options.with_python: |
| 104 | v = sys.version_info |
| 105 | if (v.major, v.minor) == (3, 12): |
| 106 | python_version = f"{v.major}.{v.minor}.{v.micro}" |
| 107 | self.output.info( |
| 108 | f"Setting PYTHON_VERSION and Python_ROOT_DIR from your current python: {python_version}, '{sys.base_prefix}'" |
| 109 | ) |
| 110 | tc.cache_variables["PYTHON_VERSION"] = python_version |
| 111 | tc.cache_variables["Python_ROOT_DIR"] = str(Path(sys.base_prefix)) |
| 112 | else: |
| 113 | self.output.warning( |
| 114 | "Your current python is not in the 3.12.x range, which is what we target.\n" |
| 115 | "You'll need to pass it properly when configuring CMake\n" |
| 116 | "via -DPYTHON_VERSION:STRING='3.12.xx' and -DPython_ROOT_DIR:PATH='/path/to/python3.12/'" |
| 117 | ) |
| 118 | tc.generate() |