From 9adb18115634bf35868de920a0d0be2009beb86a Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sun, 12 Jul 2015 19:23:55 +0000 Subject: [PATCH] Make FL_ABI_VERSION configurable (STR #3161). This commit adds the configure option --with-abiversion and the CMake option OPTION_ABI_VERSION. Both options can be set e.g. to 10304 to build with FL_ABI_VERSION = 10304 (FLTK 1.3.4). For IDE builds there are new files ide//FL/abi-version.h that can be edited to change the ABI version before the FLTK lib is built. Note that this file MUST be copied to the include/FL directory if the IDE-built library is to be installed. The default is FL_ABI_VERSION = FL_MAJOR*10000 + FL_MINOR*100 + 0, i.e. 10300 for all FLTK 1.3.x versions to keep binary compatibility (ABI). Todo: more tests and more documentation. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10786 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- .gitignore | 3 ++- CHANGES | 3 +++ CMake/install.cmake | 4 ++++ CMake/options.cmake | 7 ++++++ CMakeLists.txt | 6 +++++ FL/Enumerations.H | 38 ++++++++++++++++++-------------- Makefile | 1 + README.MSWindows.txt | 7 ++++++ abi-version.cmake.in | 7 ++++++ abi-version.in | 7 ++++++ configure.in | 16 ++++++++++++++ ide/VisualC2008/FL/abi-version.h | 31 ++++++++++++++++++++++++++ ide/VisualC2010/FL/abi-version.h | 31 ++++++++++++++++++++++++++ ide/VisualC6/FL/abi-version.h | 31 ++++++++++++++++++++++++++ ide/Xcode4/FL/abi-version.h | 31 ++++++++++++++++++++++++++ 15 files changed, 206 insertions(+), 17 deletions(-) create mode 100644 abi-version.cmake.in create mode 100644 abi-version.in create mode 100644 ide/VisualC2008/FL/abi-version.h create mode 100644 ide/VisualC2010/FL/abi-version.h create mode 100644 ide/VisualC6/FL/abi-version.h create mode 100644 ide/Xcode4/FL/abi-version.h diff --git a/.gitignore b/.gitignore index 9eccf651a..bd3c5445d 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,8 @@ /*.bck /TAGS -# /FL/ +# /FL +/FL/abi-version.h /FL/Makefile /FL/*.bck diff --git a/CHANGES b/CHANGES index 5abdb8955..91264037b 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ CHANGES IN FLTK 1.3.4 RELEASED: ??? ?? ???? New features and extensions + - FLTK's ABI version can now be configured with configure or CMake. +*FIXME* See further documentation in ... [TBD]. + - Added full support of true subwindows to the Mac OS X platform. Window nesting to any depth is possible. An Fl_Gl_Window window or subwindow can contain Fl_Window's as subwindows. diff --git a/CMake/install.cmake b/CMake/install.cmake index 755489b02..e97d02890 100644 --- a/CMake/install.cmake +++ b/CMake/install.cmake @@ -36,6 +36,10 @@ install(DIRECTORY ${FLTK_SOURCE_DIR}/FL PATTERN ".svn" EXCLUDE ) +install(DIRECTORY ${FLTK_BINARY_DIR}/FL + DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS +) + if(OPTION_CREATE_LINKS) install(SCRIPT ${FLTK_BINARY_DIR}/install-symlinks.cmake) endif(OPTION_CREATE_LINKS) diff --git a/CMake/options.cmake b/CMake/options.cmake index 1444ae154..1c721d131 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -33,6 +33,13 @@ set(OPTION_ARCHFLAGS "" ) add_definitions(${OPTION_ARCHFLAGS}) +####################################################################### +set(OPTION_ABI_VERSION "" + CACHE STRING + "FLTK ABI Version (FL_ABI_VERSION - define as 10x0y for 1.x.y)" + ) +set(FL_ABI_VERSION ${OPTION_ABI_VERSION}) + ####################################################################### ####################################################################### if(UNIX) diff --git a/CMakeLists.txt b/CMakeLists.txt index b82d5dcda..16f75fca9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,12 @@ include(CMake/variables.cmake) ####################################################################### include(CMake/export.cmake) +configure_file( + ${FLTK_SOURCE_DIR}/abi-version.cmake.in + ${FLTK_BINARY_DIR}/FL/abi-version.h + @ONLY + ) + ####################################################################### # build examples - these have to be built after fluid is built/imported ####################################################################### diff --git a/FL/Enumerations.H b/FL/Enumerations.H index 5746391eb..675c8c562 100644 --- a/FL/Enumerations.H +++ b/FL/Enumerations.H @@ -23,23 +23,28 @@ #ifndef Fl_Enumerations_H #define Fl_Enumerations_H -/* Uncomment the following FL_ABI_VERSION line to enable ABI breaking fixes - * in the current patch release of FLTK. ** Use for static builds only! ** - * For more info on this macro, see: http://fltk.org/cmp.php#FLTK_ABI_VERSION +/* ****************************************************************************** - * Note: the link above is outdated. + * Notes on FL_ABI_VERSION and deprecated (obsolete) FLTK_ABI_VERSION: + * + * (1) FLTK_ABI_VERSION is deprecated, but still defined below. + * Do NOT define FLTK_ABI_VERSION here - it would be overwritten later. + * + * (2) FL_ABI_VERSION is now (as of FLTK 1.3.4) defined by configure + * or CMake. Do NOT define it here. Its definition will be included + * below by "#include ". + * + * (3) If you use the provided IDE files (Windows VC++ or Xcode) you should + * edit the definition in the provided IDE subdirectory. The correct + * file is `/path/to/fltk/ide//FL/abi-version.h' . + * + ****************************************************************************** + * For more info on FL_ABI_VERSION, see: http://fltk.org/cmp.php#FL_ABI_VERSION * FIXME: Update docs ... ****************************************************************************** - * This is work in progress! - * - * OLD: FLTK_ABI_VERSION deprecated, but defined later (see below) - * NEW: FL_ABI_VERSION FIXME: to be defined by configure ! - * - * The intent is to define FL_ABI_VERSION by configure and CMake. - * When this is done, the definition will be #include'd here ! - ****************************************************************************** */ -//#define FL_ABI_VERSION 10304 + +#include # include "Fl_Export.H" # include "fl_types.h" @@ -166,7 +171,8 @@ 10300 <= FL_ABI_VERSION <= 10304 - Note: configure + CMake not yet implemented, see also STR #3161. + Note: configure + CMake can be used to define FL_ABI_VERSION, but they + do not check validity. This is done here. */ #if FL_ABI_VERSION < FL_MAJOR_VERSION*10000 + FL_MINOR_VERSION*100 @@ -184,8 +190,8 @@ /* FLTK_ABI_VERSION is deprecated (replaced by FL_ABI_VERSION). - This deprecated constant should be removed in FLTK 1.4.0 and later. - Please use FL_ABI_VERSION instead. + This deprecated constant will be removed in FLTK 1.4.0 and later. + Please use FL_ABI_VERSION when FLTK 1.4.0 has been released. */ #ifdef FLTK_ABI_VERSION diff --git a/Makefile b/Makefile index cd62a268b..892a571c5 100644 --- a/Makefile +++ b/Makefile @@ -70,6 +70,7 @@ distclean: clean $(RM) fltk-config fltk.list makeinclude $(RM) fltk.spec $(RM) FL/Makefile + $(RM) FL/abi-version.h $(RM) documentation/*.$(CAT1EXT) $(RM) documentation/*.$(CAT3EXT) $(RM) documentation/*.$(CAT6EXT) diff --git a/README.MSWindows.txt b/README.MSWindows.txt index 2d7740507..6dc154bc3 100644 --- a/README.MSWindows.txt +++ b/README.MSWindows.txt @@ -389,6 +389,9 @@ without adding link and include paths to the solution. copy the entire FL directory into the include path + add all files from ide\VisualC2008\FL to the FL directory copied above + (this is currently only one file: abi-version.h) + copy all .lib files from the fltk lib directory to the VC lib directory copy fluid.exe in the fluid directory to the bin directory @@ -500,6 +503,9 @@ without adding link and include paths to the solution. copy the entire FL directory into the include path + add all files from ide\VisualC2010\FL to the FL directory copied above + (this is currently only one file: abi-version.h) + copy all .lib files from the fltk lib directory to the VC lib directory copy fluid.exe in the fluid directory to the bin directory @@ -638,3 +644,4 @@ Oct 25 2010 - matt: restructured entire document and verified instructions Dec 20 2010 - matt: merged with README.win32 Dec 22 2010 - AlbrechtS: added newer Cygwin (cross/mingw-w64) options Feb 24 2012 - AlbrechtS: clarified console window FAQ +Jul 12 2015 - AlbrechtS: add abi-config.h to files to be copied diff --git a/abi-version.cmake.in b/abi-version.cmake.in new file mode 100644 index 000000000..a91887a6b --- /dev/null +++ b/abi-version.cmake.in @@ -0,0 +1,7 @@ +/* + DO NOT EDIT - This file is generated by CMake +*/ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +#cmakedefine FL_ABI_VERSION @FL_ABI_VERSION@ diff --git a/abi-version.in b/abi-version.in new file mode 100644 index 000000000..84794b1a7 --- /dev/null +++ b/abi-version.in @@ -0,0 +1,7 @@ +/* + DO NOT EDIT - This file is generated by configure +*/ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +#undef FL_ABI_VERSION diff --git a/configure.in b/configure.in index 963dc6eed..cb6f3359b 100644 --- a/configure.in +++ b/configure.in @@ -172,6 +172,21 @@ AC_SUBST(GLLIBBASENAME) AC_SUBST(IMGLIBBASENAME) AC_SUBST(CAIROLIBBASENAME) +has_abiversion="" +AC_ARG_WITH(abiversion, +[ --with-abiversion Build with FL_ABI_VERSION, e.g. 10304 for FLTK 1.3.4]) +has_abiversion="$with_abiversion" +if test "$has_abiversion" = "yes" ; then + has_abiversion="" +else + if test "$has_abiversion" = "no" ; then + has_abiversion="" + fi +fi +if test ! "$has_abiversion" = "" ; then + AC_DEFINE_UNQUOTED(FL_ABI_VERSION, [$has_abiversion], [define to FL_ABI_VERSION]) +fi + dnl Handle compile-time options... AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [[default=no]]]) if test x$enable_debug = xyes; then @@ -1475,6 +1490,7 @@ fi dnl Write all of the files... AC_CONFIG_HEADER(config.h:configh.in) +AC_CONFIG_HEADER(FL/abi-version.h:abi-version.in) AC_OUTPUT(makeinclude fltk.list fltk-config fltk.spec FL/Makefile) dnl Make sure the fltk-config script is executable... diff --git a/ide/VisualC2008/FL/abi-version.h b/ide/VisualC2008/FL/abi-version.h new file mode 100644 index 000000000..a46603d6e --- /dev/null +++ b/ide/VisualC2008/FL/abi-version.h @@ -0,0 +1,31 @@ +/* + DO NOT EDIT - This file must be configured BEFORE building FLTK ! +*/ + +/* + ============================================================================ + Important note to IDE users: + ============================================================================ + + This file *may* be edited *before* building FLTK with your IDE project, + i.e. in /path/to/fltk/ide//FL/abi-version.h: + + (1) Define FL_ABI_VERSION as described below. + (2) Rebuild the entire FLTK library. + (3) Optional: install files as usual including THIS file. + + DO NOT edit this file after building the FLTK library, i.e. when this + file is already installed in a (system) directory used to build your + programs. + + Editing this file w/o rebuilding the entire FLTK library will change + the ABI and thus render your programs unusable - they may crash or + show other unpredictable errors. You have been warned! + + ============================================================================ + End of important note to IDE users. + ============================================================================ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +#define FL_ABI_VERSION 10300 diff --git a/ide/VisualC2010/FL/abi-version.h b/ide/VisualC2010/FL/abi-version.h new file mode 100644 index 000000000..a46603d6e --- /dev/null +++ b/ide/VisualC2010/FL/abi-version.h @@ -0,0 +1,31 @@ +/* + DO NOT EDIT - This file must be configured BEFORE building FLTK ! +*/ + +/* + ============================================================================ + Important note to IDE users: + ============================================================================ + + This file *may* be edited *before* building FLTK with your IDE project, + i.e. in /path/to/fltk/ide//FL/abi-version.h: + + (1) Define FL_ABI_VERSION as described below. + (2) Rebuild the entire FLTK library. + (3) Optional: install files as usual including THIS file. + + DO NOT edit this file after building the FLTK library, i.e. when this + file is already installed in a (system) directory used to build your + programs. + + Editing this file w/o rebuilding the entire FLTK library will change + the ABI and thus render your programs unusable - they may crash or + show other unpredictable errors. You have been warned! + + ============================================================================ + End of important note to IDE users. + ============================================================================ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +#define FL_ABI_VERSION 10300 diff --git a/ide/VisualC6/FL/abi-version.h b/ide/VisualC6/FL/abi-version.h new file mode 100644 index 000000000..a46603d6e --- /dev/null +++ b/ide/VisualC6/FL/abi-version.h @@ -0,0 +1,31 @@ +/* + DO NOT EDIT - This file must be configured BEFORE building FLTK ! +*/ + +/* + ============================================================================ + Important note to IDE users: + ============================================================================ + + This file *may* be edited *before* building FLTK with your IDE project, + i.e. in /path/to/fltk/ide//FL/abi-version.h: + + (1) Define FL_ABI_VERSION as described below. + (2) Rebuild the entire FLTK library. + (3) Optional: install files as usual including THIS file. + + DO NOT edit this file after building the FLTK library, i.e. when this + file is already installed in a (system) directory used to build your + programs. + + Editing this file w/o rebuilding the entire FLTK library will change + the ABI and thus render your programs unusable - they may crash or + show other unpredictable errors. You have been warned! + + ============================================================================ + End of important note to IDE users. + ============================================================================ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +#define FL_ABI_VERSION 10300 diff --git a/ide/Xcode4/FL/abi-version.h b/ide/Xcode4/FL/abi-version.h new file mode 100644 index 000000000..a46603d6e --- /dev/null +++ b/ide/Xcode4/FL/abi-version.h @@ -0,0 +1,31 @@ +/* + DO NOT EDIT - This file must be configured BEFORE building FLTK ! +*/ + +/* + ============================================================================ + Important note to IDE users: + ============================================================================ + + This file *may* be edited *before* building FLTK with your IDE project, + i.e. in /path/to/fltk/ide//FL/abi-version.h: + + (1) Define FL_ABI_VERSION as described below. + (2) Rebuild the entire FLTK library. + (3) Optional: install files as usual including THIS file. + + DO NOT edit this file after building the FLTK library, i.e. when this + file is already installed in a (system) directory used to build your + programs. + + Editing this file w/o rebuilding the entire FLTK library will change + the ABI and thus render your programs unusable - they may crash or + show other unpredictable errors. You have been warned! + + ============================================================================ + End of important note to IDE users. + ============================================================================ + +/* define FL_ABI_VERSION as 10x0y for FLTK ABI version 1.x.y */ + +#define FL_ABI_VERSION 10300