From 95cd2e17ab346b9aec0e40383b4effde23652c47 Mon Sep 17 00:00:00 2001 From: John Galt Date: Thu, 9 Jul 2020 11:25:10 -0400 Subject: cmake: fix fmt linking when found This is a new attempt at #4206 that shouldn't break windows builds. If someone else could test on windows, it would be much appreciated. Previously, the build bot passed but the actual builds failed. --- src/common/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index d120c8d3d..423bef0f5 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -191,5 +191,9 @@ endif() create_target_directory_groups(common) find_package(Boost 1.71 COMPONENTS context headers REQUIRED) -target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile) +if (fmt_FOUND) + target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt microprofile) +else() + target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile) +endif() target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd xbyak) -- cgit v1.2.3 From bd2feb68739b47bab7af929f9e9dd1d5ebcaec37 Mon Sep 17 00:00:00 2001 From: David Marcec Date: Fri, 10 Jul 2020 14:04:06 +1000 Subject: cmake: Fix libfmt linking errors --- src/common/CMakeLists.txt | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/common') diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 423bef0f5..d120c8d3d 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -191,9 +191,5 @@ endif() create_target_directory_groups(common) find_package(Boost 1.71 COMPONENTS context headers REQUIRED) -if (fmt_FOUND) - target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt microprofile) -else() - target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile) -endif() +target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile) target_link_libraries(common PRIVATE lz4::lz4 zstd::zstd xbyak) -- cgit v1.2.3 From a4306b9e5662fca74f65f0b657e7002fda7f1829 Mon Sep 17 00:00:00 2001 From: Marshall Mohror Date: Tue, 7 Jul 2020 16:39:23 -0500 Subject: Common: remove a mod from AlignUp (#5441) In cases where the size is not a known constant when inlining, AlignUp currently generates two 64-bit div instructions. This generates one div and a cmov which is significantly cheaper. --- src/common/alignment.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/alignment.h b/src/common/alignment.h index f8c49e079..516bb26c1 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -11,7 +11,9 @@ namespace Common { template constexpr T AlignUp(T value, std::size_t size) { static_assert(std::is_unsigned_v, "T must be an unsigned value."); - return static_cast(value + (size - value % size) % size); + auto mod{value % size}; + value -= mod; + return static_cast(mod == T{0} ? value : value + size); } template -- cgit v1.2.3 From 1074c87f18881ba8e6c20c1cee10ec3cbba71adb Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 11 Jul 2020 19:28:09 -0400 Subject: Revert "Port citra-emu/citra#5441: "Common: remove a mod from AlignUp"" --- src/common/alignment.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/common') diff --git a/src/common/alignment.h b/src/common/alignment.h index 516bb26c1..f8c49e079 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -11,9 +11,7 @@ namespace Common { template constexpr T AlignUp(T value, std::size_t size) { static_assert(std::is_unsigned_v, "T must be an unsigned value."); - auto mod{value % size}; - value -= mod; - return static_cast(mod == T{0} ? value : value + size); + return static_cast(value + (size - value % size) % size); } template -- cgit v1.2.3 From 80a0f2a118b858b3ceb4ae0ae09d72353d58c928 Mon Sep 17 00:00:00 2001 From: Tobias Date: Sun, 12 Jul 2020 16:45:49 +0200 Subject: common/alignment: Fix compilation errors (#4303) --- src/common/alignment.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/common') diff --git a/src/common/alignment.h b/src/common/alignment.h index f8c49e079..b37044bb6 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -11,7 +11,9 @@ namespace Common { template constexpr T AlignUp(T value, std::size_t size) { static_assert(std::is_unsigned_v, "T must be an unsigned value."); - return static_cast(value + (size - value % size) % size); + auto mod{static_cast(value % size)}; + value -= mod; + return static_cast(mod == T{0} ? value : value + size); } template -- cgit v1.2.3