This is an automated email from the ASF dual-hosted git repository. jdanek pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
commit 3db622312ecaf6b872af01c258f4687fdb5d9720 Author: Jiri Danek <[email protected]> AuthorDate: Sun Mar 10 13:06:23 2019 -0700 DISPATCH-1282 - Support for building on macOS # Notes * macOS does not use -rt linker option * pthread_t on macOS is a typedef’d struct, not long * dlopen on macOS substitutes rpath for @rpath placeholder, it does not prepend it as on Linux Dispatch can be compiled and run on my macOS like this $ cmake .. -DProton_DIR=/Users/jdanek/projects/qpid-proton/build/install/lib/cmake/Proton -DCMAKE_INSTALL_PREFIX=install $ make install $ PYTHONPATH=install/lib/python2.7/site-packages/ install/sbin/qdrouterd --- CMakeLists.txt | 9 +++++++-- include/qpid/dispatch/threading.h | 3 --- src/config.h.in | 2 +- src/posix/threading.c | 4 ---- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8833ea..163bfcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ project(qpid-dispatch C) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") set(CMAKE_THREAD_PREFER_PTHREAD TRUE) +set(CMAKE_MACOSX_RPATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) # Set default build type. Must use FORCE because project() sets default to "" @@ -46,7 +47,11 @@ include(CheckIncludeFiles) ## ## Find dependencies ## -find_library(rt_lib rt) +if (NOT APPLE) + find_library(rt_lib rt) +else (NOT APPLE) + set(rt "") +endif (NOT APPLE) find_package(PythonInterp REQUIRED) find_package(PythonLibs REQUIRED) @@ -186,7 +191,7 @@ if (CMAKE_C_COMPILER_ID MATCHES "Clang") add_compile_options(-Wno-gnu-statement-expression) endif() -if (NOT (USE_SANITIZERS OR USE_TSAN)) +if (NOT (APPLE OR USE_SANITIZERS OR USE_TSAN)) set(CATCH_UNDEFINED "-Wl,-z,defs") endif () diff --git a/include/qpid/dispatch/threading.h b/include/qpid/dispatch/threading.h index 9ffa841..b883bab 100644 --- a/include/qpid/dispatch/threading.h +++ b/include/qpid/dispatch/threading.h @@ -58,7 +58,4 @@ void sys_thread_join(sys_thread_t *thread); /** Return the OS identifier for this thread */ long sys_thread_id(sys_thread_t *thread); -/** Return the OS identifier for the current thread */ -long sys_thread_self(); - #endif diff --git a/src/config.h.in b/src/config.h.in index fb4ade9..7947506 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -18,6 +18,6 @@ */ #define QPID_DISPATCH_VERSION "${QPID_DISPATCH_VERSION}" -#define QPID_DISPATCH_LIB "$<TARGET_FILE_NAME:qpid-dispatch>" +#define QPID_DISPATCH_LIB "$<$<BOOL:${APPLE}>:@rpath/>$<TARGET_FILE_NAME:qpid-dispatch>" #define QPID_CONSOLE_STAND_ALONE_INSTALL_DIR "${CONSOLE_STAND_ALONE_INSTALL_DIR}" #cmakedefine01 QD_MEMORY_STATS diff --git a/src/posix/threading.c b/src/posix/threading.c index 85916ca..5d7969b 100644 --- a/src/posix/threading.c +++ b/src/posix/threading.c @@ -163,10 +163,6 @@ long sys_thread_id(sys_thread_t *thread) { return (long) thread->thread; } -long sys_thread_self() { - return pthread_self(); -} - void sys_thread_free(sys_thread_t *thread) { free(thread); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
