diff --git a/ConanProfiles/Toolchains/ccache.cmake b/ConanProfiles/Toolchains/ccache.cmake new file mode 100644 index 0000000..5fce6ee --- /dev/null +++ b/ConanProfiles/Toolchains/ccache.cmake @@ -0,0 +1,30 @@ +include_guard() + +# Find ccache executable +find_program(CCACHE_PROGRAM NAMES ccache) + +if(CCACHE_PROGRAM) + message(STATUS "ccache found: ${CCACHE_PROGRAM}, enabling via CMake launcher and environment.") + if (CMAKE_GENERATOR MATCHES "Visual Studio") + # Copy original ccache.exe and rename to cl.exe, this way intermediate cmd file is not needed + file(COPY_FILE ${CCACHE_PROGRAM} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT) + + # Set Visual Studio global variables: + # - Use above cl.exe (ccache.exe) as a compiler + # - Enable parallel compilation + list(APPEND CMAKE_VS_GLOBALS + "CLToolExe=cl.exe" + "CLToolPath=${CMAKE_BINARY_DIR}" + "UseMultiToolTask=true" + "UseStructuredOutput=false" + ) + elseif(CMAKE_GENERATOR MATCHES "Ninja" OR CMAKE_GENERATOR MATCHES "Unix Makefiles") + message(STATUS "Using ccache as compiler launcher for Ninja or Makefiles.") + set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE FILEPATH "CXX compiler cache used" FORCE) + set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE FILEPATH "C compiler cache used" FORCE) + else() + message(WARNING "Unsupported generator for ccache integration: ${CMAKE_GENERATOR}. ccache will not be used.") + endif() +else() + message(WARNING "ccache not found. Not enabling ccache integration.") +endif() \ No newline at end of file diff --git a/ConanProfiles/clang b/ConanProfiles/clang index 7e55968..fb843d8 100644 --- a/ConanProfiles/clang +++ b/ConanProfiles/clang @@ -6,21 +6,21 @@ compiler.version=20 compiler.libcxx=libstdc++11 compiler.cppstd=20 compiler.cstd=17 +compiler.runtime=static 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.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/ccache.cmake + tools.system.package_manager:mode=install tools.system.package_manager:sudo=True + +tools.build:exelinkflags=["-fuse-ld=mold"] +tools.build:sharedlinkflags=["-fuse-ld=mold"] + 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"] +tools.cmake.cmaketoolchain:generator=Ninja [tool_requires] !cmake/*: cmake/[>=4.2] \ No newline at end of file diff --git a/ConanProfiles/clang_coverage b/ConanProfiles/clang_coverage deleted file mode 100644 index 7e108a2..0000000 --- a/ConanProfiles/clang_coverage +++ /dev/null @@ -1,25 +0,0 @@ -[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 deleted file mode 100644 index 5314e13..0000000 --- a/ConanProfiles/clangd +++ /dev/null @@ -1,23 +0,0 @@ -[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 index ba0a8c6..049a6b8 100644 --- a/ConanProfiles/msvc +++ b/ConanProfiles/msvc @@ -5,18 +5,14 @@ compiler=msvc compiler.version=195 compiler.cppstd=20 compiler.cstd=17 -compiler.runtime=dynamic +compiler.runtime=static 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.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/Toolchains/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"] +tools.build:cflags=["/Zc:preprocessor", "/Zc:__STDC__", "/D_CRT_DECLARE_NONSTDC_NAMES=1"] +tools.build:cxxflags=["/Zc:preprocessor", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope"] [tool_requires] !cmake/*: cmake/[>=4.2] \ No newline at end of file diff --git a/ConanProfiles/msvc_ccache.cmake b/ConanProfiles/msvc_ccache.cmake deleted file mode 100644 index 2818eec..0000000 --- a/ConanProfiles/msvc_ccache.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# 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 deleted file mode 100644 index 1caf4c6..0000000 --- a/ConanProfiles/msvcd +++ /dev/null @@ -1,19 +0,0 @@ -[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