diff options
| author | Ray <[email protected]> | 2017-11-22 23:16:52 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-11-22 23:16:52 +0100 |
| commit | 96e0f0e35ed96b7345acf6f3329b67518c11d946 (patch) | |
| tree | 1d8b7e639a550c8006f2e7987c2d8f1e4eac83cb /src | |
| parent | f70a0a996cc7a9a3cd1f5e3c7e3466b1d2528fd3 (diff) | |
| parent | b2acff66dec7bce30e9704aa9b13070f7c3ffac1 (diff) | |
| download | raylib-96e0f0e35ed96b7345acf6f3329b67518c11d946.tar.gz raylib-96e0f0e35ed96b7345acf6f3329b67518c11d946.zip | |
Merge pull request #392 from a3f/develop
Fix macOS build of new rglfw.c approach
Diffstat (limited to 'src')
| -rw-r--r-- | src/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/core.c | 9 | ||||
| -rw-r--r-- | src/gestures.h | 11 | ||||
| -rw-r--r-- | src/physac.h | 28 | ||||
| -rw-r--r-- | src/rglfw.c | 2 |
5 files changed, 32 insertions, 24 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a398d665..f362b52f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,6 +20,7 @@ set(OPENGL_VERSION "3.3" CACHE STRING "OpenGL Version to build raylib with") set_property(CACHE OPENGL_VERSION PROPERTY STRINGS "3.3" "2.1" "1.1" "ES 2.0") ### Config options ### +include_directories(external/glfw/include) # Translate the config options to what raylib wants if(${PLATFORM} MATCHES "Desktop") @@ -40,6 +41,8 @@ if(${PLATFORM} MATCHES "Desktop") # See: https://github.com/raysan5/raylib/issues/341 if(APPLE) set(GRAPHICS "GRAPHICS_API_OPENGL_33") + set_source_files_properties(rglfw.c PROPERTIES COMPILE_FLAGS "-x objective-c") + link_libraries("-framework CoreFoundation -framework Cocoa -framework IOKit -framework CoreVideo") endif() elseif(${PLATFORM} MATCHES "Web") set(PLATFORM "PLATFORM_WEB") @@ -93,9 +96,6 @@ if(${PLATFORM} MATCHES "PLATFORM_DESKTOP") target_link_libraries(${RAYLIB} GL) endif() - # Add in GLFW as a linking target - target_link_libraries(${RAYLIB} glfw) - # Library file & Header set_target_properties(${RAYLIB} PROPERTIES PUBLIC_HEADER "raylib.h") install( @@ -88,6 +88,11 @@ #include "raylib.h" +#if (defined(__linux__) || defined(PLATFORM_WEB)) && _POSIX_S_SOURCE < 199309L + #undef _POSIX_C_SOURCE + #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext. +#endif + #include "rlgl.h" // raylib OpenGL abstraction layer to OpenGL 1.1, 3.3+ or ES2 #include "utils.h" // Required for: fopen() Android mapping @@ -110,10 +115,6 @@ #include "external/rgif.h" // Support GIF recording #endif -#if defined(__linux__) || defined(PLATFORM_WEB) - #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext. -#endif - #include <stdio.h> // Standard input / output lib #include <stdlib.h> // Required for: malloc(), free(), rand(), atexit() #include <stdint.h> // Required for: typedef unsigned long long int uint64_t, used by hi-res timer diff --git a/src/gestures.h b/src/gestures.h index f4d38dfb..e2f004e2 100644 --- a/src/gestures.h +++ b/src/gestures.h @@ -140,17 +140,20 @@ float GetGesturePinchAngle(void); // Get gesture pinch ang #if defined(GESTURES_IMPLEMENTATION) -#include <math.h> // Required for: atan2(), sqrt() -#include <stdint.h> // Required for: uint64_t - #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__) - #define _POSIX_C_SOURCE 199309L // Required for CLOCK_MONOTONIC if compiled with c99 without gnu ext. + #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 #include <sys/time.h> // Required for: timespec #include <time.h> // Required for: clock_gettime() + + #include <math.h> // Required for: atan2(), sqrt() + #include <stdint.h> // Required for: uint64_t #endif //---------------------------------------------------------------------------------- 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 //---------------------------------------------------------------------------------- diff --git a/src/rglfw.c b/src/rglfw.c index b1b4eed7..83e0021b 100644 --- a/src/rglfw.c +++ b/src/rglfw.c @@ -86,5 +86,5 @@ #include "external/glfw/src/posix_thread.c" #include "external/glfw/src/nsgl_context.m" #include "external/glfw/src/egl_context.c" - #include "external/glfw/src/osmesa_context.c.m" + #include "external/glfw/src/osmesa_context.c" #endif |
