-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[package] cgns/4.3.0: Updated release, plus some recipe fixes #10855
Changes from all commits
bbbbe05
67a5d3a
44ce8ed
5d8dcd4
b8b7d3e
33a7254
6d53ee1
ff79791
54b6df6
7d8acc3
2a70c59
ae88958
837300d
3d1ac26
53fdb89
21e2a81
a7d0ae7
4276c24
38985b4
3304b92
66f5f8b
3f7c20d
b5863b8
03fbd48
5ce298d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
sources: | ||
"3.4.1": | ||
url: "https://github.com/CGNS/CGNS/archive/v3.4.1.tar.gz" | ||
sha256: "d32595e7737b9332243bd3de1eb8c018a272f620f09b289dea8292eba1365994" | ||
"4.3.0": | ||
url: "https://github.com/CGNS/CGNS/archive/v4.3.0.tar.gz" | ||
sha256: "7709eb7d99731dea0dd1eff183f109eaef8d9556624e3fbc34dc5177afc0a032" | ||
patches: | ||
"3.4.1": | ||
- patch_file: "patches/fix_find_hdf5.patch" | ||
base_path: "source_subfolder" | ||
- patch_file: "patches/fix_static_or_shared.patch" | ||
base_path: "source_subfolder" | ||
"4.3.0": | ||
- patch_file: "patches/4.3.0-fix_find_hdf5.patch" | ||
- patch_file: "patches/4.3.0-fix_static_or_shared.patch" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,92 +1,128 @@ | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout | ||
from conan.errors import ConanInvalidConfiguration | ||
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir | ||
import os | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
required_conan_version = ">=1.29.1" | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
class CgnsConan(ConanFile): | ||
name = "cgns" | ||
description = "Standard for data associated with the numerical solution " \ | ||
"of fluid dynamics equations." | ||
topics = ("conan", "cgns", "data", "cfd", "fluids") | ||
topics = "data", "cfd", "fluids" | ||
homepage = "http://cgns.org/" | ||
license = "Zlib" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
settings = "os", "compiler", "build_type", "arch" | ||
exports_sources = ["CMakeLists.txt", "patches/**"] | ||
generators = "cmake" | ||
options = { | ||
"shared": [True, False], | ||
"fPIC": [True, False], | ||
"with_hdf5": [True, False] | ||
"with_hdf5": [True, False], | ||
"parallel": [True, False], | ||
} | ||
default_options = { | ||
"shared": False, | ||
"fPIC": True, | ||
"with_hdf5": True | ||
"with_hdf5": True, | ||
"parallel": False, | ||
} | ||
|
||
_cmake = None | ||
|
||
@property | ||
def _source_subfolder(self): | ||
return "source_subfolder" | ||
|
||
@property | ||
def _build_subfolder(self): | ||
return "build_subfolder" | ||
def export_sources(self): | ||
export_conandata_patches(self) | ||
|
||
def config_options(self): | ||
if self.settings.os == "Windows": | ||
del self.options.fPIC | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
try: | ||
del self.options.fPIC | ||
except Exception: | ||
pass | ||
try: | ||
del self.settings.compiler.libcxx | ||
except Exception: | ||
pass | ||
try: | ||
del self.settings.compiler.cppstd | ||
except Exception: | ||
pass | ||
|
||
def layout(self): | ||
cmake_layout(self, src_folder="src") | ||
|
||
def requirements(self): | ||
if self.options.with_hdf5: | ||
self.requires("hdf5/1.12.0") | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename("CGNS-" + self.version, self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self.requires("hdf5/1.13.1") | ||
|
||
self._cmake = CMake(self) | ||
self._cmake.definitions["CGNS_ENABLE_TESTS"] = False | ||
self._cmake.definitions["CGNS_BUILD_TESTING"] = False | ||
self._cmake.definitions["CGNS_ENABLE_FORTRAN"] = False | ||
self._cmake.definitions["CGNS_ENABLE_HDF5"] = self.options.with_hdf5 | ||
self._cmake.definitions["CGNS_BUILD_SHARED"] = self.options.shared | ||
self._cmake.definitions["CGNS_USE_SHARED"] = self.options.shared | ||
self._cmake.definitions["CGNS_BUILD_CGNSTOOLS"] = False | ||
self._cmake.configure() | ||
def validate(self): | ||
if self.info.options.parallel and not (self.info.options.with_hdf5 and self.dependencies["hdf5"].options.parallel): | ||
raise ConanInvalidConfiguration("The option 'parallel' requires HDF5 with parallel=True") | ||
if self.info.options.parallel and self.info.options.with_hdf5 and self.dependencies["hdf5"].options.enable_cxx: | ||
raise ConanInvalidConfiguration("The option 'parallel' requires HDF5 with enable_cxx=False") | ||
|
||
return self._cmake | ||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) | ||
|
||
def generate(self): | ||
cmake = CMakeDeps(self) | ||
cmake.generate() | ||
|
||
tc = CMakeToolchain(self) | ||
tc.variables["CGNS_ENABLE_TESTS"] = False | ||
tc.variables["CGNS_BUILD_TESTING"] = False | ||
tc.variables["CGNS_ENABLE_FORTRAN"] = False | ||
tc.variables["CGNS_ENABLE_HDF5"] = self.options.with_hdf5 | ||
tc.variables["CGNS_BUILD_SHARED"] = self.options.shared | ||
tc.variables["CGNS_USE_SHARED"] = self.options.shared | ||
tc.variables["CGNS_ENABLE_PARALLEL"] = self.options.parallel | ||
tc.variables["CGNS_BUILD_CGNSTOOLS"] = False | ||
tc.generate() | ||
|
||
# Other flags, seen in appveyor.yml in source code, not currently managed. | ||
# CGNS_ENABLE_LFS:BOOL=OFF --- note in code: needed on 32 bit systems | ||
# CGNS_ENABLE_SCOPING:BOOL=OFF --- disabled in VTK's bundle | ||
# HDF5_NEED_ZLIB:BOOL=ON -- should be dealt with by cmake auto dependency management or something? | ||
|
||
def build(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
tools.patch(**patch) | ||
apply_conandata_patches(self) | ||
|
||
cmake = self._configure_cmake() | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build(target="cgns_shared" if self.options.shared else "cgns_static") | ||
|
||
def package(self): | ||
self.copy("license.txt", dst="licenses", src=self._source_subfolder) | ||
copy(self, "license.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) | ||
|
||
cmake = self._configure_cmake() | ||
cmake = CMake(self) | ||
cmake.install() | ||
|
||
os.remove(os.path.join(self.package_folder, "include", "cgnsBuild.defs")) | ||
rm(self, "cgnsBuild.defs", os.path.join(self.package_folder, "include")) | ||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = ["cgnsdll" if self.settings.os == "Windows" and self.options.shared else "cgns"] | ||
if self.settings.os == "Windows" and self.options.shared: | ||
self.cpp_info.defines = ["CGNSDLL=__declspec(dllimport)"] # we could instead define USE_DLL but it's too generic | ||
self.cpp_info.set_property("cmake_file_name", "CGNS") | ||
self.cpp_info.set_property("cmake_target_name", "CGNS::CGNS") | ||
|
||
if self.options.shared: | ||
self.cpp_info.components["cgns_shared"].set_property("cmake_target_name", "CGNS::cgns_shared") | ||
self.cpp_info.components["cgns_shared"].libs = ["cgnsdll" if self.settings.os == "Windows" else "cgns"] | ||
self.cpp_info.components["cgns_shared"].libdirs = ["lib"] | ||
if self.options.with_hdf5: | ||
self.cpp_info.components["cgns_shared"].requires = ["hdf5::hdf5"] | ||
if self.settings.os == "Windows": | ||
# we could instead define USE_DLL but it's too generic | ||
self.cpp_info.components["cgns_shared"].defines = ["CGNSDLL=__declspec(dllimport)"] | ||
else: | ||
self.cpp_info.components["cgns_static"].set_property("cmake_target_name", "CGNS::cgns_static") | ||
self.cpp_info.components["cgns_static"].libs = ["cgns"] | ||
self.cpp_info.components["cgns_static"].libdirs = ["lib"] | ||
if self.options.with_hdf5: | ||
self.cpp_info.components["cgns_static"].requires = ["hdf5::hdf5"] | ||
|
||
# TODO: to remove in conan v2 once cmake_find_package_* generators removed | ||
self.cpp_info.names["cmake_find_package"] = "CGNS" | ||
self.cpp_info.names["cmake_find_package_multi"] = "CGNS" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
diff -r -u a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
--- a/src/CMakeLists.txt 2022-05-31 16:13:29.855723400 +0800 | ||
+++ b/src/CMakeLists.txt 2022-05-31 16:40:39.332447379 +0800 | ||
@@ -576,7 +576,7 @@ | ||
add_library(CGNS::cgns-static ALIAS cgns_static) | ||
# Needed to work around a CMake > 3.8 bug on Windows with MSVS and Intel Fortran | ||
set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C) | ||
-target_link_libraries(cgns_static PRIVATE $<$<BOOL:${CGNS_ENABLE_HDF5}>:hdf5::hdf5-${CG_HDF5_LINK_TYPE}>) | ||
+target_link_libraries(cgns_static PRIVATE $<$<BOOL:${CGNS_ENABLE_HDF5}>:HDF5::HDF5>) | ||
|
||
# Build a shared version of the library | ||
if(CGNS_BUILD_SHARED) | ||
@@ -592,8 +592,8 @@ | ||
target_compile_definitions(cgns_shared PRIVATE -DBUILD_DLL) | ||
target_compile_definitions(cgns_shared INTERFACE -DUSE_DLL) | ||
endif () | ||
- if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY) | ||
- target_link_libraries(cgns_shared PUBLIC hdf5::hdf5-${CG_HDF5_LINK_TYPE} $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>) | ||
+ if (CGNS_ENABLE_HDF5) | ||
+ target_link_libraries(cgns_shared PUBLIC HDF5::HDF5 $<$<NOT:$<PLATFORM_ID:Windows>>:${CMAKE_DL_LIBS}>) | ||
if(HDF5_NEED_ZLIB AND ZLIB_LIBRARY) | ||
target_link_libraries(cgns_shared PUBLIC ${ZLIB_LIBRARY}) | ||
endif() |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Enforces that either static or dynamic libs are built | ||
|
||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt | ||
index 103cb1f..aae21a7 100644 | ||
--- a/src/CMakeLists.txt | ||
+++ b/src/CMakeLists.txt | ||
@@ -674,7 +674,9 @@ if(CGNS_BUILD_SHARED) | ||
endif() | ||
|
||
|
||
+if(NOT CGNS_BUILD_SHARED) | ||
set (install_targets cgns_static) | ||
+endif() | ||
if(CGNS_BUILD_SHARED) | ||
set(install_targets ${install_targets} cgns_shared) | ||
endif () | ||
@@ -738,7 +740,6 @@ install(EXPORT cgns-targets | ||
# Tools # | ||
######### | ||
|
||
-add_subdirectory(tools) | ||
|
||
######### | ||
# Tests # |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
find_package(CGNS CONFIG REQUIRED) | ||
|
||
add_executable(test_package test_package.cpp) | ||
target_link_libraries(test_package ${CONAN_LIBS}) | ||
target_link_libraries(test_package CGNS::CGNS) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because there are components I assume the headers are now being passed to the global target 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't follow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @prince-chrismc when you have time please, I'm not sure what you mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for not being more clear, I was trying to see why the build fail when I left that comment... CI failed because the header was not found, but I can see it being placed in the package... I am not sure why that is I was just tossing a suggestion... might be a bug that was fix in 1.50 thats not in CCI 🤷 sorry I am not very helpful 🤗 💟 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok thanks mate. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
import os | ||
from conan import ConanFile | ||
from conan.tools.cmake import CMake, cmake_layout | ||
from conan.tools.build import can_run | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
class CgnsTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(test_package ../test_package/test_package.cpp) | ||
target_link_libraries(test_package ${CONAN_LIBS}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class CgnsTestConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
versions: | ||
"3.4.1": | ||
"4.3.0": | ||
folder: all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please explain why did you need to drop 3.4.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't make it work with conan v1-v2 transition, I'm close to giving up ...
I am happy to not drop 3.4.1 but I can't keep spending time bashing my head against walls.
It is probably something very simple for someone else to fix...