From 17936e0b03b807a349ab86ffed10222c17aa30df Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 31 Jan 2012 03:04:47 +0000 Subject: Fix ZixSem compilation on Mac OS X. git-svn-id: http://svn.drobilla.net/zix/trunk@47 df6676b4-ccc9-40e5-b5d6-7c4628a128e3 --- wscript | 8 ++++++++ zix/sem.h | 7 ++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wscript b/wscript index 3c9183c..2668841 100644 --- a/wscript +++ b/wscript @@ -79,6 +79,10 @@ def build(bld): # Pkgconfig file autowaf.build_pc(bld, 'ZIX', ZIX_VERSION, []) + framework = '' + if Options.platform == 'darwin': + framework = ['CoreServices'] + lib_source = ''' src/fat_patree.c src/hash.c @@ -98,6 +102,7 @@ def build(bld): obj.target = 'zix' obj.vnum = ZIX_LIB_VERSION obj.install_path = '${LIBDIR}' + obj.framework = framework obj.cflags = [ '-fvisibility=hidden', '-DZIX_SHARED', '-DZIX_INTERNAL' ] if bld.env['BUILD_TESTS']: @@ -108,6 +113,7 @@ def build(bld): obj.name = 'libzix_static' obj.target = 'zix_static' obj.install_path = '' + obj.framework = framework obj.cflags = ['-fprofile-arcs', '-ftest-coverage' ] # Unit test programs @@ -119,6 +125,7 @@ def build(bld): obj.linkflags = ['-lgcov', '-lpthread'] obj.target = 'test/%s' % i obj.install_path = '' + obj.framework = framework obj.cflags = ['-fprofile-arcs', '-ftest-coverage' ] if bld.env['BUILD_BENCH']: @@ -131,6 +138,7 @@ def build(bld): obj.uselib = 'GLIB' obj.linkflags = '-lrt' obj.target = 'test/%s' % i + obj.framework = framework obj.install_path = '' # Documentation diff --git a/zix/sem.h b/zix/sem.h index 6b66a51..0830c53 100644 --- a/zix/sem.h +++ b/zix/sem.h @@ -101,19 +101,20 @@ struct ZixSemImpl { static inline ZixStatus zix_sem_init(ZixSem* sem, unsigned initial) { - MPCreateSemaphore(UINT_MAX, initial, &_sem); + return MPCreateSemaphore(UINT_MAX, initial, &sem->sem) + ? ZIX_STATUS_SUCCESS : ZIX_STATUS_ERROR; } static inline void zix_sem_destroy(ZixSem* sem) { - MPDeleteSemaphore(_sem); + MPDeleteSemaphore(sem->sem); } static inline void zix_sem_post(ZixSem* sem) { - MPSignalSemaphore(_sem); + MPSignalSemaphore(sem->sem); } static inline void -- cgit v1.2.1