diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index f531cd2..3049ff1 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: matrix: build_type: ["Debug", "RelWithDebInfo", "Release"] unity_build: ["ON", "OFF"] - conan_profile: ["./ConanProfiles/clang", "./ConanProfiles/clangd", "./ConanProfiles/clangd_asan"] + conan_profile: ["./ConanProfiles/clang", "./ConanProfiles/clangd_asan"] name: "Build & Test ${{ matrix.build_type }} with ${{ matrix.conan_profile }} (Unity Build: ${{ matrix.unity_build }})" steps: - name: Install Node.js diff --git a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetContainer.hpp b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetContainer.hpp index 8a7d6ba..70c5930 100644 --- a/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetContainer.hpp +++ b/Bigfoot/Sources/Engine/Include/Engine/BigFile/Asset/AssetContainer.hpp @@ -40,6 +40,7 @@ class AssetContainer { if (!m_assets.contains(p_uuid)) { + [[maybe_unused]] const bool added = Add(p_uuid); ASSERT(EngineAssertHandler, added, "{} not added to AssetContainer! Already in container ?", p_uuid); } diff --git a/Bigfoot/Tests/Engine/BigFile/BigFile.cpp b/Bigfoot/Tests/Engine/BigFile/BigFile.cpp index fb83ad0..aa29a98 100644 --- a/Bigfoot/Tests/Engine/BigFile/BigFile.cpp +++ b/Bigfoot/Tests/Engine/BigFile/BigFile.cpp @@ -39,7 +39,7 @@ class BigFileFixture: public ::testing::Test deleteDependencies.Execute(); m_bigFile.CommitTransaction(); - std::ignore = Singleton::Instance().RegisterLogger(ENGINE_LOGGER); + BIGFOOT_NOT_OPTIMIZED_ONLY(std::ignore = Singleton::Instance().RegisterLogger(ENGINE_LOGGER);) } AssetAContainer m_assetAContainer; diff --git a/CMake/CustomTargets.cmake b/CMake/CustomTargets.cmake index 2a7ff07..5008561 100644 --- a/CMake/CustomTargets.cmake +++ b/CMake/CustomTargets.cmake @@ -1,16 +1,3 @@ -foreach(CONFIG DEBUG RELWITHDEBINFO) - if("${CMAKE_EXE_LINKER_FLAGS_${CONFIG}}" MATCHES "/INCREMENTAL:NO") - string(REGEX REPLACE "/INCREMENTAL([^:]|$)" "" - CMAKE_EXE_LINKER_FLAGS_${CONFIG} - "${CMAKE_EXE_LINKER_FLAGS_${CONFIG}}") - endif() - if("${CMAKE_SHARED_LINKER_FLAGS_${CONFIG}}" MATCHES "/INCREMENTAL:NO") - string(REGEX REPLACE "/INCREMENTAL([^:]|$)" "" - CMAKE_SHARED_LINKER_FLAGS_${CONFIG} - "${CMAKE_SHARED_LINKER_FLAGS_${CONFIG}}") - endif() -endforeach() - add_library(BigfootCompileAndLinkFlags INTERFACE) target_compile_options(BigfootCompileAndLinkFlags INTERFACE diff --git a/CMake/Package.cmake b/CMake/Package.cmake index 6386544..39c43d7 100644 --- a/CMake/Package.cmake +++ b/CMake/Package.cmake @@ -106,9 +106,13 @@ function(bigfoot_create_package_tests ParentFolder BigfootDependencies) source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX Src/ FILES ${_SOURCES} ${_HEADERS} ${_OTHERS}) - set_target_properties(${PROJECT_NAME} PROPERTIES FOLDER Tests/Bigfoot/${ParentFolder}) + set_target_properties(${PROJECT_NAME} PROPERTIES + FOLDER Tests/Bigfoot/${ParentFolder} + VS_DEBUGGER_WORKING_DIRECTORY "$") - set_target_properties(${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$") + if(IPO_SUPPORTED) + set_target_properties(${PROJECT_NAME} PROPERTIES INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) + endif() ##################COPY FIXTURE FOLDER################### diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a6541b..a23298e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ option(VULKAN ON) set(AUTO_GENERATED_COMMENT "// AUTO-GENERATED DO NOT TOUCH") +include(CheckIPOSupported) include(${CMAKE_SOURCE_DIR}/CMake/CustomTargets.cmake) include(${CMAKE_SOURCE_DIR}/CMake/FindDependencies.cmake) include(${CMAKE_SOURCE_DIR}/CMake/Utils.cmake) @@ -41,6 +42,13 @@ SET(CMAKE_SKIP_BUILD_RPATH FALSE) SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) SET(CMAKE_INSTALL_RPATH "\${ORIGIN}") +check_ipo_supported(RESULT IPO_SUPPORTED OUTPUT error) +if(IPO_SUPPORTED) + message("IPO / LTO enabled") +else() + message("IPO / LTO not supported: <${error}>") +endif() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bigfoot/Sources) if(${BUILD_TESTS}) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/Bigfoot/Tests) diff --git a/ConanProfiles/clang b/ConanProfiles/clang index c9b5c00..dde2d34 100644 --- a/ConanProfiles/clang +++ b/ConanProfiles/clang @@ -12,8 +12,6 @@ build_type=Release [conf] tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'} -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/ipo.cmake - tools.system.package_manager:mode=install tools.system.package_manager:sudo=True diff --git a/ConanProfiles/clangd_asan b/ConanProfiles/clang_asan similarity index 100% rename from ConanProfiles/clangd_asan rename to ConanProfiles/clang_asan diff --git a/ConanProfiles/clangd b/ConanProfiles/clangd deleted file mode 100644 index 4cfac64..0000000 --- a/ConanProfiles/clangd +++ /dev/null @@ -1,29 +0,0 @@ -[settings] -os=Linux -arch=x86_64 -compiler=clang -compiler.version=20 -compiler.libcxx=libstdc++11 -compiler.cppstd=20 -compiler.cstd=17 -compiler.runtime=static -build_type=Debug - -[conf] -tools.cmake.cmaketoolchain:extra_variables={'CMAKE_CXX_COMPILER_LAUNCHER': 'ccache', 'CMAKE_C_COMPILER_LAUNCHER': 'ccache'} - -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.cmake.cmaketoolchain:generator=Ninja - -tools.build:compiler_executables={"c": "clang", "cpp": "clang++"} - -[tool_requires] -!cmake/*: cmake/[>=4.2] - -[options] -Bigfoot/*:build_tests=True \ No newline at end of file diff --git a/ConanProfiles/ipo.cmake b/ConanProfiles/ipo.cmake deleted file mode 100644 index 33c2ac8..0000000 --- a/ConanProfiles/ipo.cmake +++ /dev/null @@ -1 +0,0 @@ -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) \ No newline at end of file diff --git a/ConanProfiles/msvc b/ConanProfiles/msvc index 3d4c4d0..af1c7c3 100644 --- a/ConanProfiles/msvc +++ b/ConanProfiles/msvc @@ -10,7 +10,6 @@ build_type=Release [conf] tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/ipo.cmake 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", "/Zc:throwingNew"] diff --git a/ConanProfiles/msvcd b/ConanProfiles/msvc_asan similarity index 96% rename from ConanProfiles/msvcd rename to ConanProfiles/msvc_asan index 2361b6e..3a59065 100644 --- a/ConanProfiles/msvcd +++ b/ConanProfiles/msvc_asan @@ -13,8 +13,10 @@ 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", "/permissive-", "/Zc:__cplusplus", "/Zc:enumTypes", "/Zc:templateScope", "/Zc:throwingNew"] + [tool_requires] !cmake/*: cmake/[>=4.2] [options] +Bigfoot/*:asan=True Bigfoot/*:build_tests=True diff --git a/ConanProfiles/msvcd_asan b/ConanProfiles/msvcd_asan deleted file mode 100644 index eb4d255..0000000 --- a/ConanProfiles/msvcd_asan +++ /dev/null @@ -1,26 +0,0 @@ -[settings] -os=Windows -arch=x86_64 -compiler=msvc -compiler.version=195 -compiler.cppstd=20 -compiler.cstd=17 -compiler.runtime=static -build_type=Debug - -[conf] -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/msvc_ccache.cmake -tools.cmake.cmaketoolchain:user_toolchain+={{profile_dir}}/ipo.cmake - -tools.build:exelinkflags=["/INCREMENTAL:NO"] -tools.build:sharedlinkflags=["/INCREMENTAL:NO"] - -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", "/Zc:throwingNew"] - -[tool_requires] -!cmake/*: cmake/[>=4.2] - -[options] -Bigfoot/*:asan=True -Bigfoot/*:build_tests=True diff --git a/generate_dependencies.bat b/generate_dependencies.bat index b427673..de6495c 100644 --- a/generate_dependencies.bat +++ b/generate_dependencies.bat @@ -24,7 +24,7 @@ conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/ap REM Install dependencies with the specified build option conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvc -pr:b=./ConanProfiles/msvc %build_option% -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True -conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvcd -pr:b=./ConanProfiles/msvcd %build_option% -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True +conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvc -pr:b=./ConanProfiles/msvc %build_option% -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True +conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/msvc -pr:b=./ConanProfiles/msvc %build_option% -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True endlocal diff --git a/generate_dependencies.sh b/generate_dependencies.sh index 6ece276..61c70d0 100644 --- a/generate_dependencies.sh +++ b/generate_dependencies.sh @@ -12,12 +12,12 @@ conan remote add bigfootpackages https://conan.romainboullard.com/artifactory/ap # Set the build option based on the argument if [ "$1" == "force" ]; then conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build='*' -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True - conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True - conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build='*' -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True + conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build='*' -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True + conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build='*' -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True elif [ "$1" == "missing" ]; then conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -of build -s build_type=Release -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True - conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True - conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clangd -pr:b=./ConanProfiles/clangd --build=missing -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True + conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -of build -s build_type=RelWithDebInfo -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True + conan install . --remote=bigfootpackages -pr:h=./ConanProfiles/clang -pr:b=./ConanProfiles/clang --build=missing -of build -s build_type=Debug -o bigfoot/*:build_tests=True -o bigfoot/*:tracy=True -o bigfoot/*:build_tools=True -o bigfoot/*:vulkan=True else echo "Invalid argument: $1" echo "Usage: $0 [force|missing]"