FLTK logo

[master] 6276822 - Allow cmake -DOPTION_APPLE_X11=On without -U__APPLE__

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 6276822 - Allow cmake -DOPTION_APPLE_X11=On without -U__APPLE__ "ManoloFLTK" Feb 02, 2023  
 
commit 6276822e9e8f505756b386637df9e14dd5a8e2fb
Author:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
AuthorDate: Thu Feb 2 18:48:13 2023 +0100
Commit:     ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
CommitDate: Thu Feb 2 18:48:24 2023 +0100

    Allow cmake -DOPTION_APPLE_X11=On without -U__APPLE__

 CMake/setup.cmake                            |  4 +---
 FL/platform.H                                |  6 +++---
 cairo/Fl_Cairo.cxx                           |  6 +++---
 configure.ac                                 |  3 +--
 src/drivers/Posix/Fl_Posix_System_Driver.cxx | 10 ++++++++--
 test/menubar.cxx                             |  5 ++++-
 6 files changed, 20 insertions(+), 14 deletions(-)

diff --git CMake/setup.cmake CMake/setup.cmake
index e89ecc7..bc98aa5 100644
--- CMake/setup.cmake
+++ CMake/setup.cmake
@@ -2,7 +2,7 @@
 # CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
 # Originally written by Michael Surette
 #
-# Copyright 1998-2022 by Bill Spitzak and others.
+# Copyright 1998-2023 by Bill Spitzak and others.
 #
 # This library is free software. Distribution and use rights are outlined in
 # the file "COPYING" which should have been included with this file.  If this
@@ -97,8 +97,6 @@ if (APPLE)
   set (HAVE_SCANDIR 1)
   set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
   if (OPTION_APPLE_X11)
-    set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U__APPLE__")
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -U__APPLE__")
     if (NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0)) # a.k.a. macOS version â?¥ 10.13
       set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_LIBCPP_HAS_THREAD_API_PTHREAD")
     endif (NOT(${CMAKE_SYSTEM_VERSION} VERSION_LESS 17.0.0))
diff --git FL/platform.H FL/platform.H
index 6d75738..715a10c 100644
--- FL/platform.H
+++ FL/platform.H
@@ -1,7 +1,7 @@
 //
 // Platform header file for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2022 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -35,12 +35,12 @@ class Fl_Window;
 
 #  ifdef _WIN32
 #    include "win32.H"
-#  elif defined(__APPLE__)
-#    include "mac.H"
 #  elif defined(FLTK_USE_WAYLAND)
 #    include "wayland.H"
 #  elif defined(FLTK_USE_X11)
 #    include "x11.H"
+#  elif defined(__APPLE__)
+#    include "mac.H"
 #  endif // _WIN32
 
 //
diff --git cairo/Fl_Cairo.cxx cairo/Fl_Cairo.cxx
index a8a63b3..2def269 100644
--- cairo/Fl_Cairo.cxx
+++ cairo/Fl_Cairo.cxx
@@ -1,7 +1,7 @@
 //
 // Special Cairo support for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2022 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -34,8 +34,6 @@
 
 #if defined(_WIN32)               // Windows
 #  include <cairo-win32.h>
-#elif defined(__APPLE__)          // macOS
-#  include <cairo-quartz.h>
 #elif defined(FLTK_USE_WAYLAND)   // Wayland or hybrid
 #  include "../src/drivers/Wayland/Fl_Wayland_Graphics_Driver.H"
 #  include "../src/drivers/Wayland/Fl_Wayland_Window_Driver.H"
@@ -46,6 +44,8 @@
 #  endif
 #elif defined(FLTK_USE_X11)       // X11
 #  include <cairo-xlib.h>
+#elif defined(__APPLE__)          // macOS
+#  include <cairo-quartz.h>
 #else
 #  error Cairo is not supported on this platform.
 #endif
diff --git configure.ac configure.ac
index 410aebd..16d5e26 100644
--- configure.ac
+++ configure.ac
@@ -3,7 +3,7 @@ dnl the "configure" script is made from this by running GNU "autoconf"
 dnl
 dnl Configuration script for the Fast Light Tool Kit (FLTK).
 dnl
-dnl Copyright 1998-2022 by Bill Spitzak and others.
+dnl Copyright 1998-2023 by Bill Spitzak and others.
 dnl
 dnl This library is free software. Distribution and use rights are outlined in
 dnl the file "COPYING" which should have been included with this file.  If this
@@ -185,7 +185,6 @@ AS_CASE([$host_os], [cygwin*], [
 ], [darwin*], [
     AS_IF([test x$enable_x11 = xyes], [
         host_os_gui="X11"
-        OPTIM="-U__APPLE__ $OPTIM"
         macosversion=$(sw_vers -productVersion | cut -d. -f2)
         macosversion_maj=$(sw_vers -productVersion | cut -d. -f1)
         AS_IF([test $macosversion_maj -ge 11 -o $macosversion -ge 13], [
diff --git src/drivers/Posix/Fl_Posix_System_Driver.cxx src/drivers/Posix/Fl_Posix_System_Driver.cxx
index d807577..6d52313 100644
--- src/drivers/Posix/Fl_Posix_System_Driver.cxx
+++ src/drivers/Posix/Fl_Posix_System_Driver.cxx
@@ -1,7 +1,7 @@
 //
 // Definition of Posix system driver (used by the X11, Wayland and macOS platforms).
 //
-// Copyright 1998-2022 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -262,7 +262,13 @@ bool Fl_Posix_System_Driver::probe_for_GTK(int major, int minor, void **p_ptr_gt
 #endif
     } else {
       // Try then with GTK2
-      Fl_Posix_System_Driver::ptr_gtk = Fl_Posix_System_Driver::dlopen_or_dlsym("libgtk-x11-2.0");
+      Fl_Posix_System_Driver::ptr_gtk = Fl_Posix_System_Driver::dlopen_or_dlsym(
+#ifdef __APPLE__
+                                                          "libgtkmacintegration-gtk2"
+#else
+                                                            "libgtk-x11-2.0"
+#endif
+                                                                                );
 #ifdef DEBUG
       if (Fl_Posix_System_Driver::ptr_gtk) {
         puts("selected GTK-2\n");
diff --git test/menubar.cxx test/menubar.cxx
index f8b1aaf..a1c7bc7 100644
--- test/menubar.cxx
+++ test/menubar.cxx
@@ -1,7 +1,7 @@
 //
 // Menubar test program for the Fast Light Tool Kit (FLTK).
 //
-// Copyright 1998-2020 by Bill Spitzak and others.
+// Copyright 1998-2023 by Bill Spitzak and others.
 //
 // This library is free software. Distribution and use rights are outlined in
 // the file "COPYING" which should have been included with this file.  If this
@@ -15,6 +15,9 @@
 //
 
 #include <FL/Fl.H>
+#if defined(FLTK_USE_X11) && defined(__APPLE__)
+# undef __APPLE__
+#endif
 #ifdef __APPLE__
 #include <FL/platform.H> // for Fl_Mac_App_Menu
 #endif
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.