Skip to content

Commit 43290ea

Browse files
leoparenteclaude
andcommitted
chore: add local Corrade Conan recipe at commit 22e7ffc6
Builds Corrade from master commit 22e7ffc6 which contains GCC 11+ and Clang 14+ fixes not in the frozen corrade/2020.06 CCI package. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bb320d0 commit 43290ea

4 files changed

Lines changed: 252 additions & 0 deletions

File tree

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Here we are reproducing the variables and call performed by the FindCorrade.cmake provided by the library
2+
3+
# Read flags from configuration
4+
file(READ "${CMAKE_CURRENT_LIST_DIR}/../../include/Corrade/configure.h" _corradeConfigure)
5+
string(REGEX REPLACE ";" "\\\\;" _corradeConfigure "${_corradeConfigure}")
6+
string(REGEX REPLACE "\n" ";" _corradeConfigure "${_corradeConfigure}")
7+
set(_corradeFlags
8+
MSVC2015_COMPATIBILITY
9+
MSVC2017_COMPATIBILITY
10+
MSVC2019_COMPATIBILITY
11+
BUILD_DEPRECATED
12+
BUILD_STATIC
13+
BUILD_STATIC_UNIQUE_GLOBALS
14+
BUILD_MULTITHREADED
15+
TARGET_UNIX
16+
TARGET_APPLE
17+
TARGET_IOS
18+
TARGET_IOS_SIMULATOR
19+
TARGET_WINDOWS
20+
TARGET_WINDOWS_RT
21+
TARGET_EMSCRIPTEN
22+
TARGET_ANDROID
23+
# TARGET_X86 etc and TARGET_LIBCXX are not exposed to CMake as the meaning
24+
# is unclear on platforms with multi-arch binaries or when mixing different
25+
# STL implementations. TARGET_GCC etc are figured out via UseCorrade.cmake,
26+
# as the compiler can be different when compiling the lib & when using it.
27+
PLUGINMANAGER_NO_DYNAMIC_PLUGIN_SUPPORT
28+
TESTSUITE_TARGET_XCTEST
29+
UTILITY_USE_ANSI_COLORS)
30+
foreach(_corradeFlag ${_corradeFlags})
31+
list(FIND _corradeConfigure "#define CORRADE_${_corradeFlag}" _corrade_${_corradeFlag})
32+
if(NOT _corrade_${_corradeFlag} EQUAL -1)
33+
set(CORRADE_${_corradeFlag} 1)
34+
endif()
35+
endforeach()
36+
37+
38+
# Corrade::rc, a target with just an executable
39+
if(NOT TARGET Corrade::rc)
40+
if(CMAKE_CROSSCOMPILING)
41+
find_program(CORRADE_RC_PROGRAM
42+
NAMES corrade-rc
43+
PATHS ENV
44+
PATH NO_DEFAULT_PATH)
45+
else()
46+
find_program(CORRADE_RC_PROGRAM
47+
NAMES corrade-rc
48+
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/"
49+
NO_DEFAULT_PATH)
50+
endif()
51+
52+
get_filename_component(CORRADE_RC_PROGRAM "${CORRADE_RC_PROGRAM}" ABSOLUTE)
53+
54+
add_executable(Corrade::rc IMPORTED)
55+
set_property(TARGET Corrade::rc PROPERTY IMPORTED_LOCATION ${CORRADE_RC_PROGRAM})
56+
endif()
57+
58+
# Include and declare other build modules
59+
include("${CMAKE_CURRENT_LIST_DIR}/UseCorrade.cmake")
60+
set(CORRADE_LIB_SUFFIX_MODULE "${CMAKE_CURRENT_LIST_DIR}/CorradeLibSuffix.cmake")

recipes/corrade/all/conandata.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
sources:
2+
"cci.20250327":
3+
url: "https://github.com/mosra/corrade/archive/22e7ffc6fcdeaa0df96e0d8b3d482ad6abe7dc36.tar.gz"
4+
sha256: "d8f30e9a857172003b6b02304783f40e8038c36e4127a0cfec7fe14f41c13fd4"

recipes/corrade/all/conanfile.py

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
import os
2+
3+
from conan import ConanFile
4+
from conan.errors import ConanInvalidConfiguration
5+
from conan.tools.build import cross_building
6+
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
7+
from conan.tools.files import copy, get, rmdir
8+
from conan.tools.microsoft import is_msvc, check_min_vs
9+
10+
required_conan_version = ">=1.52.0"
11+
12+
13+
class CorradeConan(ConanFile):
14+
name = "corrade"
15+
description = "Corrade is a multiplatform utility library written in C++11/C++14."
16+
license = "MIT"
17+
url = "https://github.com/conan-io/conan-center-index"
18+
homepage = "https://magnum.graphics/corrade"
19+
topics = ("magnum", "filesystem", "console", "environment", "os")
20+
21+
package_type = "library"
22+
settings = "os", "arch", "compiler", "build_type"
23+
options = {
24+
"shared": [True, False],
25+
"fPIC": [True, False],
26+
"build_deprecated": [True, False],
27+
"with_interconnect": [True, False],
28+
"with_main": [True, False],
29+
"with_pluginmanager": [True, False],
30+
"with_testsuite": [True, False],
31+
"with_utility": [True, False],
32+
}
33+
default_options = {
34+
"shared": False,
35+
"fPIC": True,
36+
"build_deprecated": True,
37+
"with_interconnect": True,
38+
"with_main": True,
39+
"with_pluginmanager": True,
40+
"with_testsuite": True,
41+
"with_utility": True,
42+
}
43+
44+
def export_sources(self):
45+
copy(self, "cmake/*", src=self.recipe_folder, dst=self.export_sources_folder)
46+
47+
def config_options(self):
48+
if self.settings.os == "Windows":
49+
del self.options.fPIC
50+
51+
def configure(self):
52+
if self.options.shared:
53+
self.options.rm_safe("fPIC")
54+
55+
def layout(self):
56+
cmake_layout(self, src_folder="src")
57+
58+
def validate(self):
59+
check_min_vs(self, 190)
60+
if not self.options.with_utility and (
61+
self.options.with_testsuite or self.options.with_interconnect or self.options.with_pluginmanager
62+
):
63+
raise ConanInvalidConfiguration(
64+
"Component 'utility' is required for 'test_suite', 'interconnect' and 'plugin_manager'"
65+
)
66+
67+
def build_requirements(self):
68+
if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True):
69+
self.tool_requires(f"corrade/{self.version}")
70+
71+
def source(self):
72+
get(self, **self.conan_data["sources"][self.version], strip_root=True)
73+
74+
def generate(self):
75+
tc = CMakeToolchain(self)
76+
tc.variables["BUILD_STATIC"] = not self.options.shared
77+
tc.variables["BUILD_STATIC_PIC"] = self.options.get_safe("fPIC", False)
78+
79+
tc.variables["BUILD_DEPRECATED"] = self.options.build_deprecated
80+
tc.variables["WITH_INTERCONNECT"] = self.options.with_interconnect
81+
tc.variables["WITH_MAIN"] = self.options.with_main
82+
tc.variables["WITH_PLUGINMANAGER"] = self.options.with_pluginmanager
83+
tc.variables["WITH_TESTSUITE"] = self.options.with_testsuite
84+
tc.variables["WITH_UTILITY"] = self.options.with_utility
85+
tc.variables["WITH_RC"] = self.options.with_utility
86+
87+
tc.variables["LIB_SUFFIX"] = ""
88+
89+
if is_msvc(self):
90+
if check_min_vs(self, 193, raise_invalid=False):
91+
tc.variables["MSVC2019_COMPATIBILITY"] = True
92+
elif check_min_vs(self, 192, raise_invalid=False):
93+
tc.variables["MSVC2017_COMPATIBILITY"] = True
94+
elif check_min_vs(self, 191, raise_invalid=False):
95+
tc.variables["MSVC2015_COMPATIBILITY"] = True
96+
97+
tc.generate()
98+
tc = CMakeDeps(self)
99+
tc.generate()
100+
101+
def build(self):
102+
cmake = CMake(self)
103+
cmake.configure()
104+
cmake.build()
105+
106+
def package(self):
107+
copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
108+
cmake = CMake(self)
109+
cmake.install()
110+
share_cmake = os.path.join(self.package_folder, "share", "cmake", "Corrade")
111+
copy(self, "UseCorrade.cmake",
112+
src=share_cmake,
113+
dst=os.path.join(self.package_folder, "lib", "cmake"))
114+
copy(self, "CorradeLibSuffix.cmake",
115+
src=share_cmake,
116+
dst=os.path.join(self.package_folder, "lib", "cmake"))
117+
copy(self, "*.cmake",
118+
src=os.path.join(self.export_sources_folder, "cmake"),
119+
dst=os.path.join(self.package_folder, "lib", "cmake"))
120+
rmdir(self, os.path.join(self.package_folder, "share"))
121+
122+
def package_info(self):
123+
self.cpp_info.set_property("cmake_find_mode", "both")
124+
self.cpp_info.set_property("cmake_file_name", "Corrade")
125+
self.cpp_info.set_property("cmake_target_name", "Corrade::Corrade")
126+
127+
suffix = "-d" if self.settings.build_type == "Debug" else ""
128+
129+
cmake_modules = [
130+
os.path.join("lib", "cmake", "conan-corrade-vars.cmake"),
131+
os.path.join("lib", "cmake", "CorradeLibSuffix.cmake"),
132+
os.path.join("lib", "cmake", "UseCorrade.cmake"),
133+
]
134+
self.cpp_info.set_property("cmake_build_modules", cmake_modules)
135+
self.cpp_info.components["_corrade"].build_modules["cmake_find_package"] = cmake_modules
136+
self.cpp_info.components["_corrade"].build_modules["cmake_find_package_multi"] = cmake_modules
137+
138+
if self.options.with_main:
139+
self.cpp_info.components["main"].set_property("cmake_target_name", "Corrade::Main")
140+
self.cpp_info.components["main"].names["cmake_find_package"] = "Main"
141+
self.cpp_info.components["main"].names["cmake_find_package_multi"] = "Main"
142+
if self.settings.os == "Windows":
143+
self.cpp_info.components["main"].libs = ["CorradeMain" + suffix]
144+
self.cpp_info.components["main"].requires = ["_corrade"]
145+
146+
if self.options.with_utility:
147+
self.cpp_info.components["utility"].set_property("cmake_target_name", "Corrade::Utility")
148+
self.cpp_info.components["utility"].names["cmake_find_package"] = "Utility"
149+
self.cpp_info.components["utility"].names["cmake_find_package_multi"] = "Utility"
150+
self.cpp_info.components["utility"].libs = ["CorradeUtility" + suffix]
151+
if self.settings.os in ["Linux", "FreeBSD"]:
152+
self.cpp_info.components["utility"].system_libs = ["m", "dl"]
153+
self.cpp_info.components["utility"].requires = ["_corrade"]
154+
155+
if self.options.with_interconnect:
156+
self.cpp_info.components["interconnect"].set_property("cmake_target_name", "Corrade::Interconnect")
157+
self.cpp_info.components["interconnect"].names["cmake_find_package"] = "Interconnect"
158+
self.cpp_info.components["interconnect"].names["cmake_find_package_multi"] = "Interconnect"
159+
self.cpp_info.components["interconnect"].libs = ["CorradeInterconnect" + suffix]
160+
self.cpp_info.components["interconnect"].requires = ["utility"]
161+
162+
if self.options.with_pluginmanager:
163+
self.cpp_info.components["plugin_manager"].set_property("cmake_target_name", "Corrade::PluginManager")
164+
self.cpp_info.components["plugin_manager"].names["cmake_find_package"] = "PluginManager"
165+
self.cpp_info.components["plugin_manager"].names["cmake_find_package_multi"] = "PluginManager"
166+
self.cpp_info.components["plugin_manager"].libs = ["CorradePluginManager" + suffix]
167+
self.cpp_info.components["plugin_manager"].requires = ["utility"]
168+
169+
if self.options.with_testsuite:
170+
self.cpp_info.components["test_suite"].set_property("cmake_target_name", "Corrade::TestSuite")
171+
self.cpp_info.components["test_suite"].names["cmake_find_package"] = "TestSuite"
172+
self.cpp_info.components["test_suite"].names["cmake_find_package_multi"] = "TestSuite"
173+
self.cpp_info.components["test_suite"].libs = ["CorradeTestSuite" + suffix]
174+
self.cpp_info.components["test_suite"].requires = ["utility"]
175+
176+
if self.options.with_utility:
177+
bindir = os.path.join(self.package_folder, "bin")
178+
self.output.info(f"Appending PATH environment variable: {bindir}")
179+
self.env_info.PATH.append(bindir)
180+
181+
for key, component in self.cpp_info.components.items():
182+
component.set_property("pkg_config_name", f"{self.name}_{key}")
183+
184+
self.cpp_info.names["cmake_find_package"] = "Corrade"
185+
self.cpp_info.names["cmake_find_package_multi"] = "Corrade"

recipes/corrade/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
versions:
2+
"cci.20250327":
3+
folder: all

0 commit comments

Comments
 (0)