aboutsummaryrefslogtreecommitdiff
path: root/src/physac.h
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2017-11-22 22:47:57 +0100
committerAhmad Fatoum <ahmad@a3f.at>2017-11-22 22:58:18 +0100
commit899e1fbd94f697d95b9684e272de5410b08edc06 (patch)
tree4f9847a7bfe715ddcc49eb4a25dc0fea177dcb28 /src/physac.h
parentf70a0a996cc7a9a3cd1f5e3c7e3466b1d2528fd3 (diff)
downloadraylib-899e1fbd94f697d95b9684e272de5410b08edc06.tar.gz
raylib-899e1fbd94f697d95b9684e272de5410b08edc06.zip
Avoid duplicate definition of feature macro
Feature macros need to be defined before #including any headers, preferably through the build system, but this is good enough. Fixes a compile error on my fork's Travis CI.
Diffstat (limited to 'src/physac.h')
-rw-r--r--src/physac.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/physac.h b/src/physac.h
index 5ecd2815..ef78aab8 100644
--- a/src/physac.h
+++ b/src/physac.h
@@ -235,6 +235,22 @@ PHYSACDEF void ClosePhysics(void);
#if defined(PHYSAC_IMPLEMENTATION)
+#if defined(_WIN32)
+ // Functions required to query time on Windows
+ int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
+ int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
+#elif (defined(__linux__) || defined(__APPLE__) || defined(PLATFORM_WEB))
+ #if _POSIX_C_SOURCE < 199309L
+ #undef _POSIX_C_SOURCE
+ #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext.
+ #endif
+ //#define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance
+ #include <sys/time.h> // Required for: timespec
+ #include <time.h> // Required for: clock_gettime()
+ #include <stdint.h>
+#endif
+
+
#if !defined(PHYSAC_NO_THREADS)
#include <pthread.h> // Required for: pthread_t, pthread_create()
#endif
@@ -248,18 +264,6 @@ PHYSACDEF void ClosePhysics(void);
#include "raymath.h" // Required for: Vector2Add(), Vector2Subtract()
-#if defined(_WIN32)
- // Functions required to query time on Windows
- int __stdcall QueryPerformanceCounter(unsigned long long int *lpPerformanceCount);
- int __stdcall QueryPerformanceFrequency(unsigned long long int *lpFrequency);
-#elif defined(__linux__) || defined(__APPLE__) || defined(PLATFORM_WEB)
- #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext.
- //#define _DEFAULT_SOURCE // Enables BSD function definitions and C99 POSIX compliance
- #include <sys/time.h> // Required for: timespec
- #include <time.h> // Required for: clock_gettime()
- #include <stdint.h>
-#endif
-
//----------------------------------------------------------------------------------
// Defines and Macros
//----------------------------------------------------------------------------------