Initial commit

This commit is contained in:
2026-01-23 22:15:36 +01:00
commit ca60108606
167 changed files with 5311 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
build
CMakeUserPresets.json

123
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,123 @@
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- packaging
.Packaging:
variables:
PACKAGE: 'Unknown'
VERSION: 'Unknown'
LOCATION: 'all'
CCACHE_BASEDIR: $CI_PROJECT_DIR
image: registry.gitlab.com/bigfootdev/docker/linuxcppbuilder:main
stage: packaging
before_script:
- ccache --zero-stats
script:
- CONAN_LOGIN_USERNAME=${GITLAB_CONAN_USER} CONAN_PASSWORD=${GITLAB_CONAN_PASSWORD} conan create ./$PACKAGE/$LOCATION --version=$VERSION -pr:b=./clang -pr:h=./clang --build=missing --remote=bigfootpackages
- CONAN_LOGIN_USERNAME=${GITLAB_CONAN_USER} CONAN_PASSWORD=${GITLAB_CONAN_PASSWORD} conan upload $PACKAGE/$VERSION@ --only-recipe --remote=bigfootpackages
after_script:
- ccache --show-stats
dependencies: []
tags:
- linux
- c++
- bigfootdev
only:
variables:
- $CI_COMMIT_REF_PROTECTED
PackageEABase:
extends: .Packaging
variables:
PACKAGE: 'eabase'
VERSION: '01082025'
PackageEASTL:
extends: .Packaging
variables:
PACKAGE: 'eastl'
VERSION: '3.27.01'
needs:
- PackageEABase
PackagePixelMatch:
extends: .Packaging
variables:
PACKAGE: 'pixelmatch-cpp17'
VERSION: '1.0.3'
PackageLodePNG:
extends: .Packaging
variables:
PACKAGE: 'lodepng'
VERSION: 'cci.20250727'
PackageStduuid:
extends: .Packaging
variables:
PACKAGE: 'stduuid'
VERSION: '1.2.3'
PackageFlatbuffers:
extends: .Packaging
variables:
PACKAGE: 'flatbuffers'
VERSION: '25.12.19'
PackageVulkanMemoryAllocator:
extends: .Packaging
variables:
PACKAGE: 'vulkan-memory-allocator'
VERSION: '3.3.0'
PackageVulkanUtilityLibraries:
extends: .Packaging
variables:
PACKAGE: 'vulkan-utility-libraries'
VERSION: '1.4.313.0'
PackageVulkanValidationLayers:
extends: .Packaging
variables:
PACKAGE: 'vulkan-validationlayers'
VERSION: '1.4.313.0'
needs:
- PackageVulkanUtilityLibraries
PackageShaderC:
extends: .Packaging
variables:
PACKAGE: 'shaderc'
VERSION: '2025.3'
PackageUnorderedDense:
extends: .Packaging
variables:
PACKAGE: 'unordered_dense'
VERSION: '4.8.1'
PackageMimalloc:
extends: .Packaging
variables:
PACKAGE: 'mimalloc'
VERSION: '3.1.5'
PackageMeshOptimizer:
extends: .Packaging
variables:
PACKAGE: 'meshoptimizer'
VERSION: '1.0'
PackageSQLite3:
extends: .Packaging
variables:
PACKAGE: 'sqlite3'
VERSION: '3.51.0'
PackageRapidHash:
extends: .Packaging
variables:
PACKAGE: 'rapidhash'
VERSION: '3.0'

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2022-2023 Romain BOULLARD
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

24
clang Normal file
View File

@@ -0,0 +1,24 @@
[settings]
os=Linux
arch=x86_64
compiler=clang
compiler.version=18
compiler.libcxx=libstdc++11
compiler.cppstd=20
compiler.cstd=17
build_type=Release
[conf]
tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'}
tools.cmake.cmaketoolchain:generator=Ninja
tools.system.package_manager:mode=install
tools.system.package_manager:sudo=True
tools.build:compiler_executables={"c": "clang", "cpp": "clang++"}
tools.build:exelinkflags=["-fuse-ld=mold", "-flto"]
tools.build:sharedlinkflags=["-fuse-ld=mold", "-flto"]
tools.build:cflags=["-flto"]
tools.build:cxxflags=["-flto"]
[tool_requires]
!cmake/*: cmake/[>=4.2]

21
eabase/all/conandata.yml Normal file
View File

@@ -0,0 +1,21 @@
sources:
"01082025":
url: "https://github.com/electronicarts/EABase/archive/0699a15efdfd20b6cecf02153bfa5663decb653c.zip"
sha256: "bf3bcf296cd1960d95b145f404d2b325e65b47b750e654ca19d05f1e4fc763a5"
"18082024":
url: "https://github.com/electronicarts/EABase/archive/123363eb82e132c0181ac53e43226d8ee76dea12.zip"
sha256: "74ee83236e40122cafff06a9456f1a28b24b6fd94cf72cc8615b7a9470895adc"
"2.09.12":
url: "https://github.com/electronicarts/EABase/archive/d1be0a1d0fc01a9bf8f3f2cea75018df0d2410ee.zip"
sha256: "53b72d188aa17c7b23aa6bef9a4767854e82eac46a027dec233d12fd3dfbc677"
"2.09.06":
url: "https://github.com/electronicarts/EABase/archive/refs/heads/2.09.06.zip"
sha256: "3223c2b81dcdccaeb9fca7a83695f9edb402b817c89c073c0eb3ee64646699ea"
"2.09.05":
url: "https://github.com/electronicarts/EABase/archive/2.09.05.tar.gz"
sha256: "f85b98c96f1976aa013c8d6016c5e37a409633ac3fce843cd4ec0b89c67e6b7a"
patches:
"01082025":
- patch_file: "patches/bump_cmake.patch"
patch_description: "Bump cmake version"
patch_type: "conan"

68
eabase/all/conanfile.py Normal file
View File

@@ -0,0 +1,68 @@
import os
from conan import ConanFile
from conan.tools.files import (
apply_conandata_patches,
export_conandata_patches,
copy,
get,
)
from conan.tools.layout import basic_layout
required_conan_version = ">=1.52.0"
class EABaseConan(ConanFile):
name = "eabase"
description = "EABase is a small set of header files that define platform-independent data types and platform feature macros. "
topics = ("eastl", "config")
license = "BSD-3-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/electronicarts/EABase"
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True
def layout(self):
basic_layout(self, src_folder="src")
def package_id(self):
self.info.clear()
def export_sources(self):
export_conandata_patches(self)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)
def package(self):
copy(
self,
pattern="LICENSE",
dst=os.path.join(self.package_folder, "licenses"),
src=self.source_folder,
)
copy(
self,
pattern="*.h",
dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "include"),
)
def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
self.cpp_info.includedirs += [
os.path.join("include", "Common"),
os.path.join("include", "Common", "EABase"),
]
self.cpp_info.set_property("cmake_file_name", "EABase")
self.cpp_info.set_property("cmake_target_name", "EABase::EABase")
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "EABase"
self.cpp_info.filenames["cmake_find_package_multi"] = "EABase"
self.cpp_info.names["cmake_find_package"] = "EABase"
self.cpp_info.names["cmake_find_package_multi"] = "EABase"

View File

@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 652f07f..11e4430 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
#-------------------------------------------------------------------------------------------
# Copyright (C) Electronic Arts Inc. All rights reserved.
#-------------------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.5)
project(EABase CXX)
#-------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(EABase REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE EABase::EABase)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

View File

@@ -0,0 +1,27 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
# It will become the standard on Conan 2.x
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,47 @@
#include <eabase.h>
#include <cstdlib>
#include <iostream>
#ifndef EA_COMPILER_IS_ANSIC
#define EA_COMPILER_IS_ANSIC 0
#endif
#ifndef EA_COMPILER_IS_C99
#define EA_COMPILER_IS_C99 0
#endif
#ifndef EA_COMPILER_IS_C99
#define EA_COMPILER_IS_C99 0
#endif
#ifndef EA_COMPILER_HAS_C99_TYPES
#define EA_COMPILER_HAS_C99_TYPES 0
#endif
#ifndef EA_COMPILER_IS_CPLUSPLUS
#define EA_COMPILER_IS_CPLUSPLUS 0
#endif
int main() {
#define PRINT_COMPILER_INFO(VAR) std::cout << #VAR << ": " << (VAR) << '\n'
PRINT_COMPILER_INFO(EA_COMPILER_VERSION);
PRINT_COMPILER_INFO(EA_COMPILER_NAME);
PRINT_COMPILER_INFO(EA_COMPILER_STRING);
std::cout << '\n';
PRINT_COMPILER_INFO(EA_PLATFORM_NAME);
PRINT_COMPILER_INFO(EA_PLATFORM_DESCRIPTION);
std::cout << '\n';
PRINT_COMPILER_INFO(EA_COMPILER_IS_ANSIC);
PRINT_COMPILER_INFO(EA_COMPILER_IS_C99);
PRINT_COMPILER_INFO(EA_COMPILER_HAS_C99_TYPES);
PRINT_COMPILER_INFO(EA_COMPILER_IS_CPLUSPLUS);
std::cout << '\n';
PRINT_COMPILER_INFO(EA_PLATFORM_PTR_SIZE);
PRINT_COMPILER_INFO(EA_PLATFORM_WORD_SIZE);
return EXIT_SUCCESS;
}

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_v1_package LANGUAGES CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
${CMAKE_CURRENT_BINARY_DIR}/test_package/)

View File

@@ -0,0 +1,19 @@
from conans import ConanFile, CMake
from conan.tools.build import cross_building
import os
# legacy validation with Conan 1.x
class TestPackageV1Conan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)

11
eabase/config.yml Normal file
View File

@@ -0,0 +1,11 @@
versions:
"01082025":
folder: "all"
"18082024":
folder: "all"
"2.09.12":
folder: "all"
"2.09.06":
folder: "all"
"2.09.05":
folder: "all"

101
eastl/all/conandata.yml Normal file
View File

@@ -0,0 +1,101 @@
sources:
"3.27.01":
url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.27.01.tar.gz"
sha256: "fce43bf443f5569b00a8deae735394ea0b16f6c3f96867a17ded50775ffcdd12"
"3.27.00":
url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.27.00.tar.gz"
sha256: "5606643e41ab12fd7c209755fe04dca581ed01f43dec515288b1544eea22623f"
"3.21.23":
url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.21.23.tar.gz"
sha256: "2bcb48f88f7daf9f91c165aae751c10d11d6959b6e10f2dda8f1db893e684022"
"3.21.12":
url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.21.12.tar.gz"
sha256: "2a4d77e5eda23ec52fea8b22abbf2ea8002f38396d2a3beddda3ff2e17f7db2e"
"3.18.00":
url: "https://github.com/electronicarts/EASTL/archive/refs/tags/3.18.00.tar.gz"
sha256: "a3c5b970684be02e81fb16fbf92ed2584e055898704fde87c72d0331afdea12b"
"3.17.06":
url: "https://github.com/electronicarts/EASTL/archive/3.17.06.tar.gz"
sha256: "9ebeef26cdf091877ee348450d2711cd0bb60ae435309126c0adf8fec9a01ea5"
"3.17.03":
url: "https://github.com/electronicarts/EASTL/archive/3.17.03.tar.gz"
sha256: "50a072066e30fda364d482df6733572d8ca440a33825d81254b59a6ca9f4375a"
"3.16.07":
url: "https://github.com/electronicarts/EASTL/archive/3.16.07.tar.gz"
sha256: "f997a81c8cb36618bd4526ea7a02d026c8111d15fbc138c67ba8f4606680d551"
"3.16.05":
url: "https://github.com/electronicarts/EASTL/archive/3.16.05.tar.gz"
sha256: "deebff248ec0d4da35ca006cec39abdcfe65ccbd7294f6fbdb42fc92232368b6"
"3.16.01":
url: "https://github.com/electronicarts/EASTL/archive/3.16.01.tar.gz"
sha256: "80b0754ea02364dfd3f94e3b65c93087849a8d407196702c0cae59097fbe8d21"
"3.15.00":
url: "https://github.com/electronicarts/EASTL/archive/3.15.00.tar.gz"
sha256: "1578a2935ca490920b96c960fb570dab025280bb978fba40c88eb9ac74760c14"
patches:
"3.27.01":
- patch_file: "patches/3.27.01-0001-use-conan.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
- patch_file: "patches/3.27.01-0002-fix-assert-unused.patch"
patch_description: "disable warning for unused parameter inside assert file"
patch_type: "conan"
"3.27.00":
- patch_file: "patches/3.27.00-0001-use-conan.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
- patch_file: "patches/3.27.00-0002-fix-assert-unused.patch"
patch_description: "disable warning for unused parameter inside assert file"
patch_type: "conan"
"3.21.23":
- patch_file: "patches/3.21.23-0001-use-conan.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
"3.21.12":
- patch_file: "patches/3.21.12-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
- patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch"
patch_description: "disable constexpr for unsupported compilers"
patch_type: "portability"
- patch_file: "patches/3.21.12-0003-rename_reference.patch"
patch_description: "use eastl::remove_reference instead of std::remove_reference"
patch_type: "portability"
patch_source: "https://github.com/electronicarts/EASTL/issues/512"
"3.18.00":
- patch_file: "patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
- patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch"
patch_description: "disable constexpr for unsupported compilers"
patch_type: "portability"
"3.17.06":
- patch_file: "patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
- patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch"
patch_description: "disable constexpr for unsupported compilers"
patch_type: "portability"
"3.17.03":
- patch_file: "patches/3.17.03-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
- patch_file: "patches/3.17.03-0002-revert-c++14-constexpr.patch"
patch_description: "disable constexpr for unsupported compilers"
patch_type: "portability"
"3.16.07":
- patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
"3.16.05":
- patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
"3.16.01":
- patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"
"3.15.00":
- patch_file: "patches/3.15.00-0001-cmake-shared-use-conan-add-install.patch"
patch_description: "support shared build, use cci's EABase, add install definitions"
patch_type: "conan"

152
eastl/all/conanfile.py Normal file
View File

@@ -0,0 +1,152 @@
import os
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import (
apply_conandata_patches,
copy,
export_conandata_patches,
get,
replace_in_file,
rmdir,
)
from conan.tools.microsoft import is_msvc, check_min_vs
from conan.tools.scm import Version
required_conan_version = ">=1.52.0"
class EastlConan(ConanFile):
name = "eastl"
description = (
"EASTL stands for Electronic Arts Standard Template Library. "
"It is an extensive and robust implementation that has an "
"emphasis on high performance."
)
topics = ("eastl", "stl", "high-performance")
license = "BSD-3-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/electronicarts/EASTL"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
@property
def _min_cppstd(self):
if Version(self.version) < "3.27.00":
return 14
else:
return 17
@property
def _compilers_minimum_version(self):
return {
"Visual Studio": "14",
"msvc": "190",
"gcc": "5" if Version(self.version) < "3.21.12" else "6",
"clang": "3.2",
"apple-clang": "4.3",
}
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:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
def requirements(self):
if self.version >= "3.27.00":
self.requires("eabase/01082025", transitive_headers=True)
elif self.version == "3.21.23":
self.requires("eabase/18082024", transitive_headers=True)
else:
self.requires("eabase/2.09.12", transitive_headers=True)
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
raise ConanInvalidConfiguration(
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
)
if is_msvc(self) and check_min_vs(self, "193", raise_invalid=False) and Version(self.version) < "3.21.12":
raise ConanInvalidConfiguration(f"{self.ref} is not compatible with Visual Studio 2022, please use version >= 3.21.12")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["EASTL_BUILD_BENCHMARK"] = False
tc.variables["EASTL_BUILD_TESTS"] = False
tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd
tc.generate()
CMakeDeps(self).generate()
def _patch_sources(self):
apply_conandata_patches(self)
replace_in_file(
self,
os.path.join(self.source_folder, "CMakeLists.txt"),
"include(CommonCppFlags)",
"",
)
def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(
self,
"LICENSE",
src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"),
)
copy(
self,
"3RDPARTYLICENSES.TXT",
src=self.source_folder,
dst=os.path.join(self.package_folder, "licenses"),
)
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "doc"))
def package_info(self):
self.cpp_info.libs = ["EASTL"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.extend(["m", "pthread"])
if self.options.shared:
self.cpp_info.defines.append("EA_DLL")
self.cpp_info.set_property("cmake_file_name", "EASTL")
self.cpp_info.set_property("cmake_target_name", "EASTL::EASTL")
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.filenames["cmake_find_package"] = "EASTL"
self.cpp_info.filenames["cmake_find_package_multi"] = "EASTL"
self.cpp_info.names["cmake_find_package"] = "EASTL"
self.cpp_info.names["cmake_find_package_multi"] = "EASTL"

View File

@@ -0,0 +1,23 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,5 +46,19 @@ target_include_directories(EASTL PUBLIC include)
#-------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------
-target_link_libraries(EASTL EABase)
+find_package(EABase REQUIRED CONFIG)
+target_link_libraries(EASTL EABase::EABase)
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EASTL PUBLIC EASTL_DLL)
+ if(MSVC OR CYGWIN)
+ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
+ endif()
+endif()
+
+include(GNUInstallDirs)
+install(TARGETS EASTL
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include)

View File

@@ -0,0 +1,27 @@
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -47,8 +47,22 @@
# Dependencies
#-------------------------------------------------------------------------------------------
if (NOT TARGET EABase)
- add_subdirectory(test/packages/EABase)
+ #add_subdirectory(test/packages/EABase)
endif()
-target_link_libraries(EASTL EABase)
+find_package(EABase REQUIRED CONFIG)
+target_link_libraries(EASTL EABase::EABase)
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EASTL PUBLIC EASTL_DLL)
+ if(MSVC OR CYGWIN)
+ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
+ endif()
+endif()
+
+include(GNUInstallDirs)
+install(TARGETS EASTL
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include)

View File

@@ -0,0 +1,18 @@
--- include/EASTL/internal/config.h
+++ include/EASTL/internal/config.h
@@ -143,7 +143,14 @@
// http://en.wikipedia.org/wiki/C%2B%2B14#Relaxed_constexpr_restrictions
//
#if !defined(EA_CPP14_CONSTEXPR)
- #if defined(EA_COMPILER_CPP14_ENABLED)
+
+ #if defined(EA_COMPILER_MSVC_2015)
+ #define EA_CPP14_CONSTEXPR // not supported
+ #define EA_NO_CPP14_CONSTEXPR
+ #elif defined(__GNUC__) && (EA_COMPILER_VERSION < 9000) // Before GCC 9.0
+ #define EA_CPP14_CONSTEXPR // not supported
+ #define EA_NO_CPP14_CONSTEXPR
+ #elif defined(EA_COMPILER_CPP14_ENABLED)
#define EA_CPP14_CONSTEXPR constexpr
#else
#define EA_CPP14_CONSTEXPR // not supported

View File

@@ -0,0 +1,30 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3eb444..f033794 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,11 +59,22 @@ target_include_directories(EASTL PUBLIC include)
#-------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------
-if (NOT TARGET EABase)
- add_subdirectory(test/packages/EABase)
+find_package(EABase REQUIRED CONFIG)
+target_link_libraries(EASTL EABase::EABase)
+
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EASTL PUBLIC EASTL_DLL)
+ if(MSVC OR CYGWIN)
+ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
+ endif()
endif()
-target_link_libraries(EASTL EABase)
+include(GNUInstallDirs)
+install(TARGETS EASTL
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include)
#-------------------------------------------------------------------------------------------
# Installation

View File

@@ -0,0 +1,13 @@
diff --git a/include/EASTL/internal/type_transformations.h b/include/EASTL/internal/type_transformations.h
index 5454cfa..54a1c14 100644
--- a/include/EASTL/internal/type_transformations.h
+++ b/include/EASTL/internal/type_transformations.h
@@ -497,7 +497,7 @@ namespace eastl
namespace internal
{
template <typename T>
- auto try_add_pointer(int) -> type_identity<typename std::remove_reference<T>::type*>;
+ auto try_add_pointer(int) -> type_identity<typename eastl::remove_reference<T>::type*>;
template <typename T>
auto try_add_pointer(...) -> type_identity<T>;
}

View File

@@ -0,0 +1,42 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,16 +70,15 @@ target_include_directories(EASTL PUBLIC include)
#-------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------
-FetchContent_Declare(
- EABase
- GIT_REPOSITORY https://github.com/electronicarts/EABase.git
- GIT_TAG 123363eb82e132c0181ac53e43226d8ee76dea12
- GIT_SUBMODULES "" # This should be temporary until we update the cyclic submodule dependencies in EABase.
-)
-
-FetchContent_MakeAvailable(EABase)
-
-target_link_libraries(EASTL EABase)
+find_package(EABase REQUIRED CONFIG)
+target_link_libraries(EASTL EABase::EABase)
+
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EASTL PUBLIC EASTL_DLL)
+ if(MSVC OR CYGWIN)
+ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
+ endif()
+endif()
#-------------------------------------------------------------------------------------------
# Deprecations
@@ -98,6 +97,13 @@ endif()
#-------------------------------------------------------------------------------------------
# Installation
#-------------------------------------------------------------------------------------------
+include(GNUInstallDirs)
+install(TARGETS EASTL
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include)
+
install(TARGETS EASTL DESTINATION lib)
install(DIRECTORY include/EASTL DESTINATION include)

View File

@@ -0,0 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0124dc7..c048fb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,16 +70,15 @@ target_include_directories(EASTL PUBLIC include)
#-------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------
-FetchContent_Declare(
- EABase
- GIT_REPOSITORY https://github.com/electronicarts/EABase.git
- GIT_TAG 0699a15efdfd20b6cecf02153bfa5663decb653c
- GIT_SUBMODULES "" # This should be temporary until we update the cyclic submodule dependencies in EABase.
-)
-
-FetchContent_MakeAvailable(EABase)
-
-target_link_libraries(EASTL EABase)
+find_package(EABase REQUIRED CONFIG)
+target_link_libraries(EASTL EABase::EABase)
+
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EASTL PUBLIC EASTL_DLL)
+ if(MSVC OR CYGWIN)
+ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
+ endif()
+endif()
#-------------------------------------------------------------------------------------------
# Deprecations
@@ -98,6 +97,13 @@ endif()
#-------------------------------------------------------------------------------------------
# Installation
#-------------------------------------------------------------------------------------------
+include(GNUInstallDirs)
+install(TARGETS EASTL
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include)
+
install(TARGETS EASTL DESTINATION lib)
install(DIRECTORY include/EASTL DESTINATION include)

View File

@@ -0,0 +1,13 @@
diff --git a/source/assert.cpp b/source/assert.cpp
index d08878f..41426ae 100644
--- a/source/assert.cpp
+++ b/source/assert.cpp
@@ -52,7 +52,7 @@ namespace eastl
/// this function is not called in a thread-unsafe way. The easiest way to do this is
/// to just call this function once from the main thread on application startup.
///
- EASTL_API void SetAssertionFailureFunction(EASTL_AssertionFailureFunction pAssertionFailureFunction, void* pContext)
+ EASTL_API void SetAssertionFailureFunction(EASTL_AssertionFailureFunction pAssertionFailureFunction, [[maybe_unused]] void* pContext)
{
static EASTL_AssertionFailureFunction assertionFailureFunction_;
assertionFailureFunction_ = pAssertionFailureFunction;

View File

@@ -0,0 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0124dc7..c048fb8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -70,16 +70,15 @@ target_include_directories(EASTL PUBLIC include)
#-------------------------------------------------------------------------------------------
# Dependencies
#-------------------------------------------------------------------------------------------
-FetchContent_Declare(
- EABase
- GIT_REPOSITORY https://github.com/electronicarts/EABase.git
- GIT_TAG 0699a15efdfd20b6cecf02153bfa5663decb653c
- GIT_SUBMODULES "" # This should be temporary until we update the cyclic submodule dependencies in EABase.
-)
-
-FetchContent_MakeAvailable(EABase)
-
-target_link_libraries(EASTL EABase)
+find_package(EABase REQUIRED CONFIG)
+target_link_libraries(EASTL EABase::EABase)
+
+if(BUILD_SHARED_LIBS)
+ target_compile_definitions(EASTL PUBLIC EASTL_DLL)
+ if(MSVC OR CYGWIN)
+ target_compile_definitions(EASTL PRIVATE "EASTL_API=__declspec(dllexport)")
+ endif()
+endif()
#-------------------------------------------------------------------------------------------
# Deprecations
@@ -98,6 +97,13 @@ endif()
#-------------------------------------------------------------------------------------------
# Installation
#-------------------------------------------------------------------------------------------
+include(GNUInstallDirs)
+install(TARGETS EASTL
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(DIRECTORY ${CMAKE_INSTALL_INCLUDEDIR}/EASTL DESTINATION include)
+
install(TARGETS EASTL DESTINATION lib)
install(DIRECTORY include/EASTL DESTINATION include)

View File

@@ -0,0 +1,13 @@
diff --git a/source/assert.cpp b/source/assert.cpp
index d08878f..41426ae 100644
--- a/source/assert.cpp
+++ b/source/assert.cpp
@@ -52,7 +52,7 @@ namespace eastl
/// this function is not called in a thread-unsafe way. The easiest way to do this is
/// to just call this function once from the main thread on application startup.
///
- EASTL_API void SetAssertionFailureFunction(EASTL_AssertionFailureFunction pAssertionFailureFunction, void* pContext)
+ EASTL_API void SetAssertionFailureFunction(EASTL_AssertionFailureFunction pAssertionFailureFunction, [[maybe_unused]] void* pContext)
{
static EASTL_AssertionFailureFunction assertionFailureFunction_;
assertionFailureFunction_ = pAssertionFailureFunction;

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package CXX)
find_package(EASTL REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} EASTL::EASTL)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
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 can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,16 @@
#include <EASTL/hash_map.h>
#include <new>
// https://github.com/electronicarts/EASTL/blob/master/doc/FAQ.md#info15-how-hard-is-it-to-incorporate-eastl-into-my-project
void *operator new[](size_t size, [[maybe_unused]] const char *pName, [[maybe_unused]] int flags, [[maybe_unused]] unsigned debugFlags, [[maybe_unused]] const char *file, [[maybe_unused]] int line) {
return new uint8_t[size];
}
void *operator new[](size_t size, [[maybe_unused]] size_t alignment, [[maybe_unused]] size_t alignmentOffset, [[maybe_unused]] const char *pName, [[maybe_unused]] int flags, [[maybe_unused]] unsigned debugFlags, [[maybe_unused]] const char *file, [[maybe_unused]] int line) {
return new uint8_t[size];
}
int main() {
eastl::hash_map<int, int> map;
map[0] = 1;
return 0;
}

23
eastl/config.yml Normal file
View File

@@ -0,0 +1,23 @@
versions:
"3.27.01":
folder: "all"
"3.27.00":
folder: "all"
"3.21.23":
folder: "all"
"3.21.12":
folder: "all"
"3.18.00":
folder: "all"
"3.17.06":
folder: "all"
"3.17.03":
folder: "all"
"3.16.07":
folder: "all"
"3.16.05":
folder: "all"
"3.16.01":
folder: "all"
"3.15.00":
folder: "all"

View File

@@ -0,0 +1,31 @@
if(NOT TARGET flatbuffers::flatc)
if(CMAKE_CROSSCOMPILING)
find_program(FLATBUFFERS_FLATC_EXECUTABLE
NAMES flatc
PATHS ENV PATH
NO_DEFAULT_PATH
)
else()
find_program(FLATBUFFERS_FLATC_EXECUTABLE
NAMES flatc
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/"
NO_DEFAULT_PATH
)
endif()
# TODO: In conan v2 with CMakeToolchain, can be replaced by:
# find_program(FLATBUFFERS_FLATC_EXECUTABLE NAMES flatc)
# # Nice enough to handle flatbuffers not in build_requires for native build
# if(NOT FLATBUFFERS_FLATC_EXECUTABLE AND NOT CMAKE_CROSSCOMPILING)
# find_program(FLATBUFFERS_FLATC_EXECUTABLE
# NAMES flatc
# PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/"
# NO_DEFAULT_PATH
# )
# endif()
if(FLATBUFFERS_FLATC_EXECUTABLE)
get_filename_component(FLATBUFFERS_FLATC_EXECUTABLE "${FLATBUFFERS_FLATC_EXECUTABLE}" ABSOLUTE)
add_executable(flatbuffers::flatc IMPORTED)
set_property(TARGET flatbuffers::flatc PROPERTY IMPORTED_LOCATION ${FLATBUFFERS_FLATC_EXECUTABLE})
endif()
endif()

View File

@@ -0,0 +1,62 @@
sources:
"25.12.19":
url: "https://github.com/google/flatbuffers/archive/v25.12.19.tar.gz"
sha256: "f81c3162b1046fe8b84b9a0dbdd383e24fdbcf88583b9cb6028f90d04d90696a"
"25.9.23":
url: "https://github.com/google/flatbuffers/archive/v25.9.23.tar.gz"
sha256: "9102253214dea6ae10c2ac966ea1ed2155d22202390b532d1dea64935c518ada"
"25.2.10":
url: "https://github.com/google/flatbuffers/archive/v25.2.10.tar.gz"
sha256: "b9c2df49707c57a48fc0923d52b8c73beb72d675f9d44b2211e4569be40a7421"
"24.12.23":
url: "https://github.com/google/flatbuffers/archive/v24.12.23.tar.gz"
sha256: "7e2ef35f1af9e2aa0c6a7d0a09298c2cb86caf3d4f58c0658b306256e5bcab10"
"24.3.25":
url: "https://github.com/google/flatbuffers/archive/v24.3.25.tar.gz"
sha256: "4157c5cacdb59737c5d627e47ac26b140e9ee28b1102f812b36068aab728c1ed"
"24.3.7":
url: "https://github.com/google/flatbuffers/archive/v24.3.7.tar.gz"
sha256: "bfff9d2150fcff88f844e8c608b02b2a0e94c92aea39b04c0624783464304784"
"23.5.26":
url: "https://github.com/google/flatbuffers/archive/v23.5.26.tar.gz"
sha256: "1cce06b17cddd896b6d73cc047e36a254fb8df4d7ea18a46acf16c4c0cd3f3f3"
"23.3.3":
url: "https://github.com/google/flatbuffers/archive/v23.3.3.tar.gz"
sha256: "8aff985da30aaab37edf8e5b02fda33ed4cbdd962699a8e2af98fdef306f4e4d"
"23.1.21":
url: "https://github.com/google/flatbuffers/archive/v23.1.21.tar.gz"
sha256: "d84cb25686514348e615163b458ae0767001b24b42325f426fd56406fd384238"
"22.12.06":
url: "https://github.com/google/flatbuffers/archive/v22.12.06.tar.gz"
sha256: "209823306f2cbedab6ff70997e0d236fcfd1864ca9ad082cbfdb196e7386daed"
"22.11.23":
url: "https://github.com/google/flatbuffers/archive/v22.11.23.tar.gz"
sha256: "8e9bacc942db59ca89a383dd7923f3e69a377d6e579d1ba13557de1fdfddf56a"
"22.10.26":
url: "https://github.com/google/flatbuffers/archive/v22.10.26.tar.gz"
sha256: "34f1820cfd78a3d92abc880fbb1a644c7fb31a71238995f4ed6b5915a1ad4e79"
"22.9.29":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.29.tar.gz"
sha256: "372df01795c670f6538055a7932fc7eb3e81b3653be4a216c081e9c3c26b1b6d"
"2.0.8":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.8.tar.gz"
sha256: "f97965a727d26386afaefff950badef2db3ab6af9afe23ed6d94bfb65f95f37e"
"2.0.5":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.5.tar.gz"
sha256: "b01e97c988c429e164c5c7df9e87c80007ca87f593c0d73733ba536ddcbc8f98"
"1.12.0":
url: "https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz"
sha256: "62f2223fb9181d1d6338451375628975775f7522185266cd5296571ac152bc45"
patches:
"2.0.5":
- patch_file: "patches/0002-apple-no-universal-build.patch"
patch_description: "Don't use universal2 architecture"
patch_type: "bugfix"
- patch_file: "patches/0003-no-flatc-execution-build-time.patch"
patch_description: "No flatc execution during build time"
patch_type: "conan"
"1.12.0":
- patch_file: "patches/0005-arm-cxx-compiler-build.patch"
patch_description: "IAR ARM C++ Compiler build bugfix"
patch_type: "backport"
patch_source: "https://github.com/google/flatbuffers/commit/82fac326c5981a85233b8ae7e0d7ec8fda432963"

View File

@@ -0,0 +1,158 @@
from conan import ConanFile
from conan.tools.apple import is_apple_os
from conan.tools.build import check_min_cppstd, valid_min_cppstd
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import export_conandata_patches, apply_conandata_patches, collect_libs, copy, get, replace_in_file, rmdir
from conan.tools.scm import Version
import os
required_conan_version = ">=2.1"
class FlatbuffersConan(ConanFile):
name = "flatbuffers"
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "http://google.github.io/flatbuffers"
topics = ("serialization", "rpc", "json-parser")
description = "Memory Efficient Serialization Library"
settings = "os", "arch", "compiler", "build_type"
package_type = "library"
options = {
"shared": [True, False],
"fPIC": [True, False],
"header_only": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"header_only": False,
}
def _has_flatc(self, info=False):
# don't build flatc when it makes little sense or not supported
host_os = self.info.settings.os if info else self.settings.os
return host_os not in ["Android", "iOS", "watchOS", "tvOS", "Neutrino"]
def export_sources(self):
copy(self, os.path.join("cmake", "FlatcTargets.cmake"), self.recipe_folder, self.export_sources_folder)
export_conandata_patches(self)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared or self.options.header_only:
self.options.rm_safe("fPIC")
if self.options.header_only:
del self.options.shared
def layout(self):
cmake_layout(self, src_folder="src")
def package_id(self):
if self.info.options.header_only and not self._has_flatc(info=True):
self.info.clear()
def validate(self):
check_min_cppstd(self, 11)
def build_requirements(self):
# since 23.3.3 version, flatbuffers cmake scripts were refactored to use cmake 3.8 version
# see https://github.com/google/flatbuffers/pull/7801
if Version(self.version) >= "2.0.8" and Version(self.version) < "23.3.3":
self.tool_requires("cmake/[>=3.16 <4]")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
self._patch_sources()
def generate(self):
tc = CMakeToolchain(self)
tc.variables["FLATBUFFERS_BUILD_TESTS"] = False
tc.variables["FLATBUFFERS_INSTALL"] = True
tc.variables["FLATBUFFERS_BUILD_FLATLIB"] = not self.options.header_only and not self.options.shared
tc.variables["FLATBUFFERS_BUILD_FLATC"] = self._has_flatc()
tc.variables["FLATBUFFERS_STATIC_FLATC"] = False
tc.variables["FLATBUFFERS_BUILD_FLATHASH"] = False
tc.variables["FLATBUFFERS_BUILD_SHAREDLIB"] = not self.options.header_only and self.options.shared
# Honor conan profile
tc.variables["FLATBUFFERS_LIBCXX_WITH_CLANG"] = False
# Mimic upstream CMake/Version.cmake removed in _patch_sources()
version = Version(self.version)
tc.cache_variables["VERSION_MAJOR"] = str(version.major)
tc.cache_variables["VERSION_MINOR"] = str(version.minor or "0")
tc.cache_variables["VERSION_PATCH"] = str(version.patch or "0")
tc.cache_variables["VERSION_COMMIT"] = str(version.pre or "0")
# For msvc shared
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
# Relocatable shared libs on Macos
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
# Fix iOS/tvOS/watchOS
if is_apple_os(self):
tc.variables["CMAKE_MACOSX_BUNDLE"] = False
tc.generate()
def _patch_sources(self):
apply_conandata_patches(self)
cmakelists = os.path.join(self.source_folder, "CMakeLists.txt")
# Prefer manual injection of current version in build(), otherwise it tries to call git
replace_in_file(self, cmakelists, "include(CMake/Version.cmake)", "")
# No warnings as errors
replace_in_file(self, cmakelists, "/WX", "")
replace_in_file(self, cmakelists, "-Werror ", "")
# Install dll to bin folder
replace_in_file(self, cmakelists,
"RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}",
"RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}")
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
copy(self, "FlatcTargets.cmake",
src=os.path.join(self.source_folder, os.pardir, "cmake"),
dst=os.path.join(self.package_folder, self._module_path))
copy(self, "BuildFlatBuffers.cmake",
src=os.path.join(self.source_folder, "CMake"),
dst=os.path.join(self.package_folder, self._module_path))
@property
def _module_path(self):
return os.path.join("lib", "cmake")
def package_info(self):
self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_module_file_name", "flatbuffers")
self.cpp_info.set_property("cmake_file_name", "flatbuffers")
cmake_target = "flatbuffers"
if not self.options.header_only and self.options.shared:
cmake_target += "_shared"
self.cpp_info.set_property("cmake_target_name", f"flatbuffers::{cmake_target}")
self.cpp_info.set_property("pkg_config_name", "flatbuffers")
# TODO: back to global scope in conan v2 once cmake_find_package* generators removed
if not self.options.header_only:
self.cpp_info.components["libflatbuffers"].libs = collect_libs(self)
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.components["libflatbuffers"].system_libs.append("m")
# Provide flatbuffers::flatc target and CMake functions from BuildFlatBuffers.cmake
build_modules = [
os.path.join(self._module_path, "FlatcTargets.cmake"),
os.path.join(self._module_path, "BuildFlatBuffers.cmake"),
]
self.cpp_info.set_property("cmake_build_modules", build_modules)
if self._has_flatc():
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))

View File

@@ -0,0 +1,10 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -282,7 +282,6 @@ elseif(CMAKE_COMPILER_IS_GNUCXX)
elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if(APPLE)
- set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

View File

@@ -0,0 +1,18 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -514,6 +514,7 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT)
register_generated_output(${GEN_BFBS_HEADER})
endfunction()
+if(0)
# Look if we have python 3 installed so that we can run the generate code python
# script after flatc is built.
find_package(PythonInterp 3)
@@ -544,6 +545,7 @@ if(PYTHONINTERP_FOUND AND
else()
message("No Python3 interpreter found! Unable to generate files automatically.")
endif()
+endif()
if(FLATBUFFERS_BUILD_TESTS)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

View File

@@ -0,0 +1,20 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21e90151..2ce3eb48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -536,6 +536,7 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT)
register_generated_output(${GEN_BFBS_HEADER})
endfunction()
+if(0)
# Look if we have python 3.5 installed so that we can run the generate code
# python script after flatc is built.
find_package(Python3 3.5 COMPONENTS Interpreter)
@@ -559,6 +560,7 @@ if(Python3_Interpreter_FOUND)
else()
message("No Python3 interpreter found! Unable to generate files automatically.")
endif()
+endif()
if(FLATBUFFERS_BUILD_TESTS)
file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}")

View File

@@ -0,0 +1,16 @@
diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h
index c4dc5bcd..0f3a7dfd 100644
--- a/include/flatbuffers/flatbuffers.h
+++ b/include/flatbuffers/flatbuffers.h
@@ -1871,10 +1871,7 @@ class FlatBufferBuilder {
vector_downward &buf_;
private:
- TableKeyComparator &operator=(const TableKeyComparator &other) {
- buf_ = other.buf_;
- return *this;
- }
+ FLATBUFFERS_DELETE_FUNC(TableKeyComparator &operator=(const TableKeyComparator &other))
};
/// @endcond

View File

@@ -0,0 +1,38 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(FlatBuffers REQUIRED CONFIG)
if(TARGET flatbuffers::flatbuffers_shared)
set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared)
else()
set(FLATBUFFERS_TARGET flatbuffers::flatbuffers)
endif()
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE ${FLATBUFFERS_TARGET})
if(FLATBUFFERS_HEADER_ONLY)
target_compile_definitions(${PROJECT_NAME} PRIVATE FLATBUFFERS_HEADER_ONLY)
endif()
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
# Testing this block in case of cross-build would require to add flatbuffers to build requirements of test package
# But due to c3i limitations, package id of build requirement if header_only is not available while building in c3i
if(NOT CMAKE_CROSSCOMPILING)
add_executable(sample_binary sample_binary.cpp)
target_link_libraries(sample_binary PRIVATE ${FLATBUFFERS_TARGET})
target_compile_features(sample_binary PRIVATE cxx_std_11)
set(MONSTER_GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/monster_generated.h)
set(MONSTER_FBS ${CMAKE_CURRENT_SOURCE_DIR}/monster.fbs)
add_custom_command(
OUTPUT ${MONSTER_GENERATED_HEADER}
COMMAND $<TARGET_FILE:flatbuffers::flatc>
--cpp
-o ${CMAKE_CURRENT_BINARY_DIR}
${MONSTER_FBS}
DEPENDS ${MONSTER_FBS}
)
add_custom_target(generate_monster_header DEPENDS ${MONSTER_GENERATED_HEADER})
add_dependencies(sample_binary generate_monster_header)
target_include_directories(sample_binary PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
endif()

View File

@@ -0,0 +1,39 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualRunEnv
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str, run=can_run(self))
def generate(self):
env = VirtualRunEnv(self)
env.generate()
if can_run(self):
env = VirtualRunEnv(self)
env.generate(scope="build")
tc = CMakeToolchain(self)
tc.variables["FLATBUFFERS_HEADER_ONLY"] = self.dependencies["flatbuffers"].options.header_only
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")
sample_binary = os.path.join(self.cpp.build.bindirs[0], "sample_binary")
self.run(sample_binary, env="conanrun")

View File

@@ -0,0 +1,33 @@
// Example IDL file for our monster's schema.
namespace MyGame.Sample;
enum Color:byte { Red = 0, Green, Blue = 2 }
union Equipment { Weapon } // Optionally add more tables.
struct Vec3 {
x:float;
y:float;
z:float;
}
table Monster {
pos:Vec3;
mana:short = 150;
hp:short = 100;
name:string;
friendly:bool = false (deprecated);
inventory:[ubyte];
color:Color = Blue;
weapons:[Weapon];
equipped:Equipment;
path:[Vec3];
}
table Weapon {
name:string;
damage:short;
}
root_type Monster;

View File

@@ -0,0 +1,104 @@
/*
* Copyright 2015 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "monster_generated.h" // Already includes "flatbuffers/flatbuffers.h".
using namespace MyGame::Sample;
// Example how to use FlatBuffers to create and read binary buffers.
int main(int /*argc*/, const char * /*argv*/[]) {
// Build up a serialized buffer algorithmically:
flatbuffers::FlatBufferBuilder builder;
// First, lets serialize some weapons for the Monster: A 'sword' and an 'axe'.
auto weapon_one_name = builder.CreateString("Sword");
short weapon_one_damage = 3;
auto weapon_two_name = builder.CreateString("Axe");
short weapon_two_damage = 5;
// Use the `CreateWeapon` shortcut to create Weapons with all fields set.
auto sword = CreateWeapon(builder, weapon_one_name, weapon_one_damage);
auto axe = CreateWeapon(builder, weapon_two_name, weapon_two_damage);
// Create a FlatBuffer's `vector` from the `std::vector`.
std::vector<flatbuffers::Offset<Weapon>> weapons_vector;
weapons_vector.push_back(sword);
weapons_vector.push_back(axe);
auto weapons = builder.CreateVector(weapons_vector);
// Second, serialize the rest of the objects needed by the Monster.
auto position = Vec3(1.0f, 2.0f, 3.0f);
auto name = builder.CreateString("MyMonster");
unsigned char inv_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
auto inventory = builder.CreateVector(inv_data, 10);
// Shortcut for creating monster with all fields set:
auto orc = CreateMonster(builder, &position, 150, 80, name, inventory,
Color_Red, weapons, Equipment_Weapon, axe.Union());
builder.Finish(orc); // Serialize the root of the object.
// We now have a FlatBuffer we can store on disk or send over a network.
// ** file/network code goes here :) **
// access builder.GetBufferPointer() for builder.GetSize() bytes
// Instead, we're going to access it right away (as if we just received it).
// Get access to the root:
auto monster = GetMonster(builder.GetBufferPointer());
// Get and test some scalar types from the FlatBuffer.
assert(monster->hp() == 80);
assert(monster->mana() == 150); // default
assert(monster->name()->str() == "MyMonster");
// Get and test a field of the FlatBuffer's `struct`.
auto pos = monster->pos();
assert(pos);
assert(pos->z() == 3.0f);
(void)pos;
// Get a test an element from the `inventory` FlatBuffer's `vector`.
auto inv = monster->inventory();
assert(inv);
assert(inv->Get(9) == 9);
(void)inv;
// Get and test the `weapons` FlatBuffers's `vector`.
std::string expected_weapon_names[] = { "Sword", "Axe" };
short expected_weapon_damages[] = { 3, 5 };
auto weps = monster->weapons();
for (unsigned int i = 0; i < weps->size(); i++) {
assert(weps->Get(i)->name()->str() == expected_weapon_names[i]);
assert(weps->Get(i)->damage() == expected_weapon_damages[i]);
}
(void)expected_weapon_names;
(void)expected_weapon_damages;
// Get and test the `Equipment` union (`equipped` field).
assert(monster->equipped_type() == Equipment_Weapon);
auto equipped = static_cast<const Weapon *>(monster->equipped());
assert(equipped->name()->str() == "Axe");
assert(equipped->damage() == 5);
(void)equipped;
printf("The FlatBuffer was successfully created and verified!\n");
}

View File

@@ -0,0 +1,48 @@
/*
* Copyright 2018 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <cstdlib>
#include <iostream>
#include "flatbuffers/flatbuffers.h"
#ifndef FLATBUFFERS_HEADER_ONLY
#include "flatbuffers/util.h"
#endif
// Test to validate Conan package generated
int main(int /*argc*/, const char * /*argv*/ []) {
flatbuffers::FlatBufferBuilder builder;
const auto offset = builder.CreateString("test");
if (!offset.IsNull()) {
std::cout << "Offset is " << builder.CreateString("test").o << ".\n";
} else {
std::cout << "Offset is null.\n";
return EXIT_FAILURE;
}
#ifndef FLATBUFFERS_HEADER_ONLY
const std::string filename("conanbuildinfo.txt");
if (flatbuffers::FileExists(filename.c_str())) {
std::cout << "File " << filename << " exists.\n";
} else {
std::cout << "File " << filename << " does not exist.\n";
}
#endif
return EXIT_SUCCESS;
}

33
flatbuffers/config.yml Normal file
View File

@@ -0,0 +1,33 @@
versions:
"25.12.19":
folder: all
"25.9.23":
folder: all
"25.2.10":
folder: all
"24.12.23":
folder: all
"24.3.25":
folder: all
"24.3.7":
folder: all
"23.5.26":
folder: all
"23.3.3":
folder: all
"23.1.21":
folder: all
"22.12.06":
folder: all
"22.11.23":
folder: all
"22.10.26":
folder: all
"22.9.29":
folder: all
"2.0.8":
folder: all
"2.0.5":
folder: all
"1.12.0":
folder: all

View File

@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 3.15)
project(lodepng LANGUAGES CXX)
add_library(lodepng ${LODEPNG_SRC_DIR}/lodepng.cpp)
set_target_properties(lodepng PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON)
include(GNUInstallDirs)
install(TARGETS lodepng
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}")
install(FILES ${LODEPNG_SRC_DIR}/lodepng.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

View File

@@ -0,0 +1,7 @@
sources:
"cci.20250727":
url: "https://github.com/lvandeve/lodepng/archive/344b4b442d0de0787a999724dd6569461a00c92c.tar.gz"
sha256: "ffc13ecfbe27978e018e2ac6b089d6a2bd1a571d81b5ebb50e7364ec17ca3a74"
"cci.20241228":
url: "https://github.com/lvandeve/lodepng/archive/0b1d9ccfc2093e5d6620cd9a11d03ee6ff6705f5.tar.gz"
sha256: "d3efafbd2c938f834aa9ff764e93425fdf7f78e9f74e92285ff991b45708c72a"

68
lodepng/all/conanfile.py Normal file
View File

@@ -0,0 +1,68 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
import os
required_conan_version = ">=1.53.0"
class LodepngConan(ConanFile):
name = "lodepng"
description = "PNG encoder and decoder in C and C++, without dependencies."
license = "Zlib"
topics = ("png", "encoder", "decoder")
homepage = "https://github.com/lvandeve/lodepng"
url = "https://github.com/conan-io/conan-center-index"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
exports_sources = "CMakeLists.txt"
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
def validate(self):
if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self):
raise ConanInvalidConfiguration("lodepng shared doesn't support Visual Studio with static runtime")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["LODEPNG_SRC_DIR"] = self.source_folder.replace("\\", "/")
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir))
cmake.build()
def package(self):
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["lodepng"]
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("m")

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(lodepng REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE lodepng::lodepng)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11)

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,12 @@
#include <iostream>
#include "lodepng.h"
int main(int argc, const char *argv[])
{
LodePNGCompressSettings compress_settings;
lodepng_compress_settings_init(&compress_settings);
printf("compress_settings.btype = %d\n", compress_settings.btype);
return 0;
}

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.1)
project(test_package)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
${CMAKE_CURRENT_BINARY_DIR}/test_package)

View File

@@ -0,0 +1,17 @@
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)

5
lodepng/config.yml Normal file
View File

@@ -0,0 +1,5 @@
versions:
"cci.20250727":
folder: all
"cci.20241228":
folder: all

View File

@@ -0,0 +1,7 @@
sources:
"1.0":
url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v1.0.tar.gz"
sha256: "30d1c3651986b2074e847b17223a7269c9612ab7f148b944250f81214fed4993"
"0.25":
url: "https://github.com/zeux/meshoptimizer/archive/refs/tags/v0.25.tar.gz"
sha256: "68b2fef4e4eaad98e00c657c1e7f8982a7176e61dd7efdeaec67a025b8519be9"

View File

@@ -0,0 +1,71 @@
from conan import ConanFile
from conan.tools.build import stdcpp_library
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rm, rmdir
import os
required_conan_version = ">=1.54.0"
class MeshOptimizerConan(ConanFile):
name = "meshoptimizer"
description = "Mesh optimization library that makes meshes smaller and faster to render"
topics = ("mesh", "optimizer", "3d")
homepage = "https://github.com/zeux/meshoptimizer"
url = "https://github.com/conan-io/conan-center-index"
license = "MIT"
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["MESHOPT_BUILD_SHARED_LIBS"] = self.options.shared
tc.generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
cmake = CMake(self)
cmake.install()
rm(self, "*.pdb", os.path.join(self.package_folder, "bin"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "meshoptimizer")
self.cpp_info.set_property("cmake_target_name", "meshoptimizer::meshoptimizer")
self.cpp_info.libs = ["meshoptimizer"]
if not self.options.shared:
libcxx = stdcpp_library(self)
if libcxx:
self.cpp_info.system_libs.append(libcxx)
if self.options.shared:
self.cpp_info.defines = ["MESHOPTIMIZER_ALLOC_EXPORT"]
if self.settings.os == "Windows":
self.cpp_info.defines.append("MESHOPTIMIZER_API=__declspec(dllimport)")

View File

@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES C)
find_package(meshoptimizer REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE meshoptimizer::meshoptimizer)

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,9 @@
#include "meshoptimizer.h"
int main()
{
meshopt_encodeVertexVersion(0);
meshopt_encodeIndexVersion(1);
return 0;
}

5
meshoptimizer/config.yml Normal file
View File

@@ -0,0 +1,5 @@
versions:
"1.0":
folder: all
"0.25":
folder: all

View File

@@ -0,0 +1,37 @@
if(NOT TARGET minject)
if(CMAKE_CROSSCOMPILING)
find_program(MINJECT_EXECUTABLE
NAMES minject
PATHS ENV PATH
NO_DEFAULT_PATH
)
find_program(MINJECT32_EXECUTABLE
NAMES minject32
PATHS ENV PATH
NO_DEFAULT_PATH
)
else()
find_program(MINJECT_EXECUTABLE
NAMES minject
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/"
NO_DEFAULT_PATH
)
find_program(MINJECT32_EXECUTABLE
NAMES minject32
PATHS "${CMAKE_CURRENT_LIST_DIR}/../../bin/"
NO_DEFAULT_PATH
)
endif()
if(MINJECT_EXECUTABLE)
get_filename_component(MINJECT_EXECUTABLE "${MINJECT_EXECUTABLE}" ABSOLUTE)
add_executable(minject IMPORTED)
set_property(TARGET minject PROPERTY IMPORTED_LOCATION ${MINJECT_EXECUTABLE})
endif()
if(MINJECT32_EXECUTABLE)
get_filename_component(MINJECT32_EXECUTABLE "${MINJECT32_EXECUTABLE}" ABSOLUTE)
add_executable(minject32 IMPORTED)
set_property(TARGET minject32 PROPERTY IMPORTED_LOCATION ${MINJECT32_EXECUTABLE})
endif()
endif()

View File

@@ -0,0 +1,80 @@
sources:
"3.1.5":
url: "https://github.com/microsoft/mimalloc/archive/v3.1.5.tar.gz"
sha256: "1c6949032069d5ebea438ec5cedd602d06f40a92ddf0f0d9dcff0993e5f6635c"
"2.2.4":
url: "https://github.com/microsoft/mimalloc/archive/v2.2.4.tar.gz"
sha256: "754a98de5e2912fddbeaf24830f982b4540992f1bab4a0a8796ee118e0752bda"
"2.1.9":
url: "https://github.com/microsoft/mimalloc/archive/v2.1.9.tar.gz"
sha256: "dd8ff701691f19bf4e225d42ef0d3d5e6ca0e03498ee4f044a0402e4697e4a20"
"2.1.7":
url: "https://github.com/microsoft/mimalloc/archive/v2.1.7.tar.gz"
sha256: "0eed39319f139afde8515010ff59baf24de9e47ea316a315398e8027d198202d"
"2.1.2":
url: "https://github.com/microsoft/mimalloc/archive/v2.1.2.tar.gz"
sha256: "2b1bff6f717f9725c70bf8d79e4786da13de8a270059e4ba0bdd262ae7be46eb"
"2.0.9":
url: "https://github.com/microsoft/mimalloc/archive/v2.0.9.tar.gz"
sha256: "4a29edae32a914a706715e2ac8e7e4109e25353212edeed0888f4e3e15db5850"
"1.8.7":
url: "https://github.com/microsoft/mimalloc/archive/v1.8.7.tar.gz"
sha256: "347793a2c614e525edc4e286ab5cbc4c7a5efc12503e2dafca276d78394c4f07"
"1.8.2":
url: "https://github.com/microsoft/mimalloc/archive/v1.8.2.tar.gz"
sha256: "4058d53d6ceb75862f32c30a6ee686c3cbb5e965b2c324b828ca454f7fe064f9"
"1.7.9":
url: "https://github.com/microsoft/mimalloc/archive/v1.7.9.tar.gz"
sha256: "45e05be518363d32b2cdcce1a1fac3580895ea2e4524e1a3c7e71145cb58659f"
"1.7.6":
url: "https://github.com/microsoft/mimalloc/archive/v1.7.6.tar.gz"
sha256: "d74f86ada2329016068bc5a243268f1f555edd620b6a7d6ce89295e7d6cf18da"
patches:
"2.2.4":
- patch_file: "patches/2.2.4-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"2.1.9":
- patch_file: "patches/2.1.9-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"2.1.7":
- patch_file: "patches/2.1.7-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"2.1.2":
- patch_file: "patches/2.1.2-0001-change-install-paths.patch"
patch_description: "fix install paths"
patch_type: "conan"
- patch_file: "patches/2.1.2-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"2.0.9":
- patch_file: "patches/2.0.9-0001-change-install-paths.patch"
patch_description: "fix install paths"
patch_type: "conan"
- patch_file: "patches/2.0.9-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"1.8.7":
- patch_file: "patches/1.8.7-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"1.8.2":
- patch_file: "patches/1.8.2-0001-change-install-paths.patch"
patch_description: "fix install paths"
patch_type: "conan"
- patch_file: "patches/1.8.2-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"1.7.9":
- patch_file: "patches/1.7.9-0001-change-install-paths.patch"
patch_description: "fix install paths"
patch_type: "conan"
- patch_file: "patches/1.7.9-0002-support-older-compiler.patch"
patch_description: "fix compilation errors on older compilers"
patch_type: "portability"
"1.7.6":
- patch_file: "patches/1.7.5-0001-change-install-paths.patch"
patch_description: "fix install paths"
patch_type: "conan"

246
mimalloc/all/conanfile.py Normal file
View File

@@ -0,0 +1,246 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file, collect_libs
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, VCVars
from conan.tools.env import VirtualBuildEnv
from conan.tools.scm import Version
import os
import shutil
required_conan_version = ">=2"
class MimallocConan(ConanFile):
name = "mimalloc"
description = "mimalloc is a compact general purpose allocator with excellent performance."
license = "MIT"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/microsoft/mimalloc"
topics = ("mimalloc", "allocator", "performance", "microsoft")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
"secure": [True, False],
"override": [True, False],
"inject": [True, False],
"single_object": [True, False],
"guarded": [True, False],
"win_redirect": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"secure": False,
"override": False,
"inject": False,
"single_object": False,
"guarded": False,
"win_redirect": False,
}
def export_sources(self):
export_conandata_patches(self)
copy(self, os.path.join("cmake", "MinjectTargets.cmake"), self.recipe_folder, self.export_sources_folder)
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
else:
del self.options.win_redirect
# single_object and inject are options
# only when overriding on Unix-like platforms:
if is_msvc(self):
del self.options.single_object
del self.options.inject
if Version(self.version) < "2.1.9":
del self.options.guarded
def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
# single_object is valid only for static
# override:
self.options.rm_safe("single_object")
# inject is valid only for Unix-like dynamic override:
if not self.options.shared:
self.options.rm_safe("inject")
# single_object and inject are valid only when
# overriding on Unix-like platforms:
if not self.options.override:
self.options.rm_safe("single_object")
self.options.rm_safe("inject")
def layout(self):
cmake_layout(self, src_folder="src")
def validate(self):
# Currently, mimalloc some version do not work properly with shared MD builds.
# https://github.com/conan-io/conan-center-index/pull/10333#issuecomment-1114110046
if Version(self.version) == "1.7.6" and \
self.options.shared and \
is_msvc(self) and \
not is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(
f"Currently, {self.ref} doesn't work properly with shared MD builds in CCI. Contributions welcomed")
# Shared overriding requires dynamic runtime for MSVC:
if self.options.override and \
self.options.shared and \
is_msvc(self) and \
is_msvc_static_runtime(self):
raise ConanInvalidConfiguration(
"Dynamic runtime (MD/MDd) is required when using mimalloc as a shared library for override")
if self.options.get_safe("win_redirect") and not (
self.options.override and \
self.options.shared and \
is_msvc(self) and \
not is_msvc_static_runtime(self)):
raise ConanInvalidConfiguration(
"Windows redirect requires 'override', 'shared' and building against a dynamic runtime (MD/MDd)")
if self.options.override and \
self.options.get_safe("single_object") and \
self.options.get_safe("inject"):
raise ConanInvalidConfiguration("Single object is incompatible with library injection")
def build_requirements(self):
self.tool_requires("cmake/[>=3.18 <4]")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
tc = CMakeToolchain(self)
tc.variables["MI_BUILD_TESTS"] = "OFF"
tc.variables["MI_BUILD_SHARED"] = self.options.shared
tc.variables["MI_BUILD_STATIC"] = not self.options.shared
tc.variables["MI_BUILD_OBJECT"] = self.options.get_safe("single_object", False)
tc.variables["MI_OVERRIDE"] = "ON" if self.options.override else "OFF"
tc.variables["MI_SECURE"] = "ON" if self.options.secure else "OFF"
tc.variables["MI_WIN_REDIRECT"] = "ON" if self.options.get_safe("win_redirect") else "OFF"
tc.variables["MI_INSTALL_TOPLEVEL"] = "ON"
tc.variables["MI_GUARDED"] = self.options.get_safe("guarded", False)
if Version(self.version) <= "1.7.6":
tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support
tc.generate()
venv = VirtualBuildEnv(self)
venv.generate(scope="build")
if is_msvc(self):
vcvars = VCVars(self)
vcvars.generate()
def build(self):
apply_conandata_patches(self)
if is_msvc(self) and self.settings.arch == "x86" and self.options.shared:
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
"mimalloc-redirect.lib",
"mimalloc-redirect32.lib")
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()
rmdir(self, os.path.join(self.package_folder, "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
if self.options.get_safe("single_object"):
rm(self, "*.a", os.path.join(self.package_folder, "lib"))
shutil.copy(os.path.join(self.package_folder, "lib", self._obj_name + ".o"),
os.path.join(self.package_folder, "lib", self._obj_name))
if self.settings.os == "Windows" and self.options.shared:
if self.settings.arch == "x86_64":
copy(self, "mimalloc-redirect.dll",
src=os.path.join(self.source_folder, "bin"),
dst=os.path.join(self.package_folder, "bin"))
copy(self, "minject.exe",
src=os.path.join(self.source_folder, "bin"),
dst=os.path.join(self.package_folder, "bin"))
elif self.settings.arch == "x86":
copy(self, "mimalloc-redirect32.dll",
src=os.path.join(self.source_folder, "bin"),
dst=os.path.join(self.package_folder, "bin"))
copy(self, "minject32.exe",
src=os.path.join(self.source_folder, "bin"),
dst=os.path.join(self.package_folder, "bin"))
rmdir(self, os.path.join(self.package_folder, "share"))
copy(self, "MinjectTargets.cmake",
src=os.path.join(self.source_folder, os.pardir, "cmake"),
dst=os.path.join(self.package_folder, self._module_path))
@property
def _obj_name(self):
name = "mimalloc"
if self.options.secure:
name += "-secure"
if self.settings.build_type not in ("Release", "RelWithDebInfo", "MinSizeRel"):
name += "-{}".format(str(self.settings.build_type).lower())
return name
@property
def _lib_name(self):
name = "mimalloc" if self.settings.os == "Windows" else "libmimalloc"
if self.settings.os == "Windows" and not self.options.shared:
name += "-static"
if self.options.secure:
name += "-secure"
if self.settings.build_type not in ("Release", "RelWithDebInfo", "MinSizeRel"):
name += "-{}".format(str(self.settings.build_type).lower())
return name
@property
def _module_path(self):
return os.path.join(self.package_folder, "lib", "cmake")
def package_info(self):
self.cpp_info.set_property("cmake_file_name", "mimalloc")
self.cpp_info.set_property("cmake_target_name", "mimalloc" if self.options.shared else "mimalloc-static")
if self.options.get_safe("inject"):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
self.cpp_info.resdirs = []
return
if self.options.get_safe("single_object"):
obj_ext = "o"
obj_file = "{}.{}".format(self._obj_name, obj_ext)
obj_path = os.path.join(self.package_folder, "lib", obj_file)
self.cpp_info.exelinkflags = [obj_path]
self.cpp_info.sharedlinkflags = [obj_path]
self.cpp_info.libdirs = []
self.cpp_info.bindirs = []
else:
self.cpp_info.libs = collect_libs(self)
if self.settings.os == "Linux":
self.cpp_info.system_libs.append("pthread")
if not self.options.shared:
if self.settings.os == "Windows":
self.cpp_info.system_libs.extend(["psapi", "shell32", "user32", "bcrypt"])
elif self.settings.os == "Linux":
self.cpp_info.system_libs.append("rt")
if self.settings.os == "Windows" and self.options.shared:
build_modules = [
os.path.join(self._module_path, "MinjectTargets.cmake"),
]
self.cpp_info.set_property("cmake_build_modules", build_modules)

View File

@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1207bb..feeecb6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -319,7 +319,7 @@ if(MI_BUILD_SHARED)
install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir})
endif()
- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY)
+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()
@@ -343,7 +343,7 @@ if (MI_BUILD_STATIC)
set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename})
endif()
- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY)
+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()

View File

@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0011b87..41a15a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -383,7 +383,7 @@ if(MI_BUILD_SHARED)
install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir})
endif()
- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY)
+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()
@@ -407,7 +407,7 @@ if (MI_BUILD_STATIC)
set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename})
endif()
- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY)
+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()

View File

@@ -0,0 +1,22 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index f590033..a4275c5 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -493,7 +493,7 @@ template<class T, bool destroy> struct _mi_heap_stl_allocator_common : public _m
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -504,7 +504,7 @@ protected:
this->heap.reset(hp, (destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bcd1ef..615cec9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -415,7 +415,7 @@ if(MI_BUILD_SHARED)
install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir})
endif()
- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY)
+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()
@@ -439,7 +439,7 @@ if (MI_BUILD_STATIC)
set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename})
endif()
- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY)
+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()

View File

@@ -0,0 +1,22 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index 368c22c..fb19939 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -505,7 +505,7 @@ template<class T, bool _mi_destroy> struct _mi_heap_stl_allocator_common : publi
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -516,7 +516,7 @@ protected:
this->heap.reset(hp, (_mi_destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,22 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index ae6f99b..773424e 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -511,7 +511,7 @@ template<class T, bool _mi_destroy> struct _mi_heap_stl_allocator_common : publi
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -522,7 +522,7 @@ protected:
this->heap.reset(hp, (_mi_destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,22 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74c1f29..d657144 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -383,7 +383,7 @@ if(MI_BUILD_SHARED)
install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir})
endif()
- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY)
+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()
@@ -407,7 +407,7 @@ if (MI_BUILD_STATIC)
set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename})
endif()
- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY)
+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()

View File

@@ -0,0 +1,22 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index 9b72fbf..b34362f 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -500,7 +500,7 @@ template<class T, bool destroy> struct _mi_heap_stl_allocator_common : public _m
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -511,7 +511,7 @@ protected:
this->heap.reset(hp, (destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2bcd1ef..37eee49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -415,7 +415,7 @@ if(MI_BUILD_SHARED)
install(FILES "$<TARGET_FILE_DIR:mimalloc>/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir})
endif()
- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY)
+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir})
endif()

View File

@@ -0,0 +1,22 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index f77c2ea..4c9594f 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -508,7 +508,7 @@ template<class T, bool _mi_destroy> struct _mi_heap_stl_allocator_common : publi
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -519,7 +519,7 @@ protected:
this->heap.reset(hp, (_mi_destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,22 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index c41bcc8..cc4929e 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -512,7 +512,7 @@ template<class T, bool _mi_destroy> struct _mi_heap_stl_allocator_common : publi
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -523,7 +523,7 @@ protected:
this->heap.reset(hp, (_mi_destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap) { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,23 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index bd91db4..f6aa1aa 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -544,7 +544,7 @@ template<class T, bool _mi_destroy> struct _mi_heap_stl_allocator_common : publi
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -555,7 +555,8 @@ protected:
this->heap.reset(hp, (_mi_destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap)
+ { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,23 @@
diff --git a/include/mimalloc.h b/include/mimalloc.h
index bd91db4..f6aa1aa 100644
--- a/include/mimalloc.h
+++ b/include/mimalloc.h
@@ -555,7 +555,7 @@ template<class T, bool _mi_destroy> struct _mi_heap_stl_allocator_common : publi
#endif
void collect(bool force) { mi_heap_collect(this->heap.get(), force); }
- template<class U> bool is_equal(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) const { return (this->heap == x.heap); }
+ template<class U, bool b> bool is_equal(const _mi_heap_stl_allocator_common<U, b>& x) const { return (this->heap == x.heap); }
protected:
std::shared_ptr<mi_heap_t> heap;
@@ -566,7 +566,8 @@ protected:
this->heap.reset(hp, (_mi_destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */
}
_mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { }
- template<class U> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, _mi_destroy>& x) mi_attr_noexcept : heap(x.heap) { }
+ template<class U, bool b> _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common<U, b>& x) mi_attr_noexcept : heap(x.heap)
+ { }
private:
static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } }

View File

@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES C)
find_package(mimalloc REQUIRED CONFIG)
find_program(MINJECT_EXECUTABLE NAMES minject)
execute_process(COMMAND ${MINJECT_EXECUTABLE} -h)
find_program(MINJECT32_EXECUTABLE NAMES minject32)
execute_process(COMMAND ${MINJECT32_EXECUTABLE} -h)
add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE $<IF:$<TARGET_EXISTS:mimalloc>,mimalloc,mimalloc-static>)
target_compile_features(${PROJECT_NAME} PRIVATE c_std_99)

View File

@@ -0,0 +1,28 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import CMake, cmake_layout
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def configure(self):
self.options["mimalloc"].shared = True
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,14 @@
#include "mimalloc.h"
#include <stdlib.h>
#include <stdio.h>
int main() {
void *data = mi_malloc(32);
printf("mimalloc version %d\n", mi_version());
mi_free(data);
return EXIT_SUCCESS;
}

23
mimalloc/config.yml Normal file
View File

@@ -0,0 +1,23 @@
versions:
"3.1.5":
folder: all
"2.2.4":
folder: all
"2.1.9":
folder: all
"2.1.7":
folder: all
# mold requires 2.1.2
"2.1.2":
folder: all
"2.0.9":
folder: all
"1.8.7":
folder: all
"1.8.2":
folder: all
"1.7.9":
folder: all
# arrow requires 1.7.6
"1.7.6":
folder: all

View File

@@ -0,0 +1,18 @@
sources:
"1.0.3":
url: "https://github.com/jwmcglynn/pixelmatch-cpp17/archive/refs/tags/v1.0.3.tar.gz"
sha256: "7ed08fe1916413f88b4411a6bd510afb7e39260ce9f79c80373b252d01a80d1d"
"09102024":
url: "https://github.com/jwmcglynn/pixelmatch-cpp17/archive/bfc8c6c20cd89688f8b5412af7f89ad5e761d189.tar.gz"
sha256: "360c11ae82fc7dd70427d4a32fb3b8c5e2d5e9bd85dfb90933747967a898ab2d"
"23052024":
url: "https://github.com/jwmcglynn/pixelmatch-cpp17/archive/e65772b1a00d9fa4fe69d1553010f98f01e6156b.tar.gz"
sha256: "786ad1b1ec0323257002a6c100e00db55f305d8d4d92ff2ba5dbf846c687c67e"
"01082023":
url: "https://github.com/jwmcglynn/pixelmatch-cpp17/archive/5cec7dd16fa02babbc7efdccfb4d130ede29f621.tar.gz"
sha256: "a7224d397c61a3819e4e68188c338cbfe4b7f5513ad7b543b7d65e821296708d"
patches:
"1.0.3":
- patch_file: "patches/1.0.3-conan-dependencies.patch"
patch_description: "Include conan dependencies"
patch_type: "conan"

View File

@@ -0,0 +1,77 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.build import check_min_cppstd, valid_min_cppstd
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.layout import basic_layout
from conan.tools.scm import Version
import os
required_conan_version = ">=1.52.0"
class PixelMatchCPP17Conan(ConanFile):
name = "pixelmatch-cpp17"
description = "A C++17 port of the JavaScript pixelmatch library, providing a small pixel-level image comparison library."
license = "Apache-2.0"
topics = ("image", "comparison")
homepage = "https://github.com/jwmcglynn/pixelmatch-cpp17"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
@property
def _source_subfolder(self):
return "source_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:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
apply_conandata_patches(self)
def generate(self):
tc = CMakeToolchain(self)
tc.generate()
CMakeDeps(self).generate()
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(
self,
"LICENSE",
src=self._source_subfolder,
dst=os.path.join(self.package_folder, "licenses"),
)
cmake = CMake(self)
cmake.install()
def package_info(self):
self.cpp_info.libs = ["pixelmatch-cpp17"]
def requirements(self):
if(Version(self.version) == "1.0.3"):
self.requires("stb/cci.20240531", transitive_headers=True)

View File

@@ -0,0 +1,61 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4ed9a7..a5b6a69 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,14 +6,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(PIXELMATCH_BUILD_TESTS "Enable building tests" OFF)
-# stb libraries for tests and image_utils. Not used in pixelmatch-cpp17 itself.
-add_library(pixelmatch_third_party_stb_image STATIC third_party/stb/stb_image.cpp)
-target_include_directories(pixelmatch_third_party_stb_image PUBLIC third_party)
-target_compile_options(pixelmatch_third_party_stb_image PRIVATE -Wno-unused-function -Wno-self-assign)
-
-add_library(pixelmatch_third_party_stb_image_write STATIC third_party/stb/stb_image_write.cpp)
-target_include_directories(pixelmatch_third_party_stb_image_write PUBLIC third_party)
-target_compile_options(pixelmatch_third_party_stb_image_write PRIVATE -Wno-unused-function -Wno-self-assign)
+find_package(stb)
# Main library
add_library(pixelmatch-cpp17 src/pixelmatch/pixelmatch.cc)
@@ -22,16 +15,18 @@ target_include_directories(pixelmatch-cpp17 PUBLIC src)
# image_utils helper library (uses stb to load and save images)
add_library(image_utils src/pixelmatch/image_utils.cc)
target_include_directories(image_utils PUBLIC src)
-target_link_libraries(image_utils PUBLIC pixelmatch-cpp17 pixelmatch_third_party_stb_image pixelmatch_third_party_stb_image_write)
+target_link_libraries(image_utils PUBLIC pixelmatch-cpp17 stb::stb)
+
+install(FILES src/pixelmatch/pixelmatch.h DESTINATION include/pixelmatch)
+install(TARGETS pixelmatch-cpp17 DESTINATION lib)
+
+if ((MSVC) AND (MSVC_VERSION GREATER_EQUAL 1914))
+ target_compile_options(${PROJECT_NAME} PRIVATE "/Zc:preprocessor")
+ target_compile_options(${PROJECT_NAME} PRIVATE "/Zc:__cplusplus")
+endif()
if(PIXELMATCH_BUILD_TESTS)
-include(FetchContent)
-FetchContent_Declare(
- googletest
- URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip
-)
-set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
-FetchContent_MakeAvailable(googletest)
+find_package(GTest)
enable_testing()
add_library(test_base INTERFACE)
diff --git a/src/pixelmatch/image_utils.cc b/src/pixelmatch/image_utils.cc
index 74ec434..068e75d 100644
--- a/src/pixelmatch/image_utils.cc
+++ b/src/pixelmatch/image_utils.cc
@@ -1,7 +1,7 @@
#include "pixelmatch/image_utils.h"
-#include <stb/stb_image.h>
-#include <stb/stb_image_write.h>
+#include <stb_image.h>
+#include <stb_image_write.h>
#include <cassert>
#include <cstring> // For memcmp.

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package)
find_package(pixelmatch-cpp17 REQUIRED)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} pixelmatch-cpp17::pixelmatch-cpp17)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20)

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
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 can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,13 @@
#include <pixelmatch/pixelmatch.h>
int main()
{
pixelmatch::pixelmatch(
{},
{},
{},
2,
2,
2);
return 0;
}

View File

@@ -0,0 +1,9 @@
versions:
"1.0.3":
folder: all
"09102024":
folder: all
"23052024":
folder: all
"01082023":
folder: all

View File

@@ -0,0 +1,7 @@
sources:
"3.0":
url: "https://github.com/Nicoshev/rapidhash/archive/refs/tags/rapidhash_v3.tar.gz"
sha256: "2e708bb2be76fd76f1e5d75bb3145d058e2dad0c5b0022646f84ec83aeff400d"
"1.0":
url: "https://github.com/Nicoshev/rapidhash/archive/refs/tags/rapidhash_v1.0.tar.gz"
sha256: "d295e66eec6745cc0e0c8c65fb8b5edf08ab3af83b0a503c54c6705144b53848"

View File

@@ -0,0 +1,44 @@
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.files import copy, get
from conan.tools.layout import basic_layout
import os
required_conan_version = ">=2"
class RapidHashConan(ConanFile):
name = "rapidhash"
description = "Very fast, high quality, platform-independent hashing algorithm"
license = "BSD-2-Clause"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/Nicoshev/rapidhash"
topics = ("hash", "wyhash", "header-only")
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True
def layout(self):
basic_layout(self, src_folder="src")
def package_id(self):
self.info.clear()
def validate(self):
check_min_cppstd(self, 11)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def package(self):
copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"))
copy(
self,
"rapidhash.h",
self.source_folder,
os.path.join(self.package_folder, "include"),
)
def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []

View File

@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX)
find_package(rapidhash REQUIRED CONFIG)
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE rapidhash::rapidhash)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)

View File

@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"
def layout(self):
cmake_layout(self)
def requirements(self):
self.requires(self.tested_reference_str)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindir, "test_package")
self.run(bin_path, env="conanrun")

View File

@@ -0,0 +1,12 @@
#include <iostream>
#include <string>
#include "rapidhash.h"
int main() {
std::string text = "Hello, rapidhash.";
std::cout << rapidhash(text.data(), text.size()) << '\n';
return 0;
}

5
rapidhash/config.yml Normal file
View File

@@ -0,0 +1,5 @@
versions:
"3.0":
folder: all
"1.0":
folder: all

61
shaderc/all/conandata.yml Normal file
View File

@@ -0,0 +1,61 @@
sources:
"2025.3":
url: "https://github.com/google/shaderc/archive/refs/tags/v2025.3.tar.gz"
sha256: "a8e4a25e5c2686fd36981e527ed05e451fcfc226bddf350f4e76181371190937"
"2024.1":
url: "https://github.com/google/shaderc/archive/refs/tags/v2024.1.tar.gz"
sha256: "eb3b5f0c16313d34f208d90c2fa1e588a23283eed63b101edd5422be6165d528"
"2023.6":
url: "https://github.com/google/shaderc/archive/refs/tags/v2023.6.tar.gz"
sha256: "e40fd4a87a56f6610e223122179f086d5c4f11a7e0e2aa461f0325c3a0acc6ae"
"2021.1":
url: "https://github.com/google/shaderc/archive/v2021.1.tar.gz"
sha256: "047113bc4628da164a3cb845efc20d442728873f6054a68ab56d04a053f2c32b"
patches:
"2025.3":
- patch_file: "patches/2025.3/use-conan-dependencies.patch"
patch_description: "Replace third_party with Conan dependencies"
patch_type: "conan"
- patch_file: "patches/2021.1/adapt-update_build_version.py.patch"
patch_description: "Adapt update_build_version.py for Conan"
patch_type: "conan"
- patch_file: "patches/2021.1/install-shaderc_util.patch"
patch_description: "install() shaderc_util"
patch_type: "conan"
"2024.1":
- patch_file: "patches/2023.6/use-conan-dependencies.patch"
patch_description: "Replace third_party with Conan dependencies"
patch_type: "conan"
- patch_file: "patches/2021.1/adapt-update_build_version.py.patch"
patch_description: "Adapt update_build_version.py for Conan"
patch_type: "conan"
- patch_file: "patches/2021.1/install-shaderc_util.patch"
patch_description: "install() shaderc_util"
patch_type: "conan"
"2023.6":
- patch_file: "patches/2023.6/use-conan-dependencies.patch"
patch_description: "Replace third_party with Conan dependencies"
patch_type: "conan"
- patch_file: "patches/2021.1/adapt-update_build_version.py.patch"
patch_description: "Adapt update_build_version.py for Conan"
patch_type: "conan"
- patch_file: "patches/2021.1/install-shaderc_util.patch"
patch_description: "install() shaderc_util"
patch_type: "conan"
"2021.1":
- patch_file: "patches/2021.1/use-conan-dependencies.patch"
patch_description: "Replace third_party with Conan dependencies"
patch_type: "conan"
- patch_file: "patches/2021.1/adapt-update_build_version.py.patch"
patch_description: "Adapt update_build_version.py for Conan"
patch_type: "conan"
- patch_file: "patches/2021.1/install-shaderc_util.patch"
patch_description: "install() shaderc_util"
patch_type: "conan"
siprv_mapping:
# TODO: bump me once newer versions are available on CCI
"2025.3": "1.4.313.0"
"2024.1": "1.3.261.1"
# "2023.6": "1.3.261.1"
"2023.6": "1.3.239.0"
"2021.1": "1.3.224.0"

133
shaderc/all/conanfile.py Normal file
View File

@@ -0,0 +1,133 @@
import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd, stdcpp_library
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.env import VirtualBuildEnv
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
from conan.tools.microsoft import is_msvc, is_msvc_static_runtime
from conan.tools.apple import fix_apple_shared_install_name
from conan.tools.scm import Version
required_conan_version = ">=1.53.0"
class ShadercConan(ConanFile):
name = "shaderc"
description = "A collection of tools, libraries and tests for shader compilation."
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/google/shaderc"
topics = ("glsl", "hlsl", "msl", "spirv", "spir-v", "glslc")
package_type = "library"
settings = "os", "arch", "compiler", "build_type"
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}
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:
self.options.rm_safe("fPIC")
def layout(self):
cmake_layout(self, src_folder="src")
@property
def _spirv_version(self):
return self.conan_data.get("siprv_mapping")[self.version]
def requirements(self):
# transitive_headers=True is not required for any of the dependencies
self.requires(f"glslang/{self._spirv_version}")
self.requires(f"spirv-tools/{self._spirv_version}")
self.requires(f"spirv-headers/{self._spirv_version}")
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 11)
def build_requirements(self):
self.tool_requires("cmake/[>=3.17.2 <4]")
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def generate(self):
venv = VirtualBuildEnv(self)
venv.generate()
tc = CMakeToolchain(self)
tc.cache_variables["SHADERC_SKIP_INSTALL"] = False
tc.cache_variables["SHADERC_SKIP_EXAMPLES"] = True
tc.cache_variables["SHADERC_SKIP_TESTS"] = True
tc.cache_variables["ENABLE_CODE_COVERAGE"] = False
tc.cache_variables["SHADERC_ENABLE_WERROR_COMPILE"] = False
if is_msvc(self):
tc.cache_variables["SHADERC_ENABLE_SHARED_CRT"] = not is_msvc_static_runtime(self)
tc.generate()
self.dependencies["glslang"].cpp_info.components["glslang-core"].includedirs.append(
os.path.join(self.dependencies["glslang"].package_folder, "include", "glslang")
)
deps = CMakeDeps(self)
deps.set_property("glslang::glslang-core", "cmake_target_name", "glslang")
deps.set_property("glslang::osdependent", "cmake_target_name", "OSDependent")
if(Version(self.version) < "2025.3"):
deps.set_property("glslang::oglcompiler", "cmake_target_name", "OGLCompiler")
deps.set_property("glslang::hlsl", "cmake_target_name", "HLSL")
deps.set_property("glslang::spirv", "cmake_target_name", "SPIRV")
deps.generate()
def build(self):
apply_conandata_patches(self)
cmake = CMake(self)
cmake.configure()
cmake.build()
def package(self):
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
cmake = CMake(self)
cmake.install()
fix_apple_shared_install_name(self)
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
def package_info(self):
if self.options.shared:
self.cpp_info.set_property("pkg_config_name", "shaderc")
self.cpp_info.libs = ["shaderc_shared"]
self.cpp_info.defines.append("SHADERC_SHAREDLIB")
else:
self.cpp_info.set_property("pkg_config_name", "shaderc_static")
self.cpp_info.libs = ["shaderc", "shaderc_util"]
if stdcpp_library(self):
self.cpp_info.system_libs.append(stdcpp_library(self))
if self.settings.os in ["Linux", "FreeBSD"]:
self.cpp_info.system_libs.append("pthread")
self.cpp_info.requires = [
"glslang::glslang-core",
"glslang::osdependent",
*(["glslang::oglcompiler", "glslang::hlsl"] if Version(self.version) < Version("2025.3") else []),
"spirv-tools::spirv-tools-core",
"spirv-tools::spirv-tools-opt",
"spirv-headers::spirv-headers"
]
# TODO: to remove in conan v2
bin_path = os.path.join(self.package_folder, "bin")
self.env_info.PATH.append(bin_path)

View File

@@ -0,0 +1,25 @@
diff --git a/utils/update_build_version.py b/utils/update_build_version.py
--- a/utils/update_build_version.py
+++ b/utils/update_build_version.py
@@ -128,18 +128,18 @@
def main():
- if len(sys.argv) != 5:
+ if len(sys.argv) < 5:
print(('usage: {} <shaderc-dir> <spirv-tools-dir> <glslang-dir> <output-file>'.format(
sys.argv[0])))
sys.exit(1)
- projects = ['shaderc', 'spirv-tools', 'glslang']
+ projects = ['shaderc']
new_content = ''.join([
'"{}\\n"\n'.format(get_version_string(p, d))
for (p, d) in zip(projects, sys.argv[1:])
])
- output_file = sys.argv[4]
+ output_file = sys.argv[-1]
mkdir_p(os.path.dirname(output_file))
if os.path.isfile(output_file):

View File

@@ -0,0 +1,14 @@
diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt
--- a/libshaderc_util/CMakeLists.txt
+++ b/libshaderc_util/CMakeLists.txt
@@ -87,3 +87,10 @@
add_dependencies(shaderc_util_file_finder_test testdata)
add_dependencies(shaderc_util_io_shaderc_test testdata)
endif()
+
+if(SHADERC_ENABLE_INSTALL AND NOT BUILD_SHARED_LIBS)
+ install(TARGETS shaderc_util
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()

View File

@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -112,7 +112,12 @@
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
+find_package(glslang REQUIRED CONFIG)
+find_package(SPIRV-Headers REQUIRED CONFIG)
+find_package(SPIRV-Tools REQUIRED CONFIG)
+set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS})
+set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..)
+set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)

View File

@@ -0,0 +1,17 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,7 +120,12 @@
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
+find_package(glslang REQUIRED CONFIG)
+find_package(SPIRV-Headers REQUIRED CONFIG)
+find_package(SPIRV-Tools REQUIRED CONFIG)
+set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS})
+set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..)
+set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)

View File

@@ -0,0 +1,18 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06f5395..76e5179 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -130,7 +130,12 @@ endif(MSVC)
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
+find_package(glslang REQUIRED CONFIG)
+find_package(SPIRV-Headers REQUIRED CONFIG)
+find_package(SPIRV-Tools REQUIRED CONFIG)
+set(glslang_SOURCE_DIR ${glslang_INCLUDE_DIRS})
+set(SPIRV-Headers_SOURCE_DIR ${SPIRV-Headers_INCLUDE_DIR}/..)
+set(spirv-tools_SOURCE_DIR ${SPIRV-Tools_INCLUDE_DIR}/..)
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)

View File

@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 3.15)
project(test_package LANGUAGES CXX C)
find_package(shaderc REQUIRED CONFIG)
add_executable(${PROJECT_NAME}_shaderc_c test_package_shaderc.c)
target_link_libraries(${PROJECT_NAME}_shaderc_c PRIVATE shaderc::shaderc)
add_executable(${PROJECT_NAME}_shaderc_cpp test_package_shaderc.cpp)
target_link_libraries(${PROJECT_NAME}_shaderc_cpp PRIVATE shaderc::shaderc)
set_property(TARGET ${PROJECT_NAME}_shaderc_cpp PROPERTY CXX_STANDARD 11)

View File

@@ -0,0 +1,34 @@
import os
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"
def requirements(self):
self.requires(self.tested_reference_str, run=True)
def layout(self):
cmake_layout(self)
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
if can_run(self):
# Test programs consuming shaderc lib
bin_path_shaderc_c = os.path.join(self.cpp.build.bindir, "test_package_shaderc_c")
self.run(bin_path_shaderc_c, env="conanrun")
bin_path_shaderc_cpp = os.path.join(self.cpp.build.bindir, "test_package_shaderc_cpp")
self.run(bin_path_shaderc_cpp, env="conanrun")
# Test glslc executable
self.run(f"glslc -h", env="conanrun")

View File

@@ -0,0 +1,8 @@
#include <shaderc/shaderc.h>
int main() {
shaderc_compiler_t shaderc_compiler = shaderc_compiler_initialize();
shaderc_compiler_release(shaderc_compiler);
return 0;
}

Some files were not shown because too many files have changed in this diff Show More