Skip to content

Commit

Permalink
fix macOS compile issue for timespec_get (#183)
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWitch authored and Akaricchi committed Dec 12, 2019
1 parent 5d41555 commit 030fae8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ config.set('TAISEI_BUILDCONF_LOG_FATAL_MSGBOX', (
host_machine.system() == 'darwin' or
not is_developer_build
))
# fixes some build issues on macOS, see PR #183
config.set('TAISEI_BUILDCONF_DARWIN_SOURCE', (host_machine.system() == 'darwin'))
config.set('TAISEI_BUILDCONF_DEBUG_OPENGL', get_option('debug_opengl'))

install_docs = get_option('docs') and host_machine.system() != 'emscripten'
Expand Down
7 changes: 7 additions & 0 deletions src/util/compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
#define _POSIX_C_SOURCE 200809L
#endif

// When compiling for Apple devices, the _POSIX_C_SOURCE option above messes with what header functions
// are available to the compiler, and it'll complain that things like timespec_get, etc don't exist
// even if Meson can detect them initially. Defining this fixes it.
#ifdef TAISEI_BUILDCONF_DARWIN_SOURCE
#define _DARWIN_C_SOURCE
#endif

// Common standard library headers
#include <complex.h>
#include <ctype.h>
Expand Down

0 comments on commit 030fae8

Please sign in to comment.