Enabled pymod build via setup.py/distutils on MacOS

This commit is contained in:
Matthias Koefferlein 2018-07-15 07:42:01 -07:00
parent fc9783432b
commit d3b4bc7f87
3 changed files with 20 additions and 3 deletions

View File

@ -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

View File

@ -34,6 +34,8 @@
#if defined(_WIN32)
# include <dir.h>
# include <windows.h>
#elif defined(__APPLE__)
# include <libproc.h>
#endif
namespace tl

View File

@ -30,6 +30,7 @@
#include <pthread.h>
#include <time.h>
#include <errno.h>
#include <unistd.h>
#if defined(_WIN32)
# include <windows.h>
#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
}