Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix abuse of Conan attributes in fftw #23792

Merged
merged 1 commit into from Apr 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the proposed approach makes sense: files are added to the install folder (the libraries), and every other file is just overwritten with exactly the same contents. This is equivalent to the way it's done in CMake to support multi-configuration (Release/Debug) in the same install tree: configure twice, build twice, install twice to same location.

Was wondering if it would be worth passing --fresh to CMake configure, or clearing the build folder ahead of starting, but from what I can see, we wouldn't benefit much, as the result is the same.


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