Allow cmake -DOPTION_APPLE_X11=On without -U__APPLE__

This commit is contained in:
ManoloFLTK 2023-02-02 18:48:13 +01:00
parent 4e75549e7b
commit 6276822e9e
6 changed files with 20 additions and 14 deletions

View File

@ -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))

View File

@ -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
//

View File

@ -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

View File

@ -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], [

View File

@ -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");

View File

@ -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