File tree Expand file tree Collapse file tree 7 files changed +48
-6
lines changed
test/unified_malloc_framework/common Expand file tree Collapse file tree 7 files changed +48
-6
lines changed Original file line number Diff line number Diff line change @@ -125,3 +125,33 @@ jobs:
125
125
- name : Test
126
126
working-directory : ${{github.workspace}}/build
127
127
run : ctest -C ${{matrix.build_type}} --output-on-failure -L "python|umf|loader|validation|tracing|unit|urtrace"
128
+
129
+
130
+ macos-build :
131
+ name : Build - MacOS
132
+ strategy :
133
+ matrix :
134
+ os : ['macos-12', 'macos-13']
135
+ runs-on : ${{matrix.os}}
136
+
137
+ steps :
138
+ - uses : actions/checkout@v3
139
+
140
+ - uses : actions/setup-python@v4
141
+ with :
142
+ python-version : 3.9
143
+
144
+ - name : Install prerequisites
145
+ run : python3 -m pip install -r third_party/requirements.txt
146
+
147
+ - name : Configure CMake
148
+ run : >
149
+ cmake
150
+ -B${{github.workspace}}/build
151
+ -DUR_ENABLE_TRACING=ON
152
+ -DUR_DEVELOPER_MODE=ON
153
+ -DCMAKE_BUILD_TYPE=Release
154
+ -DUR_BUILD_TESTS=ON
155
+ -DUR_FORMAT_CPP_STYLE=ON
156
+ - name : Build
157
+ run : cmake --build ${{github.workspace}}/build -j $(nproc)
Original file line number Diff line number Diff line change @@ -14,6 +14,10 @@ include(CTest)
14
14
list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR} /cmake" )
15
15
include (helpers )
16
16
17
+ if (CMAKE_SYSTEM_NAME STREQUAL Darwin )
18
+ set (CMAKE_FIND_FRAMEWORK NEVER )
19
+ endif ()
20
+
17
21
find_package (Python3 COMPONENTS Interpreter )
18
22
19
23
set (CMAKE_CXX_STANDARD 17 )
@@ -52,7 +56,7 @@ endif()
52
56
if (NOT MSVC )
53
57
add_compile_options (-fPIC -Wall -Wpedantic
54
58
$< $< CXX_COMPILER_ID:GNU> :-fdiagnostics-color=always>
55
- $< $< CXX_COMPILER_ID:Clang> :-fcolor-diagnostics> )
59
+ $< $< CXX_COMPILER_ID:Clang,AppleClang > :-fcolor-diagnostics> )
56
60
if (UR_DEVELOPER_MODE )
57
61
add_compile_options (-Werror -fno-omit-frame-pointer )
58
62
endif ()
Original file line number Diff line number Diff line change @@ -9,10 +9,6 @@ add_executable(${TARGET_NAME}
9
9
${CMAKE_CURRENT_SOURCE_DIR} /hello_world.cpp
10
10
)
11
11
12
- target_include_directories (${TARGET_NAME} PRIVATE
13
- ${CMAKE_SOURCE_DIR} /include
14
- )
15
-
16
12
if (MSVC )
17
13
set_target_properties (${TARGET_NAME}
18
14
PROPERTIES
@@ -24,4 +20,5 @@ endif()
24
20
target_link_libraries (${TARGET_NAME} PRIVATE
25
21
${PROJECT_NAME} ::loader
26
22
${CMAKE_DL_LIBS}
23
+ ${PROJECT_NAME} ::headers
27
24
)
Original file line number Diff line number Diff line change 12
12
#include " logger/ur_logger.hpp"
13
13
#include " ur_lib_loader.hpp"
14
14
15
- #if defined(SANITIZER_ANY)
15
+ #if defined(SANITIZER_ANY) || defined(__APPLE__)
16
16
#define LOAD_DRIVER_LIBRARY (NAME ) dlopen(NAME, RTLD_LAZY | RTLD_LOCAL)
17
17
#else
18
18
#define LOAD_DRIVER_LIBRARY (NAME ) \
Original file line number Diff line number Diff line change 11
11
12
12
#include < atomic>
13
13
#include < memory>
14
+ #include < string>
14
15
15
16
#include " ../umf_helpers.hpp"
16
17
Original file line number Diff line number Diff line change @@ -57,8 +57,12 @@ inline int ur_getpid(void) { return static_cast<int>(getpid()); }
57
57
#define MAKE_LIBRARY_NAME (NAME, VERSION ) NAME " .dll"
58
58
#else
59
59
#define HMODULE void *
60
+ #if defined(__APPLE__)
61
+ #define MAKE_LIBRARY_NAME (NAME, VERSION ) " lib" NAME " ." VERSION " .dylib"
62
+ #else
60
63
#define MAKE_LIBRARY_NAME (NAME, VERSION ) " lib" NAME " .so." VERSION
61
64
#endif
65
+ #endif
62
66
63
67
inline std::string create_library_path (const char *name, const char *path) {
64
68
std::string library_path;
Original file line number Diff line number Diff line change 11
11
#ifndef UMF_TEST_POOL_HPP
12
12
#define UMF_TEST_POOL_HPP 1
13
13
14
+ #if defined(__APPLE__)
15
+ #include < malloc/malloc.h>
16
+ #else
14
17
#include < malloc.h>
18
+ #endif
15
19
#include < umf/base.h>
16
20
#include < umf/memory_provider.h>
17
21
@@ -61,6 +65,8 @@ struct malloc_pool : public pool_base {
61
65
size_t malloc_usable_size (void *ptr) noexcept {
62
66
#ifdef _WIN32
63
67
return _msize (ptr);
68
+ #elif __APPLE__
69
+ return ::malloc_size (ptr);
64
70
#else
65
71
return ::malloc_usable_size (ptr);
66
72
#endif
You can’t perform that action at this time.
0 commit comments