diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 8650a94..7b1e425 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -64,7 +64,7 @@ jobs: --version=${{ matrix.package.version }} \ --user=bigfootdev \ --channel=${{ env.BRANCH_NAME }} \ - -pr:b=clang -pr:h=clang \ + -pr:b=./ConanProfiles/clang -pr:h=./ConanProfiles/clang \ --build=missing --remote=bigfootpackages CONAN_LOGIN_USERNAME=${ARTIFACTORY_USER} \ diff --git a/ConanProfiles/clang b/ConanProfiles/clang new file mode 100644 index 0000000..7e55968 --- /dev/null +++ b/ConanProfiles/clang @@ -0,0 +1,26 @@ +[settings] +os=Linux +arch=x86_64 +compiler=clang +compiler.version=20 +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:extra_variables*={'BIGFOOT_CXX_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-ffast-math;-fno-exceptions;-fno-rtti', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_C_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-ffast-math', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}} +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] \ No newline at end of file diff --git a/ConanProfiles/clang_coverage b/ConanProfiles/clang_coverage new file mode 100644 index 0000000..7e108a2 --- /dev/null +++ b/ConanProfiles/clang_coverage @@ -0,0 +1,25 @@ +[settings] +os=Linux +arch=x86_64 +compiler=clang +compiler.version=20 +compiler.libcxx=libstdc++11 +compiler.cppstd=20 +compiler.cstd=17 +build_type=Debug +[conf] +tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_CXX_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-fno-exceptions;-fno-rtti;-fprofile-instr-generate;-fcoverage-mapping', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_C_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-fprofile-instr-generate;-fcoverage-mapping', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_SHARED_LINK_FLAGS': {'value': '-fprofile-instr-generate', 'cache': True, 'type': 'STRING', 'docstring': 'SHARED link flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_EXE_LINK_FLAGS': {'value': '-fprofile-instr-generate', 'cache': True, 'type': 'STRING', 'docstring': 'EXE link flags for Bigfoot', 'force': True}} +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"] +tools.build:sharedlinkflags=["-fuse-ld=mold"] + +[tool_requires] +!cmake/*: cmake/[>=4.2] \ No newline at end of file diff --git a/ConanProfiles/clangd b/ConanProfiles/clangd new file mode 100644 index 0000000..5314e13 --- /dev/null +++ b/ConanProfiles/clangd @@ -0,0 +1,23 @@ +[settings] +os=Linux +arch=x86_64 +compiler=clang +compiler.version=20 +compiler.libcxx=libstdc++11 +compiler.cppstd=20 +compiler.cstd=17 +build_type=Debug +[conf] +tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_CXX_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-ffast-math;-fno-exceptions;-fno-rtti', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_C_FLAGS': {'value': '-Wall;-Wextra;-Wpedantic;-Werror;-ffast-math', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}} +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"] +tools.build:sharedlinkflags=["-fuse-ld=mold"] + +[tool_requires] +!cmake/*: cmake/[>=4.2] \ No newline at end of file diff --git a/ConanProfiles/msvc b/ConanProfiles/msvc new file mode 100644 index 0000000..ba0a8c6 --- /dev/null +++ b/ConanProfiles/msvc @@ -0,0 +1,22 @@ +[settings] +os=Windows +arch=x86_64 +compiler=msvc +compiler.version=195 +compiler.cppstd=20 +compiler.cstd=17 +compiler.runtime=dynamic +build_type=Release +[conf] +tools.cmake.cmaketoolchain:extra_variables={'BIGFOOT_CXX_FLAGS': {'value': '/W4;/WX;/EHs-;/D_HAS_EXCEPTIONS=0;/GR-;/fp:fast', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_C_FLAGS': {'value': '/W4;/WX;/fp:fast', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake + +tools.build:exelinkflags=["/LTCG", "/INCREMENTAL:NO"] +tools.build:sharedlinkflags=["/LTCG", "/INCREMENTAL:NO"] + +tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1", "/GL"] +tools.build:cxxflags=["/Zc:preprocessor", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:strictStrings", "/Zc:rvalueCast", "/Zc:hiddenFriend", "/Zc:externConstexpr", "/Zc:ternary", "/GL"] + +[tool_requires] +!cmake/*: cmake/[>=4.2] \ No newline at end of file diff --git a/ConanProfiles/msvc_ccache.cmake b/ConanProfiles/msvc_ccache.cmake new file mode 100644 index 0000000..2818eec --- /dev/null +++ b/ConanProfiles/msvc_ccache.cmake @@ -0,0 +1,19 @@ +# https://github.com/ccache/ccache/wiki/MS-Visual-Studio#usage-with-cmake + +find_program(ccache_exe ccache) +if(ccache_exe) + file(COPY_FILE + ${ccache_exe} ${CMAKE_BINARY_DIR}/cl.exe + ONLY_IF_DIFFERENT) + + # By default Visual Studio generators will use /Zi which is not compatible + # with ccache, so tell Visual Studio to use /Z7 instead. + message(STATUS "Setting MSVC debug information format to 'Embedded'") + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$:Embedded>") + + set(CMAKE_VS_GLOBALS + "CLToolExe=cl.exe" + "CLToolPath=${CMAKE_BINARY_DIR}" + "UseMultiToolTask=true" + ) +endif() \ No newline at end of file diff --git a/ConanProfiles/msvcd b/ConanProfiles/msvcd new file mode 100644 index 0000000..1caf4c6 --- /dev/null +++ b/ConanProfiles/msvcd @@ -0,0 +1,19 @@ +[settings] +os=Windows +arch=x86_64 +compiler=msvc +compiler.version=195 +compiler.cppstd=20 +compiler.cstd=17 +compiler.runtime=dynamic +build_type=Debug +[conf] +tools.cmake.cmaketoolchain:extra_variables={'BIGFOOT_CXX_FLAGS': {'value': '/W4;/WX;/EHs-;/D_HAS_EXCEPTIONS=0;/GR-;/fp:fast', 'cache': True, 'type': 'STRING', 'docstring': 'CXX flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:extra_variables*={'BIGFOOT_C_FLAGS': {'value': '/W4;/WX;/fp:fast', 'cache': True, 'type': 'STRING', 'docstring': 'C flags for Bigfoot', 'force': True}} +tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake + +tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1"] +tools.build:cxxflags=["/Zc:preprocessor", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:strictStrings", "/Zc:rvalueCast", "/Zc:hiddenFriend", "/Zc:externConstexpr", "/Zc:ternary"] + +[tool_requires] +!cmake/*: cmake/[>=4.2] \ No newline at end of file diff --git a/mimalloc/all/conanfile.py b/mimalloc/all/conanfile.py index 1f12ff6..21779db 100644 --- a/mimalloc/all/conanfile.py +++ b/mimalloc/all/conanfile.py @@ -29,6 +29,7 @@ class MimallocConan(ConanFile): "single_object": [True, False], "guarded": [True, False], "win_redirect": [True, False], + "asan": [True, False], } default_options = { "shared": False, @@ -39,6 +40,7 @@ class MimallocConan(ConanFile): "single_object": False, "guarded": False, "win_redirect": False, + "asan": False, } def export_sources(self): @@ -91,6 +93,11 @@ class MimallocConan(ConanFile): raise ConanInvalidConfiguration( f"Currently, {self.ref} doesn't work properly with shared MD builds in CCI. Contributions welcomed") + if self.options.override and \ + self.options.asan: + raise ConanInvalidConfiguration( + "Asan requires Mimalloc to be compiled without override") + # Shared overriding requires dynamic runtime for MSVC: if self.options.override and \ self.options.shared and \ @@ -129,6 +136,7 @@ class MimallocConan(ConanFile): 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) + tc.variables["MI_TRACK_ASAN"] = "ON" if self.options.get_safe("asan") else "OFF" if Version(self.version) <= "1.7.6": tc.cache_variables["CMAKE_POLICY_VERSION_MINIMUM"] = "3.5" # CMake 4 support tc.generate() @@ -211,9 +219,13 @@ class MimallocConan(ConanFile): 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.asan): + self.cpp_info.set_property("cmake_file_name", "mimalloc-asan") + self.cpp_info.set_property("cmake_target_name", "mimalloc-asan") + else: + 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 = []