Skip to content

Commit

Permalink
(#23792) fix abuse of Conan attributes in fftw
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Apr 29, 2024
1 parent 3f1e13b commit 1d39b11
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions recipes/fftw/all/conanfile.py
Expand Up @@ -49,7 +49,6 @@ class FFTWConan(ConanFile):
"combinedthreads": False,
"simd": False,
}
_current_precision = None

def export_sources(self):
export_conandata_patches(self)
Expand Down Expand Up @@ -93,11 +92,6 @@ def generate(self):
tc.variables["ENABLE_AVX2"] = self.options.simd == "avx2"
tc.generate()

@property
def build_folder(self):
bf = super().build_folder
return os.path.join(bf, self._current_precision) if self._current_precision else bf

@property
def _all_precisions(self):
return [p for p in ALL if self.options.get_safe(f"precision_{p}")]
Expand All @@ -107,29 +101,21 @@ def on_off(value):
return "ON" if value else 'OFF'

apply_conandata_patches(self)
for self._current_precision in self._all_precisions:
for current_precision in self._all_precisions:
cmake = CMake(self)
variables = {
"ENABLE_FLOAT": on_off(self._current_precision == SINGLE),
"ENABLE_LONG_DOUBLE": on_off(self._current_precision == LONGDOUBLE),
"ENABLE_QUAD_PRECISION": on_off(self._current_precision == QUAD)
"ENABLE_FLOAT": on_off(current_precision == SINGLE),
"ENABLE_LONG_DOUBLE": on_off(current_precision == LONGDOUBLE),
"ENABLE_QUAD_PRECISION": on_off(current_precision == QUAD)
}
cmake.configure(variables=variables)
cmake.build()

# Potentially avoid side effects due to build_folder property tweak.
self._current_precision = None
cmake.install()

def package(self):
copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
for self._current_precision in self._all_precisions:
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))

# Potentially avoid side effects due to build_folder property tweak.
self._current_precision = None
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))

def package_info(self):
cmake_config_name = cmake_namespace = "FFTW3"
Expand Down

0 comments on commit 1d39b11

Please sign in to comment.