diff --git a/setup.py b/setup.py index d5978a66a..e822272cd 100644 --- a/setup.py +++ b/setup.py @@ -57,6 +57,7 @@ and won't find them. So we need to take away the path with from distutils.core import setup, Extension, Distribution import glob import os +import platform import sysconfig # ---------------------------------------------------------------------------------------- @@ -106,7 +107,9 @@ class Config(object): """ Gets additional compiler arguments """ - if os.name == "nt": + if platform.system() == "Windows": + return [ ] + elif platform.system() == "Darwin": return [ ] else: # Avoids many "type-punned pointer" warnings @@ -116,8 +119,15 @@ class Config(object): """ Gets additional linker arguments """ - if os.name == "nt": + if platform.system() == "Windows": return [ ] + elif platform.system() == "Darwin": + # For the dependency modules, make sure we produce a dylib. + # We can only link against such, but the bundles produced otherwise. + if mod[0:1] == "_": + return [ "-Wl,-dylib" ] + else: + return [] else: # this makes the libraries suitable for linking with a path - # i.e. from path_of('_tl'). Without this option, the path diff --git a/src/tl/tl/tlFileUtils.cc b/src/tl/tl/tlFileUtils.cc index ed23f366b..ebeacbd0b 100644 --- a/src/tl/tl/tlFileUtils.cc +++ b/src/tl/tl/tlFileUtils.cc @@ -34,6 +34,8 @@ #if defined(_WIN32) # include # include +#elif defined(__APPLE__) +# include #endif namespace tl diff --git a/src/tl/tl/tlThreads.cc b/src/tl/tl/tlThreads.cc index 7db74573c..4dc6ed49e 100644 --- a/src/tl/tl/tlThreads.cc +++ b/src/tl/tl/tlThreads.cc @@ -30,6 +30,7 @@ #include #include #include +#include #if defined(_WIN32) # include #endif @@ -278,7 +279,7 @@ bool Thread::wait (unsigned long time) end_time.tv_sec += 1; } -#if defined(_WIN32) +#if defined(_WIN32) || defined(__APPLE__) // wait if the thread terminated or the timeout has expired while (isRunning ()) { @@ -289,7 +290,11 @@ bool Thread::wait (unsigned long time) return false; } +#if defined(__WIN32) Sleep (1); +#else + usleep (1000); +#endif }