Skip to content

Commit d623015

Browse files
[Refactor] Make types_core_test work on MacOS (StarRocks#70288)
Signed-off-by: alvin-celerdata <alvin.zhao@celerdata.com>
1 parent 0a6a025 commit d623015

32 files changed

+94
-33
lines changed

be/cmake_modules/ThirdParty.cmake

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,23 @@ set_target_properties(benchmark_main PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_D
282282

283283
if (ENABLE_MULTI_DYNAMIC_LIBS)
284284
add_library(fmt SHARED IMPORTED)
285-
set_target_properties(fmt PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib64/libfmt.so.8)
286-
file(GLOB FMT_SO_FILES "${THIRDPARTY_DIR}/lib64/libfmt.so*")
287-
install(FILES ${FMT_SO_FILES} DESTINATION ${OUTPUT_DIR}/lib)
285+
if (APPLE)
286+
if (EXISTS "${THIRDPARTY_DIR}/lib64/libfmt.dylib" OR EXISTS "${THIRDPARTY_DIR}/lib64/libfmt.12.dylib")
287+
set(FMT_SHARED_DIR "${THIRDPARTY_DIR}/lib64")
288+
else()
289+
set(FMT_SHARED_DIR "${THIRDPARTY_DIR}/lib")
290+
endif()
291+
find_library(FMT_SHARED_LIBRARY NAMES fmt PATHS ${FMT_SHARED_DIR} NO_DEFAULT_PATH)
292+
if (NOT FMT_SHARED_LIBRARY)
293+
message(FATAL_ERROR "fmt shared library not found under ${FMT_SHARED_DIR}")
294+
endif()
295+
set_target_properties(fmt PROPERTIES IMPORTED_LOCATION ${FMT_SHARED_LIBRARY})
296+
file(GLOB FMT_SHARED_FILES "${FMT_SHARED_DIR}/libfmt*.dylib")
297+
else()
298+
set_target_properties(fmt PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib64/libfmt.so.8)
299+
file(GLOB FMT_SHARED_FILES "${THIRDPARTY_DIR}/lib64/libfmt.so*")
300+
endif()
301+
install(FILES ${FMT_SHARED_FILES} DESTINATION ${OUTPUT_DIR}/lib)
288302
else()
289303
add_library(fmt STATIC IMPORTED)
290304
set_target_properties(fmt PROPERTIES IMPORTED_LOCATION ${THIRDPARTY_DIR}/lib64/libfmt.a)

be/src/base/crypto/sha.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include <iomanip>
1818
#include <iostream>
19+
#include <sstream>
1920
#include <string>
2021

2122
namespace starrocks {

be/src/base/status.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#pragma once
66

77
#include <cstdint>
8+
#include <ostream>
9+
#include <sstream>
810
#include <string>
911
#include <string_view>
1012

be/src/base/statusor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <exception>
3939
#include <initializer_list>
4040
#include <new>
41+
#include <ostream>
4142
#include <string>
4243
#include <type_traits>
4344
#include <utility>

be/src/base/string/string_parser.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ inline T StringParser::string_to_decimal(const char* s, int len, int type_precis
770770
if (LIKELY(divisor >= 0)) {
771771
T remainder = value % divisor;
772772
value /= divisor;
773-
if (std::abs(remainder) >= (divisor >> 1)) {
773+
if (remainder >= (divisor >> 1)) {
774774
value += 1;
775775
}
776776
} else {

be/src/base/time/date_func.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "base/time/date_func.h"
1919

2020
#include <iomanip>
21+
#include <sstream>
2122

2223
namespace starrocks {
2324

be/src/base/types/int128.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ namespace starrocks {
2626
using int128_t = __int128;
2727
using uint128_t = unsigned __int128;
2828

29+
inline constexpr uint128_t abs_as_uint128(int128_t value) {
30+
uint128_t abs_value = static_cast<uint128_t>(value);
31+
if (value < 0) {
32+
abs_value = ~abs_value + 1;
33+
}
34+
return abs_value;
35+
}
36+
37+
inline constexpr int128_t abs(int128_t value) {
38+
return static_cast<int128_t>(abs_as_uint128(value));
39+
}
40+
2941
inline std::string int128_to_string(__int128 value) {
3042
return integer_to_string<__int128>(value);
3143
}

be/src/base/types/int256.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <fmt/format.h>
1818

1919
#include <cmath>
20+
#include <ostream>
2021
#include <string>
2122
#include <type_traits>
2223

be/src/column/binary_column.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#pragma once
1616

1717
#include <memory>
18+
#include <sstream>
1819
#include <type_traits>
1920

2021
#include "base/string/slice.h"

be/src/column/column_access_path.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#pragma once
1616

1717
#include <memory>
18+
#include <ostream>
1819
#include <string>
1920
#include <vector>
2021

0 commit comments

Comments
 (0)