changeset 3:490347621f42

attempt to build for OS X
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 15 Oct 2016 14:51:49 +0200
parents 9d25def63301
children 00ff2cd06d13
files Resources/CMake/CairoConfiguration.cmake Resources/CMake/PixmanConfiguration.cmake Resources/CMake/SdlConfiguration.cmake
diffstat 3 files changed, 49 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/CairoConfiguration.cmake	Fri Oct 14 20:41:01 2016 +0200
+++ b/Resources/CMake/CairoConfiguration.cmake	Sat Oct 15 14:51:49 2016 +0200
@@ -189,21 +189,24 @@
 
   set(CAIRO_DEFINITIONS "HAS_PIXMAN_GLYPHS=1")
 
-  if (CMAKE_COMPILER_IS_GNUCXX)
+  if (${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl")
+    # Disable vectorized instructions when targeting archicture-independent PNaCl
     set(CAIRO_DEFINITIONS "${CAIRO_DEFINITIONS};HAVE_STDINT_H=1;CAIRO_HAS_PTHREAD=1;HAVE_UINT64_T=1")
 
-    if (${CMAKE_SYSTEM_NAME} STREQUAL "PNaCl")
-      # Disable vectorized instructions when targeting archicture-independent PNaCl
-    else()
-      set(CAIRO_DEFINITIONS "${CAIRO_DEFINITIONS};CAIRO_HAS_REAL_PTHREAD=1;HAVE_GCC_VECTOR_EXTENSIONS;HAVE_FLOAT128")
+  elseif (CMAKE_COMPILER_IS_GNUCXX OR
+      CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+
+    set(CAIRO_DEFINITIONS "${CAIRO_DEFINITIONS};HAVE_STDINT_H=1;CAIRO_HAS_PTHREAD=1;HAVE_UINT64_T=1;CAIRO_HAS_REAL_PTHREAD=1;HAVE_GCC_VECTOR_EXTENSIONS;HAVE_FLOAT128")
+
+    if (CMAKE_COMPILER_IS_GNUCXX)
+      set_property(
+        SOURCE ${CAIRO_SOURCES}
+        PROPERTY COMPILE_FLAGS "-Wno-attributes"
+        )
     endif()
 
-    set_property(
-      SOURCE ${CAIRO_SOURCES}
-      PROPERTY COMPILE_FLAGS "-Wno-attributes"
-      )
-
   elseif (MSVC)
+    # The cairo source code comes with built-in support for Visual Studio
 
   else()
     message(FATAL_ERROR "Support your platform here")
--- a/Resources/CMake/PixmanConfiguration.cmake	Fri Oct 14 20:41:01 2016 +0200
+++ b/Resources/CMake/PixmanConfiguration.cmake	Sat Oct 15 14:51:49 2016 +0200
@@ -116,7 +116,8 @@
   elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" OR
       CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
       CMAKE_SYSTEM_NAME STREQUAL "NaCl32" OR
-      CMAKE_SYSTEM_NAME STREQUAL "NaCl64")
+      CMAKE_SYSTEM_NAME STREQUAL "NaCl64" OR
+      CMAKE_SYSTEM_NAME STREQUAL "Darwin")
 
     set(PIXMAN_DEFINITIONS "${PIXMAN_DEFINITIONS};TLS=__thread;HAVE_GCC_VECTOR_EXTENSIONS;HAVE_BUILTIN_CLZ;HAVE_MPROTECT=1;HAVE_FLOAT128;HAVE_POSIX_MEMALIGN;USE_GCC_INLINE_ASM;HAVE_GETPAGESIZE=1")
 
--- a/Resources/CMake/SdlConfiguration.cmake	Fri Oct 14 20:41:01 2016 +0200
+++ b/Resources/CMake/SdlConfiguration.cmake	Sat Oct 15 14:51:49 2016 +0200
@@ -60,7 +60,7 @@
     #-DSDL_THREADS_DISABLED=1
     )
 
-  if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+  if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
     file(GLOB TMP
       ${SDL_SOURCES_DIR}/src/core/linux/*.c
       ${SDL_SOURCES_DIR}/src/loadso/dlopen/*.c
@@ -96,7 +96,7 @@
 
     link_libraries(X11 Xext)
 
-  elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+  elseif (CMAKE_SYSTEM_NAME STREQUAL "Windows")
     file(GLOB TMP
       ${SDL_SOURCES_DIR}/src/audio/directsound/*.c
       ${SDL_SOURCES_DIR}/src/audio/disk/*.c
@@ -151,6 +151,38 @@
     endif()
     
     link_libraries(imm32 winmm version)
+
+  elseif (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+    file(GLOB TMP
+      ${SDL_SOURCES_DIR}/src/loadso/dlopen/*.c
+      ${SDL_SOURCES_DIR}/src/render/opengl/*.c
+      ${SDL_SOURCES_DIR}/src/render/opengles2/*.c
+      ${SDL_SOURCES_DIR}/src/render/software/*.c
+      ${SDL_SOURCES_DIR}/src/thread/pthread/*.c
+      ${SDL_SOURCES_DIR}/src/timer/unix/*.c
+      ${SDL_SOURCES_DIR}/src/video/cocoa/*.c
+      )
+
+    list(APPEND SDL_SOURCES ${TMP})
+
+    add_definitions(
+      -DSDL_LOADSO_DLOPEN=1
+      -DSDL_THREAD_PTHREAD=1
+      -DSDL_TIMER_UNIX=1
+      -DSDL_POWER_DISABLED=1
+
+      -DSDL_VIDEO_DRIVER_X11=1
+      -DSDL_VIDEO_OPENGL=1
+      -DSDL_VIDEO_OPENGL_ES2=1
+      -DSDL_VIDEO_RENDER_OGL=1
+      -DSDL_VIDEO_RENDER_OGL_ES2=1
+      -DSDL_VIDEO_OPENGL_GLX=1
+      -DSDL_VIDEO_OPENGL_EGL=1
+      
+      -DSDL_ASSEMBLY_ROUTINES=1
+      -DSDL_THREAD_PTHREAD_RECURSIVE_MUTEX=1
+      )
+
   endif()
 
 else()