The 3 objective-c++ files used for the Mac OS X support are no longer included

by other files but added to the list of source files to be compiled
for Mac OS X only. Support files for autoconf/configure/make, CMake and Xcode
are also modified accordingly.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8049 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Manolo Gouy 2010-12-17 10:43:41 +00:00
parent ff4cafeb30
commit f3c7efc8d2
11 changed files with 83 additions and 51 deletions

View File

@ -36,7 +36,11 @@ AC_INIT(src/Fl.cxx)
dnl So --with-archflags option is used during "checking size of long"
if test `uname` = Darwin; then
CFLAGS="$CFLAGS $with_archflags"
USEMMFILES="Yes"
else
USEMMFILES="No"
fi
AC_SUBST(USEMMFILES)
dnl FLTK library versions...
FL_MAJOR_VERSION=1

View File

@ -490,6 +490,11 @@ public:
fputs("\tfl_utf8.cxx \\\n", f);
fputs("\tps_image.cxx\n", f);
fputs("\n", f);
fputs("OBJCPPFILES = \\\n", f);
fputs("\tFl_cocoa.mm Fl_Quartz_Printer.mm Fl_Native_File_Chooser_MAC.mm\n", f);
fputs("\n", f);
fputs("FLCPPFILES = \\\n", f);
fputs("\tforms_compatability.cxx \\\n", f);
fputs("\tforms_bitmap.cxx \\\n", f);
@ -538,7 +543,12 @@ public:
fputs("\n", f);
fputs("include ../makeinclude\n", f);
fputs("\n", f);
fputs("OBJECTS = $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o)\n", f);
fputs("MMFILES = $(shell \\\n"
"\tif [ $(USEMMFILES) = Yes ]; then echo $(OBJCPPFILES);\\\n"
"\tfi)\n\n", f);
fputs("OBJECTS = $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o)\n", f);
fputs("GLOBJECTS = $(GLCPPFILES:.cxx=.o)\n", f);
fputs("FLOBJECTS = $(FLCPPFILES:.cxx=.o)\n", f);
fputs("IMGOBJECTS = $(IMGCPPFILES:.cxx=.o)\n", f);
@ -795,8 +805,8 @@ public:
fputs("\t\tlibfltk_gl.dylib libfltk_images.dylib \\\n", f);
fputs("\t\tcmap core\n", f);
fputs("\n", f);
fputs("depend:\t$(CPPFILES) $(FLCPPFILES) $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)\n", f);
fputs("\tmakedepend -Y -I.. -f makedepend $(CPPFILES) $(FLCPPFILES) \\\n", f);
fputs("depend:\t$(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)\n", f);
fputs("\tmakedepend -Y -I.. -f makedepend $(CPPFILES) $(MMFILES) $(FLCPPFILES) \\\n", f);
fputs("\t\t$(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)\n", f);
fputs("\n", f);
fputs("# Automatically generated dependencies... generated on a Linux/Unix host !\n", f);
@ -807,8 +817,11 @@ public:
fputs("# Please add only non-Linux/Unix files or such that are optional\n", f);
fputs("# (like \"*xft*\") here:\n", f);
fputs("Fl_get_key.o:\tFl_get_key_mac.cxx Fl_get_key_win32.cxx\n", f);
fputs("Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_MAC.mm Fl_Native_File_Chooser_WIN32.cxx\n", f);
fputs("Fl.o:\t\tFl_mac.cxx Fl_win32.cxx Fl_cocoa.mm\n", f);
fputs("Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_WIN32.cxx\n", f);
fputs("Fl_Native_File_Chooser_MAC.o : Fl_Native_File_Chooser_MAC.mm\n", f);
fputs("Fl_Quartz_Printer.o : Fl_Quartz_Printer.mm\n", f);
fputs("Fl.o:\t\tFl_win32.cxx\n", f);
fputs("Fl_cocoa.o:\t\tFl_cocoa.mm\n", f);
fputs("fl_color.o:\tfl_color_mac.cxx fl_color_win32.cxx\n", f);
fputs("fl_dnd.o:\tfl_dnd_mac.cxx fl_dnd_win32.cxx fl_dnd_x.cxx\n", f);
fputs("fl_draw_image.o: fl_draw_image_mac.cxx fl_draw_image_win32.cxx\n", f);
@ -816,7 +829,7 @@ public:
fputs("fl_read_image.o: fl_read_image_mac.cxx fl_read_image_win32.cxx\n", f);
fputs("fl_set_fonts.o:\tfl_set_fonts_mac.cxx fl_set_fonts_x.cxx \\\n", f);
fputs("\t\tfl_set_fonts_xft.cxx fl_set_fonts_win32.cxx\n", f);
fputs("Fl_Printer.o:\tFl_Quartz_Printer.mm Fl_GDI_Printer.cxx Fl_PS_Printer.cxx\n", f);
fputs("Fl_Printer.o:\tFl_GDI_Printer.cxx Fl_PostScript.cxx\n", f);
fputs("\n", f);
fputs("fl_arci.o:\t../FL/mac.H ../FL/win32.H\n", f);
fputs("Fl_arg.o:\t../FL/mac.H ../FL/win32.H\n", f);

View File

@ -510,7 +510,10 @@ int create_new_database(const char *filename)
fltk_lib.add_source(files_db, "src/xutf8/case.c");
fltk_lib.add_source(files_db, "src/xutf8/is_right2left.c");
fltk_lib.add_source(files_db, "src/xutf8/is_spacing.c");
xcode_only(fltk_lib.add_source(files_db, "src/Fl_cocoa.mm"));
xcode_only(fltk_lib.add_source(files_db, "src/Fl_Quartz_Printer.mm"));
xcode_only(fltk_lib.add_source(files_db, "src/Fl_Native_File_Chooser_MAC.mm"));
fltk_lib.add_header(files_db, "FL/Enumerations.H");
fltk_lib.add_header(files_db, "FL/Fl.H");
@ -638,7 +641,7 @@ int create_new_database(const char *filename)
fltk_lib.add_header(files_db, "FL/math.h");
fltk_lib.add_header(files_db, "FL/names.h");
fltk_lib.add_header(files_db, "FL/win32.H");
fltk_lib.add_header(files_db, "FL/x.H");
fltk_lib.add_header(files_db, "FL/x.H");
xcode_only(fltk_lib.add_external_lib(files_db, "/System/Library/Frameworks/AudioToolbox.framework"));
}

View File

@ -29,7 +29,7 @@
XCODE 3.0 IDE FILES
The Xcode 3.0 IDE file format is using a quite comlex tree of multiply linked
The Xcode 3.0 IDE file format is using a quite complex tree of multiply linked
entries to leave as much possibilities to developers as somehow possible. To
write this format, we will need to generate a bunch of new unique IDs that will
be stored in the DB.
@ -447,10 +447,6 @@ public:
const char *filetype = "test";
const char *ext = fileDB.fileExt();
if (!ext) {
} else if (strcmp(pathAndName, "src/Fl.cxx")==0
||strcmp(pathAndName, "src/Fl_Native_File_Chooser.cxx")==0
||strcmp(pathAndName, "src/Fl_Printer.cxx")==0) { // FIXME: bad hack!
filetype = "sourcecode.cpp.objcpp";
} else if (strcmp(ext, ".cxx")==0) {
filetype = "sourcecode.cpp.cpp";
} else if (strcmp(ext, ".H")==0) {

View File

@ -36,7 +36,7 @@ mandir = @mandir@
srcdir = @srcdir@
docdir = $(datadir)/doc/fltk
VPATH = @srcdir@
USEMMFILES = @USEMMFILES@
# programs we use...
HTMLDOC = @HTMLDOC@
DOXYDOC = @DOXYDOC@
@ -143,7 +143,7 @@ UNINSTALL_DESKTOP = @UNINSTALL_DESKTOP@
.SILENT:
# Build commands and filename extensions...
.SUFFIXES: .0 .1 .3 .6 .c .cxx .h .fl .man .o .z $(EXEEXT)
.SUFFIXES: .0 .1 .3 .6 .c .cxx .mm .h .fl .man .o .z $(EXEEXT)
.o$(EXEEXT):
echo Linking $@...
@ -155,15 +155,12 @@ UNINSTALL_DESKTOP = @UNINSTALL_DESKTOP@
.cxx.o:
echo Compiling $<...
@if test `uname` = Darwin -a $< = Fl.cxx ; then \
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -x objective-c++ -c $< -o $@; \
elif test `uname` = Darwin -a $< = Fl_Native_File_Chooser.cxx ; then \
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -x objective-c++ -c $< -o $@; \
elif test `uname` = Darwin -a $< = Fl_Printer.cxx ; then \
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -x objective-c++ -c $< -o $@; \
else \
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -c $< -o $@; \
fi
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -c $< -o $@
.mm.o:
echo Compiling $<...
$(CXX) -I.. $(ARCHFLAGS) $(CXXFLAGS) -x objective-c++ -c $< -o $@
.man.0 .man.1 .man.3 .man.6:
echo Formatting $<...

View File

@ -194,13 +194,18 @@ set(CFILES
)
if(APPLE)
set_source_files_properties(
Fl.cxx Fl_Native_File_Chooser.cxx Fl_Printer.cxx
PROPERTIES COMPILE_FLAGS "-x objective-c++")
set(MMFILES
Fl_cocoa.mm
Fl_Quartz_Printer.mm
Fl_Native_File_Chooser_MAC.mm
)
else()
set(MMFILES
)
endif(APPLE)
#######################################################################
add_library(fltk STATIC ${CPPFILES} ${CFILES} fl_call_main.c)
add_library(fltk STATIC ${CPPFILES} ${MMFILES} ${CFILES} fl_call_main.c)
set_target_properties(fltk PROPERTIES CLEAN_DIRECT_OUTPUT 1)
if(MSVC)
if(OPTION_LARGE_FILE)
@ -307,7 +312,7 @@ endif(OPENGL_FOUND)
if(OPTION_BUILD_SHARED_LIBS)
#######################################################################
add_library(fltk_SHARED SHARED ${CPPFILES} ${CFILES})
add_library(fltk_SHARED SHARED ${CPPFILES} ${MMFILES} ${CFILES})
set_target_properties(fltk_SHARED
PROPERTIES CLEAN_DIRECT_OUTPUT 1
VERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}

View File

@ -48,10 +48,6 @@
#include <stdlib.h>
#include "flstring.h"
#if defined(__APPLE__)
#import <Cocoa/Cocoa.h>
#endif
#if defined(DEBUG) || defined(DEBUG_WATCH)
# include <stdio.h>
#endif // DEBUG || DEBUG_WATCH
@ -63,6 +59,8 @@ HBRUSH fl_brush_action(int action);
void fl_cleanup_pens(void);
void fl_release_dc(HWND,HDC);
void fl_cleanup_dc_list(void);
#elif defined(__APPLE__)
extern double fl_MAC_flush_and_wait(double time_to_wait, char in_idle);
#endif // WIN32
//
@ -420,13 +418,7 @@ double Fl::wait(double time_to_wait) {
// the idle function may turn off idle, we can then wait:
if (idle) time_to_wait = 0.0;
}
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
flush();
if (idle && !in_idle) // 'idle' may have been set within flush()
time_to_wait = 0.0;
double retval = fl_wait(time_to_wait);
[pool release];
return retval;
return fl_MAC_flush_and_wait(time_to_wait, in_idle);
#else
@ -1556,8 +1548,7 @@ void Fl_Window::flush() {
#ifdef WIN32
# include "Fl_win32.cxx"
#elif defined(__APPLE__)
# include "Fl_cocoa.mm"
//#elif defined(__APPLE__)
#endif
//

View File

@ -32,7 +32,7 @@
// Use Apple's chooser
#ifdef __APPLE__
#include "Fl_Native_File_Chooser_MAC.mm"
//#include "Fl_Native_File_Chooser_MAC.mm"
#endif
// All else falls back to FLTK's own chooser

View File

@ -29,7 +29,7 @@
#include <FL/Fl_Printer.H>
#ifdef __APPLE__
#include "Fl_Quartz_Printer.mm"
//#include "Fl_Quartz_Printer.mm"
#elif defined(WIN32)
#include "Fl_GDI_Printer.cxx"
#endif

View File

@ -703,6 +703,16 @@ int fl_wait( double time )
return (got_events);
}
double fl_MAC_flush_and_wait(double time_to_wait, char in_idle) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
Fl::flush();
if (Fl::idle && !in_idle) // 'idle' may have been set within flush()
time_to_wait = 0.0;
double retval = fl_wait(time_to_wait);
[pool release];
return retval;
}
// updates Fl::e_x, Fl::e_y, Fl::e_x_root, and Fl::e_y_root
static void update_e_xy_and_e_xy_root(NSWindow *nsw)
{

View File

@ -166,7 +166,12 @@ CPPFILES = \
screen_xywh.cxx \
fl_utf8.cxx \
ps_image.cxx
OBJCPPFILES = \
Fl_cocoa.mm \
Fl_Quartz_Printer.mm \
Fl_Native_File_Chooser_MAC.mm
FLCPPFILES = \
forms_compatability.cxx \
forms_bitmap.cxx \
@ -215,7 +220,12 @@ UTF8CFILES = \
include ../makeinclude
OBJECTS = $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o)
MMFILES = $(shell \
if [ $(USEMMFILES) = Yes ]; then echo $(OBJCPPFILES);\
fi)
OBJECTS = $(MMFILES:.mm=.o) $(CPPFILES:.cxx=.o) $(CFILES:.c=.o) $(UTF8CFILES:.c=.o)
GLOBJECTS = $(GLCPPFILES:.cxx=.o)
FLOBJECTS = $(FLCPPFILES:.cxx=.o)
IMGOBJECTS = $(IMGCPPFILES:.cxx=.o)
@ -472,8 +482,8 @@ clean:
libfltk_gl.dylib libfltk_images.dylib \
cmap core
depend: $(CPPFILES) $(FLCPPFILES) $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
makedepend -Y -I.. -f makedepend $(CPPFILES) $(FLCPPFILES) \
depend: $(CPPFILES) $(MMFILES) $(FLCPPFILES) $(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
makedepend -Y -I.. -f makedepend $(CPPFILES) $(MMFILES) $(FLCPPFILES) \
$(GLCPPFILES) $(IMGCPPFILES) $(CFILES) $(UTF8CFILES)
# Automatically generated dependencies... generated on a Linux/Unix host !
@ -484,8 +494,10 @@ include makedepend
# Please add only non-Linux/Unix files or such that are optional
# (like "*xft*") here:
Fl_get_key.o: Fl_get_key_mac.cxx Fl_get_key_win32.cxx
Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_MAC.mm Fl_Native_File_Chooser_WIN32.cxx
Fl.o: Fl_mac.cxx Fl_win32.cxx Fl_cocoa.mm
Fl_Native_File_Chooser.o : Fl_Native_File_Chooser_WIN32.cxx
Fl_Native_File_Chooser_MAC.o: Fl_Native_File_Chooser_MAC.mm
Fl.o: Fl_win32.cxx
Fl_cocoa.o: Fl_cocoa.mm
fl_color.o: fl_color_mac.cxx fl_color_win32.cxx
fl_dnd.o: fl_dnd_mac.cxx fl_dnd_win32.cxx fl_dnd_x.cxx
fl_draw_image.o: fl_draw_image_mac.cxx fl_draw_image_win32.cxx
@ -493,7 +505,8 @@ fl_font.o: fl_font_mac.cxx fl_font_x.cxx fl_font_xft.cxx fl_font_win32.cxx
fl_read_image.o: fl_read_image_mac.cxx fl_read_image_win32.cxx
fl_set_fonts.o: fl_set_fonts_mac.cxx fl_set_fonts_x.cxx \
fl_set_fonts_xft.cxx fl_set_fonts_win32.cxx
Fl_Printer.o: Fl_Quartz_Printer.mm Fl_GDI_Printer.cxx Fl_PostScript.cxx
Fl_Printer.o: Fl_GDI_Printer.cxx Fl_PostScript.cxx
Fl_Quartz_Printer.o: Fl_Quartz_Printer.mm
fl_arci.o: ../FL/mac.H ../FL/win32.H
Fl_arg.o: ../FL/mac.H ../FL/win32.H
fl_ask.o: ../FL/mac.H ../FL/win32.H