From 88129db051f0af336e15f4d02748c74c59cd3c06 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 20 Dec 2018 19:12:50 +0100 Subject: [PATCH 01/34] Improve CMake's Cairo detection and issue error message... ... if Cairo was requested (OPTION_CAIRO or OPTION_CAIROEXT) but Cairo was not found. CMake generation is terminated with a fatal error. The user has two choices: install Cairo libs and headers or disable OPTION_CAIRO and OPTION_CAIROEXT. --- CMake/options.cmake | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/CMake/options.cmake b/CMake/options.cmake index e94e0e937..438ff8374 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -157,27 +157,33 @@ include(FindPkgConfig) option(OPTION_CAIRO "use lib Cairo" OFF) option(OPTION_CAIROEXT - "use FLTK code instrumentation for cairo extended use" OFF + "use FLTK code instrumentation for Cairo extended use" OFF ) -if(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO) +if ((OPTION_CAIRO OR OPTION_CAIROEXT) AND LIB_CAIRO) pkg_search_module(PKG_CAIRO cairo) -endif(OPTION_CAIRO OR OPTION_CAIROEXT AND LIB_CAIRO) +endif ((OPTION_CAIRO OR OPTION_CAIROEXT) AND LIB_CAIRO) -if(PKG_CAIRO_FOUND) - set(FLTK_HAVE_CAIRO 1) +if (PKG_CAIRO_FOUND) + set (FLTK_HAVE_CAIRO 1) add_subdirectory(cairo) list(APPEND FLTK_LDLIBS -lcairo -lpixman-1) include_directories(${PKG_CAIRO_INCLUDE_DIRS}) string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") -endif(PKG_CAIRO_FOUND) +endif (PKG_CAIRO_FOUND) -if(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) +if (LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) set(FLTK_USE_CAIRO 1) set(FLTK_CAIRO_FOUND TRUE) else() set(FLTK_CAIRO_FOUND FALSE) -endif(LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) +endif (LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) + +if ((OPTION_CAIRO OR OPTION_CAIROEXT) AND NOT PKG_CAIRO_FOUND) + message(STATUS "*** Cairo was requested but not found - please install Cairo ...") + message(STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT") + message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers") +endif ((OPTION_CAIRO OR OPTION_CAIROEXT) AND NOT PKG_CAIRO_FOUND) ####################################################################### option(OPTION_USE_NANOSVG "support SVG images" ON) From 2153a93430d59e64eac654ac44e05e51fdd98045 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Thu, 20 Dec 2018 18:56:16 +0100 Subject: [PATCH 02/34] Fix line endings. Note: we recommend `git config core.autocrlf true'. --- .gitattributes | 9 +- ide/AndroidStudio3/gradlew.rename_to_bat | 180 +++++++++++------------ test/sudoku.rc | 144 +++++++++--------- 3 files changed, 168 insertions(+), 165 deletions(-) diff --git a/.gitattributes b/.gitattributes index 86b72ea30..c706bfbe8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,13 +20,15 @@ makesrcdist export-ignore eol=lf # fluid files (eol=lf or text?) -#*FIXME* *.fl eol=lf +*.fl eol=lf # shell scripts etc. with Unix line endings (lf) *.ac eol=lf +*.in eol=lf *.desktop eol=lf *.sh eol=lf + fltk-config.in eol=lf documentation/make_pdf eol=lf @@ -36,9 +38,10 @@ misc/update_config_scripts eol=lf # files with Windows line endings (crlf) -#*FIXME* *.rc eol=crlf +*.rc eol=crlf -#*FIXME* ide/AndroidStudio3/gradlew.rename_to_bat eol=crlf +# Android Studio special support file (Windows .bat file) +ide/AndroidStudio3/gradlew.rename_to_bat eol=crlf # binary files diff --git a/ide/AndroidStudio3/gradlew.rename_to_bat b/ide/AndroidStudio3/gradlew.rename_to_bat index aec99730b..8a0b282aa 100644 --- a/ide/AndroidStudio3/gradlew.rename_to_bat +++ b/ide/AndroidStudio3/gradlew.rename_to_bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/test/sudoku.rc b/test/sudoku.rc index 107c9a69f..36fb10d18 100644 --- a/test/sudoku.rc +++ b/test/sudoku.rc @@ -1,72 +1,72 @@ -//Microsoft Developer Studio generated resource script. -// -#include "sudokurc.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -//#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "icons.h\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_ICON ICON DISCARDABLE "sudoku.ico" -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +//Microsoft Developer Studio generated resource script. +// +#include "sudokurc.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +//LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "icons.h\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "\r\n" + "\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON ICON DISCARDABLE "sudoku.ico" +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + From 4ad9b5af0c891180b264b9f8437303a7f740a902 Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 22 Dec 2018 08:23:12 -0600 Subject: [PATCH 03/34] Ignore .tlog file generated by msbuild when using msvc tools. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 36bb00266..161934412 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.o *.exe +*.tlog # / /autom4te*.cache From 31dddf5719252ea928f700627a1c052464d5e45a Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 22 Dec 2018 08:24:17 -0600 Subject: [PATCH 04/34] Fix typo in README.Cairo.txt --- README.Cairo.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.Cairo.txt b/README.Cairo.txt index c25654cb9..10ec3934c 100644 --- a/README.Cairo.txt +++ b/README.Cairo.txt @@ -50,7 +50,7 @@ variable OPTION_CAIRO:BOOL=ON is set. ------------------------------ (1) Adding a new Fl_Cairo_Window class permitting transparent and easy - integration of a Cairo draw callback without the need subclass Fl_Window. + integration of a Cairo draw callback without the need to subclass Fl_Window. (2) Adding a Fl::cairo_make_current(Fl_Window*) function only providing transparently a cairo context to your custom Fl_Window derived class. From e3b289e008643af49876efd7d1d0b561305390f8 Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 22 Dec 2018 08:26:56 -0600 Subject: [PATCH 05/34] CMake CAIRO support minor improvements: Make the conditional code more readeable by reusing the already parsed PKG_CAIRO_FOUND variable instead of testing for it again, which also simplifies the preconditions testing. Fix typo (. in endif statement comment). --- CMake/options.cmake | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/CMake/options.cmake b/CMake/options.cmake index 438ff8374..c71eff1f4 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -170,21 +170,21 @@ if (PKG_CAIRO_FOUND) list(APPEND FLTK_LDLIBS -lcairo -lpixman-1) include_directories(${PKG_CAIRO_INCLUDE_DIRS}) string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") + + if (LIB_CAIRO AND OPTION_CAIROEXT) + set(FLTK_USE_CAIRO 1) + set(FLTK_CAIRO_FOUND TRUE) + else () + set(FLTK_CAIRO_FOUND FALSE) + endif (LIB_CAIRO AND OPTION_CAIROEXT) +else () + if ((OPTION_CAIRO OR OPTION_CAIROEXT)) + message(STATUS "*** Cairo was requested but not found - please check your cairo installation") + message(STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.") + message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers.") + endif ((OPTION_CAIRO OR OPTION_CAIROEXT)) endif (PKG_CAIRO_FOUND) -if (LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) - set(FLTK_USE_CAIRO 1) - set(FLTK_CAIRO_FOUND TRUE) -else() - set(FLTK_CAIRO_FOUND FALSE) -endif (LIB_CAIRO AND OPTION_CAIROEXT AND PKG_CAIRO_FOUND) - -if ((OPTION_CAIRO OR OPTION_CAIROEXT) AND NOT PKG_CAIRO_FOUND) - message(STATUS "*** Cairo was requested but not found - please install Cairo ...") - message(STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT") - message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers") -endif ((OPTION_CAIRO OR OPTION_CAIROEXT) AND NOT PKG_CAIRO_FOUND) - ####################################################################### option(OPTION_USE_NANOSVG "support SVG images" ON) From caea9c0c016715e91b42f0cdd6a3944ace5b511a Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 22 Dec 2018 08:56:33 -0600 Subject: [PATCH 06/34] Make .gitignore ignore CMake autogenerated files and also visual studio .vs directory --- .gitignore | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.gitignore b/.gitignore index 161934412..66922bd0a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,23 @@ *.o *.exe + +# CMake +bin/ +**/cmake_install.cmake +**/CMakeCache.txt +**/CMakeFiles/ +etc/UseFLTK.cmake +cmake_uninstall.cmake +UseFLTK.cmake +FLTK.sln +FLTK-Targets.cmake +FLTKConfig.cmake +etc/FLTKConfig.cmake + +# MSVC *.tlog +.vs/ # / /autom4te*.cache From 9338385da76a773f31fb9df363795eda7a2948be Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 22 Dec 2018 10:35:52 -0600 Subject: [PATCH 07/34] remove unnecessary double braces in option.cmake cairo detection code --- CMake/options.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMake/options.cmake b/CMake/options.cmake index c71eff1f4..c37bf7181 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -178,11 +178,11 @@ if (PKG_CAIRO_FOUND) set(FLTK_CAIRO_FOUND FALSE) endif (LIB_CAIRO AND OPTION_CAIROEXT) else () - if ((OPTION_CAIRO OR OPTION_CAIROEXT)) + if (OPTION_CAIRO OR OPTION_CAIROEXT) message(STATUS "*** Cairo was requested but not found - please check your cairo installation") message(STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.") message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers.") - endif ((OPTION_CAIRO OR OPTION_CAIROEXT)) + endif (OPTION_CAIRO OR OPTION_CAIROEXT) endif (PKG_CAIRO_FOUND) ####################################################################### From 65d90c33dc310a84feb4c550c5b1dcd1bedc7881 Mon Sep 17 00:00:00 2001 From: fabien Date: Sat, 22 Dec 2018 15:01:20 -0600 Subject: [PATCH 08/34] Removes few tabs from options.cmake. When removing tabs, also apply cmp standard (two spaces) recommended indentation. --- CMake/options.cmake | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/CMake/options.cmake b/CMake/options.cmake index c37bf7181..bc3aa7e69 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -143,8 +143,8 @@ if(DOXYGEN_FOUND) option(OPTION_BUILD_HTML_DOCUMENTATION "build html docs" OFF) option(OPTION_INSTALL_HTML_DOCUMENTATION "install html docs" OFF) if(LATEX_FOUND) - option(OPTION_BUILD_PDF_DOCUMENTATION "build pdf docs" OFF) - option(OPTION_INSTALL_PDF_DOCUMENTATION "install pdf docs" OFF) + option(OPTION_BUILD_PDF_DOCUMENTATION "build pdf docs" OFF) + option(OPTION_INSTALL_PDF_DOCUMENTATION "install pdf docs" OFF) endif(LATEX_FOUND) endif(DOXYGEN_FOUND) @@ -172,16 +172,16 @@ if (PKG_CAIRO_FOUND) string(REPLACE ";" " " CAIROFLAGS "${PKG_CAIRO_CFLAGS}") if (LIB_CAIRO AND OPTION_CAIROEXT) - set(FLTK_USE_CAIRO 1) - set(FLTK_CAIRO_FOUND TRUE) + set(FLTK_USE_CAIRO 1) + set(FLTK_CAIRO_FOUND TRUE) else () - set(FLTK_CAIRO_FOUND FALSE) + set(FLTK_CAIRO_FOUND FALSE) endif (LIB_CAIRO AND OPTION_CAIROEXT) else () if (OPTION_CAIRO OR OPTION_CAIROEXT) - message(STATUS "*** Cairo was requested but not found - please check your cairo installation") - message(STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.") - message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers.") + message(STATUS "*** Cairo was requested but not found - please check your cairo installation") + message(STATUS "*** or disable options OPTION_CAIRO and OPTION_CAIRO_EXT.") + message(FATAL_ERROR "*** Terminating: missing Cairo libs or headers.") endif (OPTION_CAIRO OR OPTION_CAIROEXT) endif (PKG_CAIRO_FOUND) @@ -462,20 +462,20 @@ endif (OPTION_USE_PANGO) ####################################################################### if(X11_Xft_FOUND AND OPTION_USE_PANGO) #this covers Debian, Ubuntu, FreeBSD, NetBSD, Darwin - if(APPLE AND OPTION_APPLE_X11) - list(APPEND CMAKE_INCLUDE_PATH /sw/include) - list(APPEND CMAKE_LIBRARY_PATH /sw/lib) - endif(APPLE AND OPTION_APPLE_X11) - find_file(HAVE_PANGO_H pango-1.0/pango/pango.h ${CMAKE_INCLUDE_PATH}) - find_file(HAVE_PANGOXFT_H pango-1.0/pango/pangoxft.h ${CMAKE_INCLUDE_PATH}) + if(APPLE AND OPTION_APPLE_X11) + list(APPEND CMAKE_INCLUDE_PATH /sw/include) + list(APPEND CMAKE_LIBRARY_PATH /sw/lib) + endif(APPLE AND OPTION_APPLE_X11) + find_file(HAVE_PANGO_H pango-1.0/pango/pango.h ${CMAKE_INCLUDE_PATH}) + find_file(HAVE_PANGOXFT_H pango-1.0/pango/pangoxft.h ${CMAKE_INCLUDE_PATH}) if(HAVE_PANGO_H AND HAVE_PANGOXFT_H) find_library(HAVE_LIB_PANGO pango-1.0 ${CMAKE_LIBRARY_PATH}) find_library(HAVE_LIB_PANGOXFT pangoxft-1.0 ${CMAKE_LIBRARY_PATH}) if(APPLE) - set(HAVE_LIB_GOBJECT TRUE) + set(HAVE_LIB_GOBJECT TRUE) else() - find_library(HAVE_LIB_GOBJECT gobject-2.0 ${CMAKE_LIBRARY_PATH}) + find_library(HAVE_LIB_GOBJECT gobject-2.0 ${CMAKE_LIBRARY_PATH}) endif(APPLE) endif(HAVE_PANGO_H AND HAVE_PANGOXFT_H) if(HAVE_LIB_PANGO AND HAVE_LIB_PANGOXFT AND HAVE_LIB_GOBJECT) @@ -559,7 +559,7 @@ endif(OPTION_FILESYSTEM_SUPPORT) # prior to CMake 3.0 this feature was buggy if(NOT CMAKE_VERSION VERSION_LESS 3.0.0) option(CMAKE_SUPPRESS_REGENERATION - "suppress rules to re-run CMake on rebuild" OFF) + "suppress rules to re-run CMake on rebuild" OFF) mark_as_advanced(CMAKE_SUPPRESS_REGENERATION) endif(NOT CMAKE_VERSION VERSION_LESS 3.0.0) From 550ba7e10580f6feb2679a706d380ace1a3be56d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Mon, 24 Dec 2018 00:03:45 +0100 Subject: [PATCH 09/34] Testing github 'commit' and 'push' by modifying obsolete documentation in the README files. --- README.OSX.txt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/README.OSX.txt b/README.OSX.txt index a074a57f8..ee8e01e3d 100644 --- a/README.OSX.txt +++ b/README.OSX.txt @@ -90,22 +90,6 @@ dev directory: If you got FLTK via Git then you need one extra step: build the configure script. Otherwise skip the following part marked ADVANCED: -ADVANCED: (only if you got FLTK via Git) -- The preferred procedure is to build the configure script using tools - called autoconf and automake. If these tools are not both available - on your system, this post - https://www.fltk.org/newsgroups.php?gfltk.coredev+v:15499 - details how to get them. - - Then, stay in your FLTK source-code directory and type the following: - - NOCONFIGURE=1 ./autogen.sh - -- Alternatively, copy the configure script from the last FLTK weekly snapshot - to your Git source-code directory. - -:END_ADVANCED - 2.3 Configuring FLTK ----------------------- From 5c7118f8d9a4a89742c33d411e5f207b9108b32e Mon Sep 17 00:00:00 2001 From: fabien Date: Tue, 25 Dec 2018 12:25:35 -0600 Subject: [PATCH 10/34] Add documentation on how to build Cairo in Linux Debian and derivatives. --- README.Cairo.txt | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.Cairo.txt b/README.Cairo.txt index 10ec3934c..3e94196ea 100644 --- a/README.Cairo.txt +++ b/README.Cairo.txt @@ -117,7 +117,20 @@ on the various supported operating systems. 3.1 Linux --------- - From Greg (erco@seriss.com): + 3.1.1 Debian and derivatives (like Ubuntu) + ----------------------------------------------------- + + Run from a terminal command line: + sudo apt install libcairo2-dev + + Then build fltk using the cairo additional option using: + cmake -G"Unix Makefiles" -DOPTION_CAIRO:BOOL=ON -S -B + cd + make + + 3.1.2 CentOS from Greg (erco@seriss.com) + --------------------------------------------------- + To get FLTK 1.3.x (r9204) to build on Centos 5.5, I found that I only needed to install the "cairo-devel" package, ie: From c361b64096c75a6d65d4234601c83ff381198eba Mon Sep 17 00:00:00 2001 From: fabien Date: Wed, 26 Dec 2018 16:19:25 -0600 Subject: [PATCH 11/34] Travis implementation allowing to build four targets on change of master or a matching pattern of feature/*. This implementation differs from existing fltk-test and also gitlab implementation : - minimum, fast light implementation: stripoped all unused constructions compared to other implementations - supports successful builds of four targets (linu, osx and then gcc and clang for each of them) - uses before_script instead of before_install - uses after_success for building documentation, instead of building always if error - only builds documentation on linux targets for now (can easily change if future) --- .travis.yml | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..981dcaea5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,53 @@ +sudo: required +dist: trusty +cache: ccache + +language: + - c++ +# - objective-c + +os: + - linux + - osx + +compiler: + - gcc + - clang + +branches: + only: + - master + - /^feature.*$/ + +before_script: + - | + if [ $TRAVIS_OS_NAME == linux ]; then + sudo apt-get update -q + sudo apt-get install -y libxinerama-dev libxcursor-dev libasound2-dev + sudo apt-get install -y doxygen + elif [ $TRAVIS_OS_NAME == osx ]; then + brew install ccache # need to install on OSX + export PATH="/usr/local/opt/ccache/libexec:$PATH" + brew install doxygen + fi + +script: + - | + autoconf + ./configure + make + +after_success: + - | + if [ $TRAVIS_OS_NAME == linux ]; then + doxygen --version + cd documentation + make html + cd - + fi + +notifications: + email: + recipients: + - fabien@onepost.net + From 75eefbcd42e7117de110f1d77e892912a24fc0a4 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 27 Dec 2018 13:05:35 +0100 Subject: [PATCH 12/34] Fixing some minor lint, found by Pavel Shlyak using PVS studio --- fluid/Fl_Group_Type.cxx | 48 +++++++++++++++++----------------------- fluid/Fl_Menu_Type.cxx | 20 ++++++++--------- src/Fl.cxx | 1 + src/Fl_Browser.cxx | 6 ++--- src/Fl_File_Chooser2.cxx | 4 ++-- src/Fl_Input_.cxx | 1 + src/Fl_Menu.cxx | 2 +- src/Fl_Text_Buffer.cxx | 2 +- 8 files changed, 39 insertions(+), 45 deletions(-) diff --git a/fluid/Fl_Group_Type.cxx b/fluid/Fl_Group_Type.cxx index 30c5007dd..6fa4cf867 100644 --- a/fluid/Fl_Group_Type.cxx +++ b/fluid/Fl_Group_Type.cxx @@ -337,30 +337,26 @@ void Fl_Table_Type::move_child(Fl_Type* cc, Fl_Type* before) { Fl_Widget *Fl_Group_Type::enter_live_mode(int) { Fl_Group *grp = new Fl_Group(o->x(), o->y(), o->w(), o->h()); live_widget = grp; - if (live_widget) { - copy_properties(); - Fl_Type *n; - for (n = next; n && n->level > level; n = n->next) { - if (n->level == level+1) - n->enter_live_mode(); - } - grp->end(); + copy_properties(); + Fl_Type *n; + for (n = next; n && n->level > level; n = n->next) { + if (n->level == level+1) + n->enter_live_mode(); } + grp->end(); return live_widget; } Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) { Fl_Tabs *grp = new Fl_Tabs(o->x(), o->y(), o->w(), o->h()); live_widget = grp; - if (live_widget) { - copy_properties(); - Fl_Type *n; - for (n = next; n && n->level > level; n = n->next) { - if (n->level == level+1) - n->enter_live_mode(); - } - grp->end(); + copy_properties(); + Fl_Type *n; + for (n = next; n && n->level > level; n = n->next) { + if (n->level == level+1) + n->enter_live_mode(); } + grp->end(); grp->value(((Fl_Tabs*)o)->value()); return live_widget; } @@ -368,10 +364,8 @@ Fl_Widget *Fl_Tabs_Type::enter_live_mode(int) { Fl_Widget *Fl_Table_Type::enter_live_mode(int) { Fl_Group *grp = new Fluid_Table(o->x(), o->y(), o->w(), o->h()); live_widget = grp; - if (live_widget) { - copy_properties(); - grp->end(); - } + copy_properties(); + grp->end(); return live_widget; } @@ -396,15 +390,13 @@ Fl_Widget *Fl_Scroll_Type::enter_live_mode(int) { Fl_Group *grp = new Fl_Scroll(o->x(), o->y(), o->w(), o->h()); grp->show(); live_widget = grp; - if (live_widget) { - copy_properties(); - Fl_Type *n; - for (n = next; n && n->level > level; n = n->next) { - if (n->level == level+1) - n->enter_live_mode(); - } - grp->end(); + copy_properties(); + Fl_Type *n; + for (n = next; n && n->level > level; n = n->next) { + if (n->level == level+1) + n->enter_live_mode(); } + grp->end(); return live_widget; } diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index 5e51a6ee2..e4c09be01 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -360,27 +360,27 @@ void Fl_Menu_Item_Type::write_code1() { } } - int init = 0; + int menuItemInitialized = 0; // if the name is an array variable, assign the value here if (name() && strchr(name(), '[')) { write_c("%s%s = &%s[%d];\n", indent(), name(), mname, i); } if (image) { - if (!init) { - init = 1; - write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i); - } + menuItemInitialized = 1; + write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i); image->write_code("o"); } - for (int n=0; n < NUM_EXTRA_CODE; n++) + for (int n=0; n < NUM_EXTRA_CODE; n++) { if (extra_code(n) && !isdeclare(extra_code(n))) { - if (!init) { - init = 1; - write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i); + if (!menuItemInitialized) { + menuItemInitialized = 1; + write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i); } write_c("%s %s\n", indent(), extra_code(n)); } - if (init) write_c("%s}\n",indent()); + } + if (menuItemInitialized) + write_c("%s}\n",indent()); } void Fl_Menu_Item_Type::write_code2() {} diff --git a/src/Fl.cxx b/src/Fl.cxx index b29b7a260..417a0acca 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1306,6 +1306,7 @@ int Fl::handle_(int e, Fl_Window* window) case FL_UNFOCUS: window = 0; + // FALLTHROUGH case FL_FOCUS: fl_xfocus = window; fl_fix_focus(); diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx index 7621c6598..196796b97 100644 --- a/src/Fl_Browser.cxx +++ b/src/Fl_Browser.cxx @@ -511,7 +511,7 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const { char* str = l->txt; const int* i = column_widths(); - bool first = true; // for icon + bool firstLoop = true; // for icon while (W > 6) { // do each tab-separated field int w1 = W; // width for this field char* e = 0; // pointer to end of field or null if none @@ -520,8 +520,8 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const { if (e) {*e = 0; w1 = *i++;} } // Icon drawing code - if (first) { - first = false; + if (firstLoop) { + firstLoop = false; if (l->icon) { l->icon->draw(X+2,Y+1); // leave 2px left, 1px above int iconw = l->icon->w()+2; diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx index 57226056d..426dbfd51 100644 --- a/src/Fl_File_Chooser2.cxx +++ b/src/Fl_File_Chooser2.cxx @@ -432,7 +432,8 @@ Fl_File_Chooser::count() { void Fl_File_Chooser::directory(const char *d)// I - Directory to change to { - char *dirptr; // Pointer into directory + char *dirptr; // Pointer into directory + char fixpath[FL_PATH_MAX]; // Path with slashes converted // printf("Fl_File_Chooser::directory(\"%s\")\n", d == NULL ? "(null)" : d); @@ -444,7 +445,6 @@ Fl_File_Chooser::directory(const char *d)// I - Directory to change to if (Fl::system_driver()->backslash_as_slash()) { // See if the filename contains backslashes... char *slash; // Pointer to slashes - char fixpath[FL_PATH_MAX]; // Path with slashes converted if (strchr(d, '\\')) { // Convert backslashes to slashes... strlcpy(fixpath, d, sizeof(fixpath)); diff --git a/src/Fl_Input_.cxx b/src/Fl_Input_.cxx index 1ffc3c402..ef6900d6e 100644 --- a/src/Fl_Input_.cxx +++ b/src/Fl_Input_.cxx @@ -1010,6 +1010,7 @@ int Fl_Input_::handletext(int event, int X, int Y, int W, int H) { if (!(damage()&FL_DAMAGE_EXPOSE)) {minimal_update(position_); erase_cursor_only = 1;} } else //if (Fl::selection_owner() != this) minimal_update(mark_, position_); + // FALLTHROUGH case FL_HIDE: fl_reset_spot(); if (!readonly() && (when() & FL_WHEN_RELEASE)) diff --git a/src/Fl_Menu.cxx b/src/Fl_Menu.cxx index b51b4e040..3ab303dea 100644 --- a/src/Fl_Menu.cxx +++ b/src/Fl_Menu.cxx @@ -533,7 +533,7 @@ int menuwindow::find_selected(int mx, int my) { if (my < 0 || my >= h()) return -1; if (!itemheight) { // menubar int xx = 3; int n = 0; - const Fl_Menu_Item* m = menu ? menu->first() : 0; + const Fl_Menu_Item* m = menu->first(); for (; ; m = m->next(), n++) { if (!m->text) return -1; xx += m->measure(0, button) + 16; diff --git a/src/Fl_Text_Buffer.cxx b/src/Fl_Text_Buffer.cxx index 6b46dd497..8df527b1b 100644 --- a/src/Fl_Text_Buffer.cxx +++ b/src/Fl_Text_Buffer.cxx @@ -1248,7 +1248,7 @@ void Fl_Text_Buffer::remove_(int start, int end) /* expand the gap to encompass the deleted characters */ mGapEnd += end - mGapStart; - mGapStart -= mGapStart - start; + mGapStart = start; /* update the length */ mLength -= end - start; From 9141399a3b1a0647f5ffd711d24d734857603dc3 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 27 Dec 2018 15:29:13 +0100 Subject: [PATCH 13/34] Started to rewrite README.OSX.txt as README.macOS.md . Also testing GitHub quirks --- README.OSX.txt => README.macOS.md | 61 +++++++++++++------------------ 1 file changed, 25 insertions(+), 36 deletions(-) rename README.OSX.txt => README.macOS.md (93%) diff --git a/README.OSX.txt b/README.macOS.md similarity index 93% rename from README.OSX.txt rename to README.macOS.md index ee8e01e3d..9e13d7233 100644 --- a/README.OSX.txt +++ b/README.macOS.md @@ -1,40 +1,29 @@ -README.OSX.txt - Building FLTK under Apple macOS -------------------------------------------------- +_README.macOS.md - Building FLTK under Apple macOS_ - - - CONTENTS -========== - - 1 INTRODUCTION - 2 HOW TO BUILD FLTK USING GCC - 2.1 Prerequisites - 2.2 Downloading and Unpacking - 2.3 Configuring FLTK - 2.4 Building FLTK - 2.5 Testing FLTK - 2.6 Installing FLTK - 2.7 Creating new Projects - 3 HOW TO BUILD FLTK USING XCODE3 - 3.1 Prerequisites - 3.2 Downloading and Unpacking - 3.3 Configuring FLTK - 3.4 Building FLTK - 3.5 Testing FLTK - 3.6 Uninstalling previous versions of FLTK - 3.7 Installing FLTK - 3.8 Installing Little Helpers - 3.9 Creating new Projects - 4 HOW TO BUILD FLTK USING XCODE4 - 4.1 Prerequisites - 4.2 Downloading and Unpacking - 4.3 Configuring FLTK - 4.4 Building FLTK - 4.5 Testing FLTK - 4.6 Uninstalling previous versions of FLTK - 4.7 Installing FLTK - 5 MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON - 6 DOCUMENT HISTORY +CONTENTS +======== +1. INTRODUCTION +2. HOW TO BUILD FLTK USING _autoconf_ AND _make_ + 1. Prerequisites + 2. Downloading and Unpacking + 3. Configuring FLTK + 4. Building FLTK + 5. Testing FLTK + 6. Installing FLTK + 7. Creating new Projects +3. HOW TO BUILD FLTK USING _CMake_ AND _Xcode_ + 1. Prerequisites + 2. Downloading and Unpacking + 3. Configuring FLTK + 4. Building FLTK + 5. Testing FLTK + 6. Uninstalling previous versions of FLTK + 7. Installing FLTK + 8. Installing Little Helpers + 9. Creating new Projects +4. HOW TO BUILD FLTK USING _CMake_ AND _make_ +5. MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON +6. DOCUMENT HISTORY 1 INTRODUCTION From 148acf9e6698d5413937795b7085ca3d2f524e0c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 27 Dec 2018 15:32:50 +0100 Subject: [PATCH 14/34] Markup mess --- README.macOS.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index 9e13d7233..7b138f54e 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -4,13 +4,13 @@ CONTENTS ======== 1. INTRODUCTION 2. HOW TO BUILD FLTK USING _autoconf_ AND _make_ - 1. Prerequisites - 2. Downloading and Unpacking - 3. Configuring FLTK - 4. Building FLTK - 5. Testing FLTK - 6. Installing FLTK - 7. Creating new Projects + 2.1. Prerequisites + 2.2. Downloading and Unpacking + 2.3. Configuring FLTK + 2.4. Building FLTK + 2.5. Testing FLTK + 2.6. Installing FLTK + 2.7. Creating new Projects 3. HOW TO BUILD FLTK USING _CMake_ AND _Xcode_ 1. Prerequisites 2. Downloading and Unpacking From 62ff8695a0e39f9c0bfd7389aa966d5dced81fbb Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Thu, 27 Dec 2018 16:10:35 +0100 Subject: [PATCH 15/34] Testing some styles for markdown file. --- README.macOS.md | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index 7b138f54e..8dd9d7b40 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -1,10 +1,12 @@ _README.macOS.md - Building FLTK under Apple macOS_ -CONTENTS -======== -1. INTRODUCTION -2. HOW TO BUILD FLTK USING _autoconf_ AND _make_ - 2.1. Prerequisites + +## Contents + +* [Contents](#contents) +* [Introduction](#introduction) +* [How to Build FLTK Using _autoconf_ And _make_](#build_autoconf_make) + * [Prerequisites](#bam_prerequisites) 2.2. Downloading and Unpacking 2.3. Configuring FLTK 2.4. Building FLTK @@ -25,29 +27,26 @@ CONTENTS 5. MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON 6. DOCUMENT HISTORY - - 1 INTRODUCTION -================= + +## INTRODUCTION FLTK supports all macOS versions above 10.3 (Panther). See below for how to build FLTK applications that can run on all (old or recent) macOS versions. -FLTK currently supports the following development environments on the macOS +FLTK 1.4 supports the following build environments on the macOS platform: - - gcc command line tools - - Xcode 3.x and higher +- _autoconf_ and _make_ from the command line +- _cmake_ and _make_ from the command line +- _cmake_ and _Xcode_ -CAUTION: gcc command line built libraries and Xcode created Frameworks should -not be mixed! +All environments will generate Unix style static libraries and macOS style app bundles. + +## How to Build FLTK Using _autoconf_ And _make_ - 2 HOW TO BUILD FLTK USING GCC -================================ - - - 2.1 Prerequisites --------------------- + +### Prerequisites In order to build FLTK from the command line, you need to install the Xcode developer environment. It can be downloaded from the Apple Store for free. @@ -69,12 +68,14 @@ you will find the Git access parameters at the bottom of that page. Unpack FLTK into a convenient location. I like to have everything in my dev directory: - cd - mkdir dev - cd dev - mv ~/Downloads/fltk-1.3.xxxx.tar.gz . - tar xvfz fltk-1.3.xxxx.tar.gz - cd fltk-1.3.xxxx +```bash +cd +mkdir dev +cd dev +mv ~/Downloads/fltk-1.3.xxxx.tar.gz . +tar xvfz fltk-1.3.xxxx.tar.gz +cd fltk-1.3.xxxx +``` If you got FLTK via Git then you need one extra step: build the configure script. Otherwise skip the following part marked ADVANCED: From 8c44c9a6b15b077f418269465bf88420d2d2f043 Mon Sep 17 00:00:00 2001 From: fab672000 Date: Thu, 27 Dec 2018 21:47:23 -0600 Subject: [PATCH 16/34] As requested implement cmake builds and also implement matrix customization to use a static analyzer and also doc gen in only one target to avoid having too many targets --- .travis.yml | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 981dcaea5..9d8a45160 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,17 @@ compiler: - gcc - clang +env: + - | + ANALYZE=false + DOC=false + +matrix: + include: + os: linux + compiler: clang + env: ANALYZE=true DOC=true + branches: only: - master @@ -33,13 +44,23 @@ before_script: script: - | - autoconf - ./configure - make + if [ $ANALYZE = "false" ]; then + autoconf + ./configure + make + mkdir cmake-build + cmake -G "Unix Makefiles" -S . -B"./cmake-build" + cd cmake-build + make + else + scan-build cmake -G "Unix Makefiles" + scan-build --status-bugs -v + make + fi after_success: - | - if [ $TRAVIS_OS_NAME == linux ]; then + if [ $DOC = "true" ]; then doxygen --version cd documentation make html @@ -50,4 +71,4 @@ notifications: email: recipients: - fabien@onepost.net - + \ No newline at end of file From f2ddd52f768b8a69e18559f50ee2443e97a5d35d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 15:07:07 +0100 Subject: [PATCH 17/34] Completed README for macOS command line builds. Must still be verified on a clean machine. --- README.macOS.md | 160 ++++++++++++++++++++++++++---------------------- 1 file changed, 87 insertions(+), 73 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index 8dd9d7b40..db5f44c6a 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -5,14 +5,14 @@ _README.macOS.md - Building FLTK under Apple macOS_ * [Contents](#contents) * [Introduction](#introduction) -* [How to Build FLTK Using _autoconf_ And _make_](#build_autoconf_make) +* [How to Build FLTK Using _autoconf_ and _make_](#build_autoconf_make) * [Prerequisites](#bam_prerequisites) - 2.2. Downloading and Unpacking - 2.3. Configuring FLTK - 2.4. Building FLTK - 2.5. Testing FLTK - 2.6. Installing FLTK - 2.7. Creating new Projects + * [Downloading FLTK and Unpacking](#bam_download) + * [Configuring FLTK](#bam_config) + * [Building FLTK](#bam_build) + * [Testing FLTK](#bam_test) + * [Installing FLTK](#bam_install) + * [Creating new Projects](#bam_new_projects) 3. HOW TO BUILD FLTK USING _CMake_ AND _Xcode_ 1. Prerequisites 2. Downloading and Unpacking @@ -43,119 +43,133 @@ platform: All environments will generate Unix style static libraries and macOS style app bundles. -## How to Build FLTK Using _autoconf_ And _make_ +## How to Build FLTK Using _autoconf_ and _make_ + +This option is best for users who like to develop their apps without using Apple's Xcode IDE. +Users should be comfortable with using `bash` or `tcsh` in a terminal window. ### Prerequisites -In order to build FLTK from the command line, you need to install the Xcode -developer environment. It can be downloaded from the Apple Store for free. +In order to build FLTK from the command line, you need to install a C++ compiler +environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, +even if you don't plan to use it as your iDE. -After downloading and installing, you need to launch the Terminal. Terminal.app -is located in the "Utilities" folder inside the "Applications" folder. I like -to keep the Terminal in the Dock. +_Xcode_ can be downloaded via the +[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). +After downloading and installing, you need to launch the Terminal. _Terminal.app_ +is located in the _Utilities_ folder inside the _Applications_ folder. I like +to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click +on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). - 2.2 Downloading and Unpacking --------------------------------- + +### Downloading and Unpacking -Download FLTK from here: +FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub. +You will need to clone the repository to check out the source code onto your machine. This +has the great benefit that the source code can be updated simly by telling _git_ to _pull_ +the newest release. - https://www.fltk.org/software.php - -If you are familiar with Git and like to stay current with your version, -you will find the Git access parameters at the bottom of that page. -Unpack FLTK into a convenient location. I like to have everything in my -dev directory: +Start your terminal. If you have not set up a developer directory yet, I recomment to use +`~/dev` and put all your projects there: ```bash -cd +# make sure we are in the home directory +cd ~ +# create our developer directory and go there mkdir dev cd dev -mv ~/Downloads/fltk-1.3.xxxx.tar.gz . -tar xvfz fltk-1.3.xxxx.tar.gz -cd fltk-1.3.xxxx -``` +``` +Now create a copy of the current source code locally: -If you got FLTK via Git then you need one extra step: build the -configure script. Otherwise skip the following part marked ADVANCED: +```bash +git clone https://github.com/fltk/fltk.git fltk-1.4.git +cd fltk-1.4.git +``` + +### Configuring FLTK - 2.3 Configuring FLTK ------------------------ +Using you shell in the terminal, make sure that you are in the root directory of your +FLTK source code tree. +If you are configuring fltk for the first time, you need to instruct FLTK to create some +very basic configuration files. Type: + +```bash +NOCONFIGURE=1 ./autogen.sh +``` +This script may generate a few error messages which you can sefely ignore. Now configure your FLTK installation: stay in your FLTK source-code directory and type - ./configure +```bash +./configure +``` -ADVANCED: type "./configure --help" to get a complete list of optional -configurations parameters. These should be pretty self-explanatory. Some -more details can be found in README. +The configuration script runs a number of tests to find libraries and tools. The configuration +summary should not show any errors. You can now continue to build FLTK. -To create multi-architecture binaries, start "configure" with these flags: - ./configure --with-archflags="-arch i386 -arch x86_64" +For the advanced user, there are a few more optinons to the _configure_ script. Type +`./configure --help` to get a complete list of options. These should be pretty +self-explanatory. Some more details can be found in +[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). -To create applications that can run under macOS 10.4 and above, use these flags: - ./configure CXXFLAGS="-mmacosx-version-min=10.4" LDFLAGS="-mmacosx-version-min=10.4" + +### Building FLTK -:END_ADVANCED +Now this is easy if all the previous steps were successful. Stay in your FLTK source-code +directory and type: -The configuration script will check your machine for the required resources -which should all have been part of your Xcode installation. Review the -Configuration Summary, maybe take some notes. - - - 2.4 Building FLTK --------------------- - -Now this is easy. Stay in your FLTK source-code directory and type: - - make +```bash +make +``` The entire FLTK toolkit including many test programs will be built for you. No warnings should appear, but "ranlib" may complain about a few modules having no symbols. This is normal and can safely be ignored. + +### Testing FLTK - 2.5 Testing FLTK -------------------- +After a successful build, you can test FLTK's capabilities by running -After a successful build, you can test FLTK's capabilities: +```bash +test/demo +``` - test/demo - - - 2.6 Installing FLTK ----------------------- + +### Installing FLTK If you did not change any of the configuration settings, FLTK will be installed -in "/usr/local/include" and "/usr/local/lib" by typing +in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing - sudo make install +```bash +sudo make install +``` It is possible to install FLTK without superuser privileges by changing the installation path to a location within the user account by adding the -"--prefix=PREFIX" parameter to the "./configure" command. +`--prefix=PREFIX` parameter to the `./configure` command. + +### Creating new Projects - 2.7 Creating new Projects ----------------------------- - -FLTK provides a neat script named "fltk-config" that can provide all the flags +FLTK provides a neat script named `fltk-config` that can provide all the flags needed to build FLTK applications using the same flags that were used to build -the library itself. Architecture flags (e.g., -arch i386) used to build the -library, though, are not provided by the fltk-config script. This allows to -build universal libraries and to produce applications of any architecture -from them. Running "fltk-config" without arguments will print a list +the library itself. Running `fltk-config` without arguments will print a list of options. The easiest call to compile an FLTK application from a single source file is: - fltk-config --compile myProgram.cxx +```bash +fltk-config --compile myProgram.cxx +``` -"fltk-config" and "fluid" will be installed in "/usr/local/bin/" by default. I -recommend that you add it to the command search path. +`fltk-config` and our user interface designer `fluid` will be installed in +`/usr/local/bin/` by default. I recommend that you add this directory to the shell +`PATH` variable. From 9894117fa64e474329e06fedc5a6592ffaba5b8d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 15:35:51 +0100 Subject: [PATCH 18/34] Putting the 'Contents' together for the macOS README. --- README.macOS.md | 336 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 306 insertions(+), 30 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index db5f44c6a..ac80fba3d 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -1,10 +1,30 @@ _README.macOS.md - Building FLTK under Apple macOS_ + ## Contents * [Contents](#contents) * [Introduction](#introduction) + +* [How to Build FLTK using _CMake_ AND _Xcode_](#build_cmake_xcode) + * [Prerequisites](#bcx_prerequisites) + * [Downloading FLTK and Unpacking](#bcx_download) + * [Configuring FLTK](#bcx_config) + * [Building FLTK](#bcx_build) + * [Testing FLTK](#bcx_test) + * [Installing FLTK](#bcx_install) + * [Creating new Projects](#bcx_new_projects) + +* [How to Build FLTK using _CMake_ AND _make_](#build_cmake_make) + * [Prerequisites](#bcm_prerequisites) + * [Downloading FLTK and Unpacking](#bcm_download) + * [Configuring FLTK](#bcm_config) + * [Building FLTK](#bcm_build) + * [Testing FLTK](#bcm_test) + * [Installing FLTK](#bcm_install) + * [Creating new Projects](#bcm_new_projects) + * [How to Build FLTK Using _autoconf_ and _make_](#build_autoconf_make) * [Prerequisites](#bam_prerequisites) * [Downloading FLTK and Unpacking](#bam_download) @@ -13,19 +33,10 @@ _README.macOS.md - Building FLTK under Apple macOS_ * [Testing FLTK](#bam_test) * [Installing FLTK](#bam_install) * [Creating new Projects](#bam_new_projects) -3. HOW TO BUILD FLTK USING _CMake_ AND _Xcode_ - 1. Prerequisites - 2. Downloading and Unpacking - 3. Configuring FLTK - 4. Building FLTK - 5. Testing FLTK - 6. Uninstalling previous versions of FLTK - 7. Installing FLTK - 8. Installing Little Helpers - 9. Creating new Projects -4. HOW TO BUILD FLTK USING _CMake_ AND _make_ -5. MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON -6. DOCUMENT HISTORY + +* [Make an Application Launchable by Dropping Files on its Icon](#dropstart) +* [Document History](#doc_history) + ## INTRODUCTION @@ -42,6 +53,267 @@ platform: All environments will generate Unix style static libraries and macOS style app bundles. + + +## How to Build FLTK Using _CMake_ and _Xcode_ + +TODO: This option is best for users who like to develop their apps without using Apple's Xcode IDE. +Users should be comfortable with using `bash` or `tcsh` in a terminal window. + + +### Prerequisites (CMake, Xcode) + +In order to build FLTK from the command line, you need to install a C++ compiler +environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, +even if you don't plan to use it as your iDE. + +_Xcode_ can be downloaded via the +[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). + +After downloading and installing, you need to launch the Terminal. _Terminal.app_ +is located in the _Utilities_ folder inside the _Applications_ folder. I like +to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click +on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). + + +### Downloading and Unpacking (CMake, Xcode) + +FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub. +You will need to clone the repository to check out the source code onto your machine. This +has the great benefit that the source code can be updated later simply by telling _git_ to +_pull_ the newest release. + +Start your terminal. If you have not set up a developer directory yet, I recomment to use +`~/dev` and put all your projects there: + +```bash +# make sure we are in the home directory +cd ~ +# create our developer directory and go there +mkdir dev +cd dev +``` +Now create a copy of the source code archive at Github on your local file system: + +```bash +git clone https://github.com/fltk/fltk.git fltk-1.4.git +cd fltk-1.4.git +``` + + +### Configuring FLTK (CMake, Xcode) + +Using you shell in the terminal, make sure that you are in the root directory of your +FLTK source code tree. + +If you are configuring fltk for the first time, you need to instruct FLTK to create some +very basic configuration files. Type: + +```bash +NOCONFIGURE=1 ./autogen.sh +``` +This script may generate a few error messages which you can sefely ignore. + +Now configure your FLTK installation. Stay in your FLTK source-code directory +and type + +```bash +./configure +``` + +The configuration script runs a number of tests to find external headers, libraries, and tools. +The configuration summary should not show any errors. You can now continue to build FLTK. + +For the advanced user, there are a few more optinons to the _configure_ script. Type +`./configure --help` to get a complete list of options. These should be pretty +self-explanatory. Some more details can be found in +[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). + + +### Building FLTK (CMake, Xcode) + +Now this is easy if all the previous steps were successful. Stay in your FLTK source-code +directory and type: + +```bash +make +``` + +The entire FLTK toolkit including many test programs will be built for you. No +warnings should appear, but "ranlib" may complain about a few modules having no +symbols. This is normal and can safely be ignored. + + +### Testing FLTK (CMake, Xcode) + +After a successful build, you can test FLTK's capabilities by running + +```bash +test/demo +``` + + +### Installing FLTK (CMake, Xcode) + +If you did not change any of the configuration settings, FLTK will be installed +in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing + +```bash +sudo make install +``` + +It is possible to install FLTK without superuser privileges by changing the +installation path to a location within the user account by adding the +`--prefix=PREFIX` parameter to the `./configure` command. + + +### Creating new Projects (CMake, Xcode) + +FLTK provides a neat script named `fltk-config` that can provide all the flags +needed to build FLTK applications using the same flags that were used to build +the library itself. Running `fltk-config` without arguments will print a list +of options. The easiest call to compile an FLTK application from a single source +file is: + +```bash +fltk-config --compile myProgram.cxx +``` + +`fltk-config` and our user interface designer `fluid` will be installed in +`/usr/local/bin/` by default. I recommend that you add this directory to the shell +`PATH` variable. + + + +## How to Build FLTK Using _CMake_ and _make_ + +This option is best for users who like to develop their apps without using Apple's Xcode IDE. +Users should be comfortable with using `bash` or `tcsh` in a terminal window. + + +### Prerequisites (CMake, make) + +In order to build FLTK from the command line, you need to install a C++ compiler +environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, +even if you don't plan to use it as your iDE. + +_Xcode_ can be downloaded via the +[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). + +After downloading and installing, you need to launch the Terminal. _Terminal.app_ +is located in the _Utilities_ folder inside the _Applications_ folder. I like +to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click +on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). + + +### Downloading and Unpacking (CMake, make) + +FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub. +You will need to clone the repository to check out the source code onto your machine. This +has the great benefit that the source code can be updated later simply by telling _git_ to +_pull_ the newest release. + +Start your terminal. If you have not set up a developer directory yet, I recomment to use +`~/dev` and put all your projects there: + +```bash +# make sure we are in the home directory +cd ~ +# create our developer directory and go there +mkdir dev +cd dev +``` +Now create a copy of the source code archive at Github on your local file system: + +```bash +git clone https://github.com/fltk/fltk.git fltk-1.4.git +cd fltk-1.4.git +``` + + +### Configuring FLTK (CMake, make) + +Using you shell in the terminal, make sure that you are in the root directory of your +FLTK source code tree. + +If you are configuring fltk for the first time, you need to instruct FLTK to create some +very basic configuration files. Type: + +```bash +NOCONFIGURE=1 ./autogen.sh +``` +This script may generate a few error messages which you can sefely ignore. + +Now configure your FLTK installation. Stay in your FLTK source-code directory +and type + +```bash +./configure +``` + +The configuration script runs a number of tests to find external headers, libraries, and tools. +The configuration summary should not show any errors. You can now continue to build FLTK. + +For the advanced user, there are a few more optinons to the _configure_ script. Type +`./configure --help` to get a complete list of options. These should be pretty +self-explanatory. Some more details can be found in +[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). + + +### Building FLTK (CMake, make) + +Now this is easy if all the previous steps were successful. Stay in your FLTK source-code +directory and type: + +```bash +make +``` + +The entire FLTK toolkit including many test programs will be built for you. No +warnings should appear, but "ranlib" may complain about a few modules having no +symbols. This is normal and can safely be ignored. + + +### Testing FLTK (CMake, make) + +After a successful build, you can test FLTK's capabilities by running + +```bash +test/demo +``` + + +### Installing FLTK (CMake, make) + +If you did not change any of the configuration settings, FLTK will be installed +in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing + +```bash +sudo make install +``` + +It is possible to install FLTK without superuser privileges by changing the +installation path to a location within the user account by adding the +`--prefix=PREFIX` parameter to the `./configure` command. + + +### Creating new Projects (CMake, make) + +FLTK provides a neat script named `fltk-config` that can provide all the flags +needed to build FLTK applications using the same flags that were used to build +the library itself. Running `fltk-config` without arguments will print a list +of options. The easiest call to compile an FLTK application from a single source +file is: + +```bash +fltk-config --compile myProgram.cxx +``` + +`fltk-config` and our user interface designer `fluid` will be installed in +`/usr/local/bin/` by default. I recommend that you add this directory to the shell +`PATH` variable. + + ## How to Build FLTK Using _autoconf_ and _make_ @@ -49,7 +321,7 @@ This option is best for users who like to develop their apps without using Apple Users should be comfortable with using `bash` or `tcsh` in a terminal window. -### Prerequisites +### Prerequisites (autoconf. make) In order to build FLTK from the command line, you need to install a C++ compiler environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, @@ -68,8 +340,8 @@ on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub. You will need to clone the repository to check out the source code onto your machine. This -has the great benefit that the source code can be updated simly by telling _git_ to _pull_ -the newest release. +has the great benefit that the source code can be updated later simply by telling _git_ to +_pull_ the newest release. Start your terminal. If you have not set up a developer directory yet, I recomment to use `~/dev` and put all your projects there: @@ -81,15 +353,15 @@ cd ~ mkdir dev cd dev ``` -Now create a copy of the current source code locally: +Now create a copy of the source code archive at Github on your local file system: ```bash git clone https://github.com/fltk/fltk.git fltk-1.4.git cd fltk-1.4.git ``` - -### Configuring FLTK + +### Configuring FLTK (autoconf. make) Using you shell in the terminal, make sure that you are in the root directory of your FLTK source code tree. @@ -102,15 +374,15 @@ NOCONFIGURE=1 ./autogen.sh ``` This script may generate a few error messages which you can sefely ignore. -Now configure your FLTK installation: stay in your FLTK source-code directory +Now configure your FLTK installation. Stay in your FLTK source-code directory and type ```bash ./configure ``` -The configuration script runs a number of tests to find libraries and tools. The configuration -summary should not show any errors. You can now continue to build FLTK. +The configuration script runs a number of tests to find external headers, libraries, and tools. +The configuration summary should not show any errors. You can now continue to build FLTK. For the advanced user, there are a few more optinons to the _configure_ script. Type `./configure --help` to get a complete list of options. These should be pretty @@ -118,7 +390,7 @@ self-explanatory. Some more details can be found in [online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). -### Building FLTK +### Building FLTK (autoconf. make) Now this is easy if all the previous steps were successful. Stay in your FLTK source-code directory and type: @@ -132,7 +404,7 @@ warnings should appear, but "ranlib" may complain about a few modules having no symbols. This is normal and can safely be ignored. -### Testing FLTK +### Testing FLTK (autoconf. make) After a successful build, you can test FLTK's capabilities by running @@ -141,7 +413,7 @@ test/demo ``` -### Installing FLTK +### Installing FLTK (autoconf. make) If you did not change any of the configuration settings, FLTK will be installed in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing @@ -155,7 +427,7 @@ installation path to a location within the user account by adding the `--prefix=PREFIX` parameter to the `./configure` command. -### Creating new Projects +### Creating new Projects (autoconf. make) FLTK provides a neat script named `fltk-config` that can provide all the flags needed to build FLTK applications using the same flags that were used to build @@ -430,9 +702,11 @@ tools: (TODO: 4.9 Creating new Projects) + +### Make an Application Launchable by Dropping Files on its Icon + +TODO: update for FLTK 1.4 - 5 MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON -================================================================= - Prepare an Info.plist file for your application derived from file test/editor-Info.plist which allows any file to be dropped on the application icon. @@ -450,8 +724,8 @@ to the Info.plist file you have prepared. - Rebuild your application. - 6 DOCUMENT HISTORY -===================== + +## DOCUMENT HISTORY Oct 29 2010 - matt: removed warnings Oct 24 2010 - matt: restructured entire document and verified instructions @@ -464,3 +738,5 @@ Apr 28 2014 - Manolo: how to build programs that run on various Mac OS X version Mar 18 2015 - Manolo: removed uses of the Xcode3 project Apr 01 2016 - AlbrechtS: corrected typo, formatted most line breaks < 80 columns Dec 04 2018 - AlbrechtS: fix typo (lowercase fluid.app) for case sensitive macOS +Dec 28 2018 - Matt: complete rework for FLTK 1.4 + From 763248a3ed91485c678ff3bf981f74d0f4524815 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 16:06:59 +0100 Subject: [PATCH 19/34] Easy way to install command line clang and git. --- README.macOS.md | 63 +++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 25 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index ac80fba3d..f60ff2f6e 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -16,7 +16,7 @@ _README.macOS.md - Building FLTK under Apple macOS_ * [Installing FLTK](#bcx_install) * [Creating new Projects](#bcx_new_projects) -* [How to Build FLTK using _CMake_ AND _make_](#build_cmake_make) +* [How to Build FLTK using _CMake_ and _make_](#build_cmake_make) * [Prerequisites](#bcm_prerequisites) * [Downloading FLTK and Unpacking](#bcm_download) * [Configuring FLTK](#bcm_config) @@ -39,17 +39,17 @@ _README.macOS.md - Building FLTK under Apple macOS_ -## INTRODUCTION +## Introduction -FLTK supports all macOS versions above 10.3 (Panther). See below for how to -build FLTK applications that can run on all (old or recent) macOS versions. +FLTK supports macOS version 10.3 Panther and above. At the time of writing (Jan. 2019), +FLTK compiles and runs fine on the most recent macOS 10.14 Mojave. FLTK 1.4 supports the following build environments on the macOS platform: -- _autoconf_ and _make_ from the command line -- _cmake_ and _make_ from the command line -- _cmake_ and _Xcode_ +* [_cmake_ and _Xcode_](#build_cmake_xcode), no shell needed +* [_cmake_ and _make_](#build_cmake_make) from the command line +* [_autoconf_ and _make_](#build_autoconf_make) from the command line All environments will generate Unix style static libraries and macOS style app bundles. @@ -57,24 +57,24 @@ All environments will generate Unix style static libraries and macOS style app b ## How to Build FLTK Using _CMake_ and _Xcode_ -TODO: This option is best for users who like to develop their apps without using Apple's Xcode IDE. -Users should be comfortable with using `bash` or `tcsh` in a terminal window. +This option is best for users who like to develop their apps using Apple's Xcode IDE. There +is no need to ever use a command line shell in this configuration. ### Prerequisites (CMake, Xcode) -In order to build FLTK from the command line, you need to install a C++ compiler -environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, -even if you don't plan to use it as your iDE. +In order to build FLTK, you need to install _CMake_ and _Xcode_. + +"CMake is used to control the software compilation process using simple platform and +compiler independent configuration files, and generate native makefiles and workspaces +that can be used in the compiler environment of your choice." + +Please download and install the Mac OS X version of _CMake_ from +[www.cmake.org](https://cmake.org/download/). _Xcode_ can be downloaded via the [App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). -After downloading and installing, you need to launch the Terminal. _Terminal.app_ -is located in the _Utilities_ folder inside the _Applications_ folder. I like -to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click -on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). - ### Downloading and Unpacking (CMake, Xcode) @@ -324,17 +324,30 @@ Users should be comfortable with using `bash` or `tcsh` in a terminal window. ### Prerequisites (autoconf. make) In order to build FLTK from the command line, you need to install a C++ compiler -environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, -even if you don't plan to use it as your iDE. +environment, `make` and `autoconf`. Installing the _Xcode_ command line tools is the easiest +way to get all prerequisites in one simple step. -_Xcode_ can be downloaded via the -[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). - -After downloading and installing, you need to launch the Terminal. _Terminal.app_ -is located in the _Utilities_ folder inside the _Applications_ folder. I like -to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click +Launch _Terminal.app_. It is located in the _Utilities_ folder inside the _Applications_ folder. +I like to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). +See if we already have a current C++ compiler installed. Type + +```bash +clang +``` + +If the command line tools are already available, the response will be +`clang: error: no input files`, and you are done. Continue with downloading FLTK. + +If the command line tools were not installed yet, a dialog box will pop up, claiimig "_The +clang command requires the command line developer tools. Would you like to install +the tools now?_". Simply click on _Install_ and wait for the tools to be installed. + +On older versions of macOS, you will have to install _Xcode_ from the +[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12) +and then install the command line tools from within _Xcode_. + ### Downloading and Unpacking From f4a0349013934752b6aa0a61e86bfc63372168f3 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 16:36:11 +0100 Subject: [PATCH 20/34] Tested macOS instruction with fresh macOS Mojave install --- README.macOS.md | 64 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index f60ff2f6e..bf8696373 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -321,13 +321,13 @@ This option is best for users who like to develop their apps without using Apple Users should be comfortable with using `bash` or `tcsh` in a terminal window. -### Prerequisites (autoconf. make) +### Prerequisites (autoconf, make) In order to build FLTK from the command line, you need to install a C++ compiler environment, `make` and `autoconf`. Installing the _Xcode_ command line tools is the easiest way to get all prerequisites in one simple step. -Launch _Terminal.app_. It is located in the _Utilities_ folder inside the _Applications_ folder. +Launch _Terminal.app_ by pressing Command+Spacebar and typing `Terminal` and pressing _return_. I like to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). @@ -348,8 +348,21 @@ On older versions of macOS, you will have to install _Xcode_ from the [App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12) and then install the command line tools from within _Xcode_. +Apple no longer includes _autoconf_. To installe _autoconf_, we first need to installe _brew_ +by typing this rather cryptic command in the shell: + +```bash +ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +``` + +After a few minutes, we can now build and install all other tools from one simple command: + +```bash +brew install autoconf automake +``` + -### Downloading and Unpacking +### Downloading and Unpacking (autoconf, make) FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub. You will need to clone the repository to check out the source code onto your machine. This @@ -374,7 +387,7 @@ cd fltk-1.4.git ``` -### Configuring FLTK (autoconf. make) +### Configuring FLTK (autoconf, make) Using you shell in the terminal, make sure that you are in the root directory of your FLTK source code tree. @@ -403,7 +416,7 @@ self-explanatory. Some more details can be found in [online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). -### Building FLTK (autoconf. make) +### Building FLTK (autoconf, make) Now this is easy if all the previous steps were successful. Stay in your FLTK source-code directory and type: @@ -417,7 +430,7 @@ warnings should appear, but "ranlib" may complain about a few modules having no symbols. This is normal and can safely be ignored. -### Testing FLTK (autoconf. make) +### Testing FLTK (autoconf, make) After a successful build, you can test FLTK's capabilities by running @@ -426,7 +439,7 @@ test/demo ``` -### Installing FLTK (autoconf. make) +### Installing FLTK (autoconf, make) If you did not change any of the configuration settings, FLTK will be installed in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing @@ -440,7 +453,7 @@ installation path to a location within the user account by adding the `--prefix=PREFIX` parameter to the `./configure` command. -### Creating new Projects (autoconf. make) +### Creating new Projects (autoconf, make) FLTK provides a neat script named `fltk-config` that can provide all the flags needed to build FLTK applications using the same flags that were used to build @@ -449,7 +462,16 @@ of options. The easiest call to compile an FLTK application from a single source file is: ```bash -fltk-config --compile myProgram.cxx +cat << EOF > main.cxx + #include + int main(int argc, char **argv) { + Fl_Window *win = new Fl_Window(600, 400, "Hello, world!"); + win->show(argc, argv); + return Fl::run(); + } +EOF +fltk-config --compile main.cxx +./main ``` `fltk-config` and our user interface designer `fluid` will be installed in @@ -740,16 +762,16 @@ to the Info.plist file you have prepared. ## DOCUMENT HISTORY -Oct 29 2010 - matt: removed warnings -Oct 24 2010 - matt: restructured entire document and verified instructions -Dec 19 2010 - Manolo: corrected typos -Dec 29 2010 - Manolo: removed reference to AudioToolbox.framework that's no longer needed -Feb 24 2011 - Manolo: architecture flags are not propagated to the fltk-config script. -Apr 17 2012 - matt: added Xcode4 documentation -Nov 13 2012 - Manolo: added "MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON" -Apr 28 2014 - Manolo: how to build programs that run on various Mac OS X versions -Mar 18 2015 - Manolo: removed uses of the Xcode3 project -Apr 01 2016 - AlbrechtS: corrected typo, formatted most line breaks < 80 columns -Dec 04 2018 - AlbrechtS: fix typo (lowercase fluid.app) for case sensitive macOS -Dec 28 2018 - Matt: complete rework for FLTK 1.4 +- Oct 29 2010 - matt: removed warnings +- Oct 24 2010 - matt: restructured entire document and verified instructions +- Dec 19 2010 - Manolo: corrected typos +- Dec 29 2010 - Manolo: removed reference to AudioToolbox.framework that's no longer needed +- Feb 24 2011 - Manolo: architecture flags are not propagated to the fltk-config script. +- Apr 17 2012 - matt: added Xcode4 documentation +- Nov 13 2012 - Manolo: added "MAKE AN APPLICATION LAUNCHABLE BY DROPPING FILES ON ITS ICON" +- Apr 28 2014 - Manolo: how to build programs that run on various Mac OS X versions +- Mar 18 2015 - Manolo: removed uses of the Xcode3 project +- Apr 01 2016 - AlbrechtS: corrected typo, formatted most line breaks < 80 columns +- Dec 04 2018 - AlbrechtS: fix typo (lowercase fluid.app) for case sensitive macOS +- Dec 28 2018 - Matt: complete rework for FLTK 1.4 From 7c4ac3361aa9b6cdeed05714342dae0bda9f654c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 17:25:16 +0100 Subject: [PATCH 21/34] Tested and Working version or macOS command line build README. --- README.macOS.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index bf8696373..7783dbe3c 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -338,18 +338,19 @@ clang ``` If the command line tools are already available, the response will be -`clang: error: no input files`, and you are done. Continue with downloading FLTK. +`clang: error: no input files`, and you are done. Continue with installing _autoconf_. If the command line tools were not installed yet, a dialog box will pop up, claiimig "_The clang command requires the command line developer tools. Would you like to install -the tools now?_". Simply click on _Install_ and wait for the tools to be installed. +the tools now?_". Simply click on _Install_, _Agree_, and wait for the tools to be installed. On older versions of macOS, you will have to install _Xcode_ from the [App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12) and then install the command line tools from within _Xcode_. -Apple no longer includes _autoconf_. To installe _autoconf_, we first need to installe _brew_ -by typing this rather cryptic command in the shell: +Apple no longer includes _autoconf_ in the _Xcode_ command line tools. To install +_autoconf_, we first need to installe _brew_ by typing this rather cryptic command in the shell +you will need the root password): ```bash ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" @@ -442,7 +443,7 @@ test/demo ### Installing FLTK (autoconf, make) If you did not change any of the configuration settings, FLTK will be installed -in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing +in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing: ```bash sudo make install From 9cd6d384658b9a1549e44b621f94b80f81e75dd4 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 19:23:10 +0100 Subject: [PATCH 22/34] Added docs for other build options --- README.macOS.md | 211 +++++++++++++++++++++--------------------------- 1 file changed, 94 insertions(+), 117 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index 7783dbe3c..6e449d0c7 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -70,10 +70,12 @@ compiler independent configuration files, and generate native makefiles and work that can be used in the compiler environment of your choice." Please download and install the Mac OS X version of _CMake_ from -[www.cmake.org](https://cmake.org/download/). +[www.cmake.org](https://cmake.org/download/). Download the .dmg file, click it, and when +the Finder window opens, drag the _CMake_ icon into the Applications folder. _Xcode_ can be downloaded via the -[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). +[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). You will +need an Apple ID for this. Installing _Xcode_ may take well over an hour. ### Downloading and Unpacking (CMake, Xcode) @@ -83,152 +85,121 @@ You will need to clone the repository to check out the source code onto your mac has the great benefit that the source code can be updated later simply by telling _git_ to _pull_ the newest release. -Start your terminal. If you have not set up a developer directory yet, I recomment to use -`~/dev` and put all your projects there: +Start _Xcode_. Select `Source Control >> Clone...` in the main menu. -```bash -# make sure we are in the home directory -cd ~ -# create our developer directory and go there -mkdir dev -cd dev -``` -Now create a copy of the source code archive at Github on your local file system: +A dialog box will open with a search field and a list of repositories. Enter `fltk/fltk` in +the search field. A list of matchin repositories appears. The first one should be named `fltk` +and be owned by `fltk`. Select it and click _Clone_. -```bash -git clone https://github.com/fltk/fltk.git fltk-1.4.git -cd fltk-1.4.git -``` +A file chooser appears. Navigate to your home directory. The create a new folder named +`dev`. Enter `fltk-1.4.git` in the _Save As:_ field and click _Clone_, then _Done_ in the +previous dialog. + +The local copy of your repository can be updated by loading it into _Xcode_ and selecting +`Source Control >> Pull...` in the main menu. ### Configuring FLTK (CMake, Xcode) -Using you shell in the terminal, make sure that you are in the root directory of your -FLTK source code tree. +Launch _CMake_ by pressing Command+Spacebar, the type _CMake_ and press return. +_CMake_ should open with a large dialog box. -If you are configuring fltk for the first time, you need to instruct FLTK to create some -very basic configuration files. Type: +The first input field is labeled with _Where is the source code:_ . Click on _Browse Source..._ +and navigate to your home folder, then `dev`, then `fltk-1.4.git`. Click _Open_. -```bash -NOCONFIGURE=1 ./autogen.sh +The next input field is marked _Where to build the binaries:_. Click _Browse Build..._ +and navigate to your home folder, then `dev`, then `fltk-1.4.git`, then use _New Folder_ +to create a folder named `build`, and inside that, create a folder named `Xcode`. Click _Open_. + +The top two input fields should read ``` -This script may generate a few error messages which you can sefely ignore. - -Now configure your FLTK installation. Stay in your FLTK source-code directory -and type - -```bash -./configure +/Users/your_name/dev/fltk-1.4.git +``` +and +``` +/Users/your_name/dev/fltk-1.4.git/build/Xcode ``` -The configuration script runs a number of tests to find external headers, libraries, and tools. -The configuration summary should not show any errors. You can now continue to build FLTK. +Back in the _CMake_ main window, click _Configure_, select _Xcode_ as the generator and +click _Done_. _CMake_ will now analyse your system and find tools and dependencies. When +done, the upper list field in _CMake_ will show CMAKE, FLTK, and OPTION. Open the OPTION +field and find the entries OPTION_USE_SYSTEM_LIBJPEG and OPTION_USE_SYSTEM_LIBPNG, +and disable both for maximum compatibility with other macOS installation. -For the advanced user, there are a few more optinons to the _configure_ script. Type -`./configure --help` to get a complete list of options. These should be pretty -self-explanatory. Some more details can be found in -[online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). +Finally, click _Generate_ to generate the _Xcode_ IDE file. + +You may be wondering why we chose this rather involved way of creating the IDE files instead +of just including the IDEs in the repo. Well, we did for the longest time, but creating new IDEs +for every possible platform is quite involved. IDE file formats change, platforms change, and +FLTK changes as well, and maintenance of the IDEs had become a nightmare. _CMake_ on the +other hand is very smart, knows about platforms and IDEs that we could never support manually, +and usually needs to be run only once. Even when updating the FLTK source code later, +_CMake_ will be smart enough to update the build files as well. ### Building FLTK (CMake, Xcode) -Now this is easy if all the previous steps were successful. Stay in your FLTK source-code -directory and type: +Now this is easy if all the previous steps were successful. If you are still in _CMake_, just click +_Open Project_ and _CMake_ will launch _XCode_ for you. If not, just launch _XCode_ and +open `Macintosh HD⁩ ▸ ⁨Users⁩ ▸ your_name⁩ ▸ ⁨dev⁩ ▸ ⁨fltk-1.4.git⁩ ▸ ⁨build⁩ ▸ ⁨Xcode⁩ ▸ ⁨FLTK.xcodeproj`. -```bash -make -``` +_XCode_ may or may not ask to Autocreate Schemes. Click _Automatically Create Schemes_. -The entire FLTK toolkit including many test programs will be built for you. No -warnings should appear, but "ranlib" may complain about a few modules having no -symbols. This is normal and can safely be ignored. +In _Xcode_, set the 'active Scheme' to 'hello' or any other test program and press CMD+R +to compile and run that application. ### Testing FLTK (CMake, Xcode) -After a successful build, you can test FLTK's capabilities by running +After a successful build, you can test FLTK's capabilities by choosing 'ALL_BUILD' as the +'active Scheme' and pressing CMD+B to build, then choosing 'demo' and pressing CMD+R to +run the demo program. -```bash -test/demo -``` +TODO: as of Jan 2019, compiling 'demo' will not compile any of the other demo programs. +We really have to update the dependencies! ### Installing FLTK (CMake, Xcode) -If you did not change any of the configuration settings, FLTK will be installed -in `/usr/local/include`, `/usr/local/lib`, and `/usr/local/bin` by typing - -```bash -sudo make install -``` - -It is possible to install FLTK without superuser privileges by changing the -installation path to a location within the user account by adding the -`--prefix=PREFIX` parameter to the `./configure` command. +TODO: choosing the target 'INSTALL' will not work at this point because it requires root +permission. ### Creating new Projects (CMake, Xcode) -FLTK provides a neat script named `fltk-config` that can provide all the flags -needed to build FLTK applications using the same flags that were used to build -the library itself. Running `fltk-config` without arguments will print a list -of options. The easiest call to compile an FLTK application from a single source -file is: - -```bash -fltk-config --compile myProgram.cxx -``` - -`fltk-config` and our user interface designer `fluid` will be installed in -`/usr/local/bin/` by default. I recommend that you add this directory to the shell -`PATH` variable. +TODO: we still need to write a simple CMake file for creating a minimal cross platform app. ## How to Build FLTK Using _CMake_ and _make_ -This option is best for users who like to develop their apps without using Apple's Xcode IDE. -Users should be comfortable with using `bash` or `tcsh` in a terminal window. +This option is best for users who like to develop their apps without using Apple's Xcode IDE, +but like the advantages of _CMake_ over _autoconf_. Users should be comfortable with +using `bash` or `tcsh` in a terminal window. ### Prerequisites (CMake, make) -In order to build FLTK from the command line, you need to install a C++ compiler -environment, `make` and `autoconf`. _Xcode_ is the easiest way to install all prerequisites, -even if you don't plan to use it as your iDE. +In order to build FLTK, you need to install _CMake_ and the _Xcode_ command line tools. -_Xcode_ can be downloaded via the -[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). +"CMake is used to control the software compilation process using simple platform and +compiler independent configuration files, and generate native makefiles and workspaces +that can be used in the compiler environment of your choice." -After downloading and installing, you need to launch the Terminal. _Terminal.app_ -is located in the _Utilities_ folder inside the _Applications_ folder. I like -to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click -on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). +Please download and install the Mac OS X version of _CMake_ from +[www.cmake.org](https://cmake.org/download/). Download the .dmg file, click it, and when +the Finder window opens, drag the _CMake_ icon into the Applications folder. + +We will be using _CMake_ from the command line. Please launch _CMake_ and choose +`Tools > How to Install for Command Line Use` and follow the instructions +in the dialog box. + +Installing the _Xcode_ command line tools is explained [here](#xcode_command_line_tools). ### Downloading and Unpacking (CMake, make) -FLTK 1.4 is currently (as of Jan. 2019) only available as a source code repository via GitHub. -You will need to clone the repository to check out the source code onto your machine. This -has the great benefit that the source code can be updated later simply by telling _git_ to -_pull_ the newest release. - -Start your terminal. If you have not set up a developer directory yet, I recomment to use -`~/dev` and put all your projects there: - -```bash -# make sure we are in the home directory -cd ~ -# create our developer directory and go there -mkdir dev -cd dev -``` -Now create a copy of the source code archive at Github on your local file system: - -```bash -git clone https://github.com/fltk/fltk.git fltk-1.4.git -cd fltk-1.4.git -``` +Downloading FLTK is explained [here](#bam_download). ### Configuring FLTK (CMake, make) @@ -236,33 +207,36 @@ cd fltk-1.4.git Using you shell in the terminal, make sure that you are in the root directory of your FLTK source code tree. -If you are configuring fltk for the first time, you need to instruct FLTK to create some -very basic configuration files. Type: +Create a directory where all FLTK binaries will be built: ```bash -NOCONFIGURE=1 ./autogen.sh +mkdir build +cd build +mkdir Makefile +cd Makefile ``` -This script may generate a few error messages which you can sefely ignore. - -Now configure your FLTK installation. Stay in your FLTK source-code directory -and type +Now configure your FLTK installation: ```bash -./configure +cmake -G "Unix Makefiles" \ + -D OPTION_USE_SYSTEM_LIBJPEG=Off \ + -D OPTION_USE_SYSTEM_ZLIB=Off \ + -D OPTION_USE_SYSTEM_LIBPNG=Off \ + ../.. ``` -The configuration script runs a number of tests to find external headers, libraries, and tools. +_CMake_ runs a number of tests to find external headers, libraries, and tools. The configuration summary should not show any errors. You can now continue to build FLTK. -For the advanced user, there are a few more optinons to the _configure_ script. Type -`./configure --help` to get a complete list of options. These should be pretty +For the advanced user, there are a few more optinons to the _CMake_ setup. Type +`cmake -L ../..` to get a complete list of options. These should be pretty self-explanatory. Some more details can be found in [online documentation](https://www.fltk.org/doc-1.4/intro.html#intro_unix). ### Building FLTK (CMake, make) -Now this is easy if all the previous steps were successful. Stay in your FLTK source-code +Now this is easy if all the previous steps were successful. Stay in your `build/Makefiles` directory and type: ```bash @@ -279,7 +253,7 @@ symbols. This is normal and can safely be ignored. After a successful build, you can test FLTK's capabilities by running ```bash -test/demo +open bin/examples/demo.app ``` @@ -317,8 +291,9 @@ fltk-config --compile myProgram.cxx ## How to Build FLTK Using _autoconf_ and _make_ -This option is best for users who like to develop their apps without using Apple's Xcode IDE. -Users should be comfortable with using `bash` or `tcsh` in a terminal window. +This option is best for users who like to develop their apps without using Apple's Xcode IDE +and prefer minimal dependencies of a _Makefile_ over _CMake_. Users should be comfortable +with using `bash` or `tcsh` in a terminal window. ### Prerequisites (autoconf, make) @@ -327,10 +302,12 @@ In order to build FLTK from the command line, you need to install a C++ compiler environment, `make` and `autoconf`. Installing the _Xcode_ command line tools is the easiest way to get all prerequisites in one simple step. + Launch _Terminal.app_ by pressing Command+Spacebar and typing `Terminal` and pressing _return_. I like to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). +TODO: xcode-select --install See if we already have a current C++ compiler installed. Type ```bash From 2c67ae07dda580f1bc011cd6a6849f7dfe99cb14 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 19:29:34 +0100 Subject: [PATCH 23/34] Directly install command line tools. --- README.macOS.md | 283 +++--------------------------------------------- 1 file changed, 14 insertions(+), 269 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index 6e449d0c7..32efa3568 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -194,7 +194,17 @@ We will be using _CMake_ from the command line. Please launch _CMake_ and choose `Tools > How to Install for Command Line Use` and follow the instructions in the dialog box. -Installing the _Xcode_ command line tools is explained [here](#xcode_command_line_tools). +Installing the _Xcode_ command line tools is pretty straight forward. Just enter this +in your shell and follow the dialogs: + +```bash +xcode-select --install +``` + +On older versions of macOS, you will have to install _Xcode_ from the +[App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12) +and then install the command line tools from within _Xcode_. + ### Downloading and Unpacking (CMake, make) @@ -307,20 +317,13 @@ Launch _Terminal.app_ by pressing Command+Spacebar and typing `Terminal` and pre I like to keep the Terminal in the Dock for future use (launch Terminal, right-click or control-click on the Terminal icon that is now in the docking bar, and choose _Options_->_Keep in Dock_). -TODO: xcode-select --install -See if we already have a current C++ compiler installed. Type +Installing the _Xcode_ command line tools is pretty straight forward. Just enter this +and follow the dialogs: ```bash -clang +xcode-select --install ``` -If the command line tools are already available, the response will be -`clang: error: no input files`, and you are done. Continue with installing _autoconf_. - -If the command line tools were not installed yet, a dialog box will pop up, claiimig "_The -clang command requires the command line developer tools. Would you like to install -the tools now?_". Simply click on _Install_, _Agree_, and wait for the tools to be installed. - On older versions of macOS, you will have to install _Xcode_ from the [App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12) and then install the command line tools from within _Xcode_. @@ -457,264 +460,6 @@ fltk-config --compile main.cxx `PATH` variable. - - 3 HOW TO BUILD FLTK USING XCODE3 -=================================== - - - 3.1 Prerequisites --------------------- - -In order to build FLTK from within Xcode 3, you need to have the Xcode 3 -developer environment on your computer. If you don't, go to: 'HOW TO BUILD -FLTK USING XCODE4' - - - 3.2 Downloading and Unpacking --------------------------------- - -Download FLTK from here: - - https://www.fltk.org/software.php - -If you are familiar with "Git" and like to stay current with your -version, you will find the Git access parameters at the bottom of that -page. You can use the SCM system that is built into Xcode. - -Unpack FLTK by double-clicking it and copy the new folder into a convenient -location. I have set up a "dev" folder in my home folder for all my projects. - - - 3.3 Configuring FLTK ------------------------ - -Launch Xcode. Open the project file in - - .../fltk-1.3.xxxx/ide/Xcode4/FLTK.xcodeproj - -Use the "Project" pulldown menu to change "Active Build Configuration" to -"Release". Change the "Active Architecture" as desired. - - - 3.4 Building FLTK --------------------- - -Use the "Project" pulldown menu to set the "Active Target" to "Demo". Select -"Build" from the "Build" menu to create all libraries and test applications. - -By default, the Xcode4 project builds applications that run under macOS 10.5 -and above. To build applications that also run under older Mac OS versions, -select "Edit Project Settings" of the Project menu, then select the Build panel, -and modify the "macOS Deployment Target" item. - -All frameworks and apps will be located in "./ide/Xcode4/build/Release/". - - - 3.5 Testing FLTK -------------------- - -Select "Build and Run" from the "Build" menu to run the Demo program. Use "Demo" -to explore all test programs. - - - 3.6 Uninstalling previous versions of FLTK ---------------------------------------------- - -Remove FLTK frameworks: - - sudo rm -r /Library/Frameworks/fltk*.framework - -Remove Fluid and possibly other utilities: - - sudo rm -r /Developer/Applications/Utilities/FLTK/ - - - 3.7 Installing FLTK ----------------------- - -When distributing FLTK applications, the FLTK frameworks should be made part of -the application package. For development however, it is very convenient to have -the Release-mode Frameworks in a standard location. - -For Xcode project template use, all FLTK frameworks should be copied from -"./ide/Xcode4/build/Release/" to "/Library/Frameworks/". The FLTK header files -for all FLTK frameworks will then be at "/Library/Frameworks/fltk.framework/ -Headers/". Add this path to the header search path of your projects. - - sudo rm -f -r /Library/Frameworks/fltk* - sudo cp -R ide/Xcode4/build/Release/fltk*.framework /Library/Frameworks/ - -Many FLTK applications will use Fluid, the FLTK User Interface builder, to -generate C++ source code from .fl resource files. Add Fluid to the developer -tools: - - sudo mkdir /Developer/Applications/Utilities/FLTK/ - sudo rm -f -r /Developer/Applications/Utilities/FLTK/fluid.app - sudo cp -R ide/Xcode4/build/Release/fluid.app /Developer/Applications/Utilities/FLTK/ - - - 3.8 Installing Little Helpers --------------------------------- - - -- Project Templates: - -Project Templates are the quickest way to create a new FLTK application from -within Xcode. The included project builds an FLTK based Cocoa application -written in C++ with support for the Fluid UI designer, image reading, and -OpenGL. Unused FLTK sub-Frameworks can simply be removed from the project. -The template assumes that Release versions of the FLTK frameworks are installed -in /Library/Frameworks as described above. - -First, we need to create the Template folder: - - sudo mkdir -p /Library/Application\ Support/Developer/Shared/Xcode/Project\ Templates/ - -Next, we copy the project template over: - - sudo cp -r ide/Xcode4/Project\ Templates/* /Library/Application\ Support/Developer/Shared/Xcode/Project\ Templates/ - -After restarting Xcode, the dialog for "File > New Project..." will offer an -FLTK 1.3 user template which is ready to compile. - - -- Fluid file handling - -This section assumes that a Release version of Fluid is installed in -"/Developer/Applications/Utilities/FLTK/" as described above. It will install -a new file type which opens Fluid as an editor for files ending in ".fl". - -First, we need to create the spec folder: - - sudo mkdir -p /Library/Application\ Support/Developer/Shared/Xcode/Specifications/ - -Next, we copy the Fluid specification over: - - sudo cp ide/Xcode4/fluid.pbfilespec /Library/Application\ Support/Developer/Shared/Xcode/Specifications/ - -Open Xcode preferences and select the File Types tab. Find the -"sourcecode.fluid" entry in "file > text > sourcecode" and set the external -editor to Fluid. When adding ".fl" files, set the File Type in the Info dialog -to "sourcecode.fluid" and Xcode will edit your file in Fluid when -double-clicking. - - -- More - -TODO: Language Definition -TODO: Build Rules - - - 3.9 Creating new Projects ----------------------------- - -If the little helpers above were installed, the menu "File > New Project..." -will pop up a dialog that offers a User Template named Fluid. Select it and -follow the instructions. - - - - 4 HOW TO BUILD FLTK USING XCODE4 -=================================== - - - 4.1 Prerequisites --------------------- - -In order to build FLTK from within Xcode 4, 5, 6, 7, or 8 you need to install -the Xcode developer environment via the Apple App Store that comes with -Lion and up. If you also want the command line version of gcc, you can use -the Download section in the Preferences dialog. - - - 4.2 Downloading and Unpacking --------------------------------- - -Download FLTK from here: - - https://www.fltk.org/software.php - -If you are familiar with "Git" and like to stay current with your -version, you will find the Git access parameters at the bottom of that -page. You can use the SCM system that is built into Xcode. - -Unpack FLTK by double-clicking it and copy the new folder into a convenient -location. I have set up a "dev" folder in my home folder for all my projects. - - - 4.3 Configuring FLTK ------------------------ - -Launch Xcode. Open the project file in - - .../fltk-1.3.xxxx/ide/Xcode4/FLTK.xcodeproj - -There is nothing else to configure. - - - 4.4 Building FLTK --------------------- - -Use the "Scheme" pulldown menu to change the active target to "Demo" and -"My Mac 32-bit" or "My Mac 64-bit". Select "Build for" -> "Running"Run" from -the "Product" menu to create all libraries and test applications. - -By default, the Xcode4 project builds applications that run under macOS 10.5 -and above. To build applications that also run under older Mac OS versions, -modify the "macOS Deployment Target" item of the FLTK project build settings. - -All frameworks and apps will be located in a private directory. Use -"Window"->"Organizer" to find the full path. - - - 4.5 Testing FLTK -------------------- - -Select "Run" from the "Product" menu to run the Demo program. Use "Demo" -to explore all test programs. - - - 4.6 Uninstalling previous versions of FLTK ---------------------------------------------- - -Remove FLTK frameworks: - - sudo rm -r /Library/Frameworks/fltk*.framework - -Remove Fluid and possibly other utilities: - - sudo rm -r /Applications/FLTK/ - - - 4.7 Installing FLTK ----------------------- - -When distributing FLTK applications, the FLTK frameworks should be made part of -the application package. For development however, it is very convenient to have -the Release-mode Frameworks in a standard location. - -For Xcode project template use, all FLTK frameworks should be built using -"Build for Archiving" and then copied from -"./(Organizer->Derived Data Path)/Release/" to "/Library/Frameworks/". -The FLTK header files for all FLTK frameworks will then be at -"/Library/Frameworks/fltk.framework/Headers/". Add this path to the header -search path of your projects. - - sudo rm -f -r /Library/Frameworks/fltk* - sudo cp -R (Organizer->Derived Data Path)/Release/fltk*.framework /Library/Frameworks/ - -Many FLTK applications will use Fluid, the FLTK User Interface builder, to -generate C++ source code from .fl resource files. Add Fluid to the developer -tools: - - sudo mkdir /Applications/FLTK/ - sudo rm -f -r /Applications/FLTK/fluid.app - sudo cp -R (Organizer->Derived Data Path)/Release/fluid.app /Applications/FLTK/ - - (TODO: 4.8 Installing Little Helpers) - (TODO: 4.9 Creating new Projects) - - ### Make an Application Launchable by Dropping Files on its Icon From d58255074db6b11a0cd44693923e089e75d59038 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 19:37:31 +0100 Subject: [PATCH 24/34] Note if Apple ID or admin access is needed. --- README.macOS.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.macOS.md b/README.macOS.md index 32efa3568..3408fd8a3 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -60,6 +60,8 @@ All environments will generate Unix style static libraries and macOS style app b This option is best for users who like to develop their apps using Apple's Xcode IDE. There is no need to ever use a command line shell in this configuration. +This option requires an Apple ID, but no administrator rights. + ### Prerequisites (CMake, Xcode) @@ -177,6 +179,8 @@ This option is best for users who like to develop their apps without using Apple but like the advantages of _CMake_ over _autoconf_. Users should be comfortable with using `bash` or `tcsh` in a terminal window. +This option requires neither administrator rights, nor an Apple ID. + ### Prerequisites (CMake, make) @@ -305,6 +309,8 @@ This option is best for users who like to develop their apps without using Apple and prefer minimal dependencies of a _Makefile_ over _CMake_. Users should be comfortable with using `bash` or `tcsh` in a terminal window. +This option requires administrator rights, but no Apple ID. + ### Prerequisites (autoconf, make) From 70e29f9c7d6b218f623724a56b03a0270877a4f1 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 19:50:39 +0100 Subject: [PATCH 25/34] More fixes. --- README.macOS.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.macOS.md b/README.macOS.md index 3408fd8a3..cfeafdf51 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -196,7 +196,11 @@ the Finder window opens, drag the _CMake_ icon into the Applications folder. We will be using _CMake_ from the command line. Please launch _CMake_ and choose `Tools > How to Install for Command Line Use` and follow the instructions -in the dialog box. +in the dialog box. If you have admin right, you can also use + +```bash +sudo ln -s /Applications/CMake.app/Contents/bin/cmake /usr/local/bin/cmake +``` Installing the _Xcode_ command line tools is pretty straight forward. Just enter this in your shell and follow the dialogs: From a77ffd1dde4f26cd12d325778a0f4e597f012b41 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Fri, 28 Dec 2018 20:28:29 +0100 Subject: [PATCH 26/34] Xcode for some reason needs a github account to clone a public github repo. Documentation reflects that now. --- README.macOS.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.macOS.md b/README.macOS.md index cfeafdf51..44c448cca 100644 --- a/README.macOS.md +++ b/README.macOS.md @@ -60,7 +60,7 @@ All environments will generate Unix style static libraries and macOS style app b This option is best for users who like to develop their apps using Apple's Xcode IDE. There is no need to ever use a command line shell in this configuration. -This option requires an Apple ID, but no administrator rights. +This option requires an Apple ID and administrator rights. ### Prerequisites (CMake, Xcode) @@ -77,7 +77,7 @@ the Finder window opens, drag the _CMake_ icon into the Applications folder. _Xcode_ can be downloaded via the [App Store](https://itunes.apple.com/de/app/xcode/id497799835?l=en&mt=12). You will -need an Apple ID for this. Installing _Xcode_ may take well over an hour. +need an Apple ID and administrator right for this. Installing _Xcode_ will take well over an hour. ### Downloading and Unpacking (CMake, Xcode) @@ -87,6 +87,12 @@ You will need to clone the repository to check out the source code onto your mac has the great benefit that the source code can be updated later simply by telling _git_ to _pull_ the newest release. +If you want to use _Xcode_ to clone the FLTK GitHub repository, you will have to set up a +GitHub Account in the _Xcode_ preferences. If you don't have a GitHub account, or don't +want to create one for _Xcode_, you can use still the command line +`git clone https://github.com/fltk/fltk.git fltk-1.4.git` to ceck out the repo. + + Start _Xcode_. Select `Source Control >> Clone...` in the main menu. A dialog box will open with a search field and a list of repositories. Enter `fltk/fltk` in From 59612f6e7ec1c35d8fa23eee6e9c0c41a2ed3a80 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 28 Dec 2018 22:48:13 +0100 Subject: [PATCH 27/34] Activate travis-ci, update mail notifications. Note: current mail notifications are configured for first tests. We may need to reconfigure this later. See build logs at https://travis-ci.com/fltk/fltk --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9d8a45160..feed463e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ language: os: - linux - osx - + compiler: - gcc - clang @@ -35,7 +35,7 @@ before_script: if [ $TRAVIS_OS_NAME == linux ]; then sudo apt-get update -q sudo apt-get install -y libxinerama-dev libxcursor-dev libasound2-dev - sudo apt-get install -y doxygen + sudo apt-get install -y doxygen elif [ $TRAVIS_OS_NAME == osx ]; then brew install ccache # need to install on OSX export PATH="/usr/local/opt/ccache/libexec:$PATH" @@ -71,4 +71,4 @@ notifications: email: recipients: - fabien@onepost.net - \ No newline at end of file + - albrechts.fltk@online.de From a3ee6cff92b69d4ec0e3fe9a2699aa3d970f4323 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 29 Dec 2018 00:34:57 +0100 Subject: [PATCH 28/34] Refactored gl_remove_displaylist_fonts to be more easily readable and to stop triggering static analysis tool. --- src/gl_draw.cxx | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 695c4ee08..ed35d8d62 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -97,26 +97,24 @@ void gl_remove_displaylist_fonts() for (int j = 0 ; j < FL_FREE_FONT ; ++j) { - Fl_Font_Descriptor* past = 0; - Fl_Font_Descriptor** s_first = Fl_Gl_Window_Driver::global()->fontnum_to_fontdescriptor(j); - Fl_Font_Descriptor* f = *s_first; - while (f != 0) { - if(f->listbase) { - if(f == *s_first) { - *s_first = f->next; - } - else { - past->next = f->next; + Fl_Font_Descriptor *prevDesc = 0L, *nextDesc = 0L; + Fl_Font_Descriptor *&firstDesc = *Fl_Gl_Window_Driver::global()->fontnum_to_fontdescriptor(j); + for (Fl_Font_Descriptor *desc = firstDesc; desc; desc = nextDesc) + { + nextDesc = desc->next; + if(desc->listbase) { + // remove descriptor from a single-linked list + if(desc == firstDesc) { + firstDesc = desc->next; + } else if (prevDesc) { + // prevDesc should not be NULL, but this test will make static analysis shut up + prevDesc->next = desc->next; } // It would be nice if this next line was in a destructor somewhere - glDeleteLists(f->listbase, Fl_Gl_Window_Driver::global()->genlistsize()); - Fl_Font_Descriptor* tmp = f; - f = f->next; - delete tmp; - } - else { - past = f; - f = f->next; + glDeleteLists(desc->listbase, Fl_Gl_Window_Driver::global()->genlistsize()); + delete desc; + } else { + prevDesc = desc; } } } From e169b1941fb1b3cfb8333ec27ab8f04671850ab9 Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 29 Dec 2018 00:44:39 +0100 Subject: [PATCH 29/34] Remove a C style type cast from jpeg_mem_src. --- src/Fl_JPEG_Image.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Fl_JPEG_Image.cxx b/src/Fl_JPEG_Image.cxx index 384acd2a4..6dcf030b5 100644 --- a/src/Fl_JPEG_Image.cxx +++ b/src/Fl_JPEG_Image.cxx @@ -255,9 +255,8 @@ extern "C" { static void jpeg_mem_src(j_decompress_ptr cinfo, const unsigned char *data) { - my_src_ptr src; - cinfo->src = (struct jpeg_source_mgr *)malloc(sizeof(my_source_mgr)); - src = (my_src_ptr)cinfo->src; + my_src_ptr src = (my_source_mgr*)malloc(sizeof(my_source_mgr)); + cinfo->src = &(src->pub); src->pub.init_source = init_source; src->pub.fill_input_buffer = fill_input_buffer; src->pub.skip_input_data = skip_input_data; From 29fe0c43df7bad2df0f4445994b9d5d851bc2cdb Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 29 Dec 2018 01:19:51 +0100 Subject: [PATCH 30/34] Remove obsolete condition to make static analysis happy. --- src/Fl_Menu_add.cxx | 2 +- test/blocks.cxx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Fl_Menu_add.cxx b/src/Fl_Menu_add.cxx index 32da93df3..57534f4e3 100644 --- a/src/Fl_Menu_add.cxx +++ b/src/Fl_Menu_add.cxx @@ -176,7 +176,7 @@ int Fl_Menu_Item::insert( if (m->flags&FL_SUBMENU && !compare(item, m->text)) break; if (!m->text) { /* create a new menu */ - int n = (index==-1) ? (int) (m-array) : index; + int n = (int)(m-array); /* index is not used if label contains a path */ array = array_insert(array, msize, n, item, FL_SUBMENU|flags1); msize++; array = array_insert(array, msize, n+1, 0, 0); diff --git a/test/blocks.cxx b/test/blocks.cxx index c7d3979ed..6135313ba 100644 --- a/test/blocks.cxx +++ b/test/blocks.cxx @@ -771,7 +771,7 @@ int BlockWindow::handle(int event) { b = 0; for (j = 0, c = columns_; !count && j < num_columns_; j ++, c ++) - for (k = 0, b = c->blocks; !count && k < c->num_blocks; k ++, b ++) + for (k = 0, b = c->blocks; k < c->num_blocks; k ++, b ++) if (mx >= c->x && mx < (c->x + BLOCK_SIZE) && my >= b->y && my < (b->y + BLOCK_SIZE)) { if (b->bomb) count = bomb(b->color); From 95ab1dd73e9c5ea845ce03340b2861ea8a652b7e Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 29 Dec 2018 02:03:49 +0100 Subject: [PATCH 31/34] Fixing STR #2901, wrongly escaping the formatting character code in Fl_Browser. --- FL/Fl_Browser.H | 2 +- src/Fl_Browser.cxx | 9 +-------- test/browser.cxx | 4 ++++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H index 467c6bf0c..350dbf709 100644 --- a/FL/Fl_Browser.H +++ b/FL/Fl_Browser.H @@ -212,7 +212,7 @@ public: and used to modify how the rest of the line is printed: \li '\@.' Print rest of line, don't look for more '\@' signs - \li '\@\@' Print rest of line starting with '\@' + \li '\@\@' Doubling the format character prints the format character once, followed by the rest of line \li '\@l' Use a LARGE (24 point) font \li '\@m' Use a medium large (18 point) font \li '\@s' Use a small (11 point) font diff --git a/src/Fl_Browser.cxx b/src/Fl_Browser.cxx index 7621c6598..375d3ad33 100644 --- a/src/Fl_Browser.cxx +++ b/src/Fl_Browser.cxx @@ -378,8 +378,7 @@ int Fl_Browser::item_height(void *item) const { Fl_Font font = textfont(); // default font int tsize = textsize(); // default size if ( format_char() ) { // can be NULL - while (*str==format_char()) { - str++; + while (*str==format_char() && *str++ && *str!=format_char()) { switch (*str++) { case 'l': case 'L': tsize = 24; break; case 'm': case 'M': tsize = 18; break; @@ -391,7 +390,6 @@ int Fl_Browser::item_height(void *item) const { case 'C': while (isdigit(*str & 255)) str++; break; // skip a color number case 'F': font = (Fl_Font)strtol(str,&str,10); break; case 'S': tsize = strtol(str,&str,10); break; - case 0: case '@': str--; case '.': goto END_FORMAT; } } @@ -458,9 +456,6 @@ int Fl_Browser::item_width(void *item) const { case '.': done = 1; break; - case '@': - str--; - done = 1; } if (done) @@ -578,8 +573,6 @@ void Fl_Browser::item_draw(void* item, int X, int Y, int W, int H) const { break; case '.': goto BREAK; - case '@': - str--; goto BREAK; } } } diff --git a/test/browser.cxx b/test/browser.cxx index 48edd302b..a3485ca15 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -45,6 +45,9 @@ That was a blank line above this. @C2Green @C4Blue +@@ start line with '@' +@.@ alternative start line with '@' + You should try different browser types: Fl_Browser Fl_Select_Browser @@ -164,6 +167,7 @@ int main(int argc, char **argv) { browser->callback(b_cb); // browser->scrollbar_right(); //browser->has_scrollbar(Fl_Browser::BOTH_ALWAYS); + //browser->format_char('#'); if (!browser->load(fname)) { int done = 0; #ifdef _MSC_VER From c099837a3e80e8f2c1634e5f1861d268e82622fe Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 29 Dec 2018 02:08:40 +0100 Subject: [PATCH 32/34] Also testing # as a format_char() --- test/browser.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/browser.cxx b/test/browser.cxx index a3485ca15..e0ea9e799 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -47,6 +47,10 @@ That was a blank line above this. @@ start line with '@' @.@ alternative start line with '@' +@l@@ start tall line with '@' +@s@@ start small line with '@' +#s## start line with '#' +#s#.# alternative start line with '#' You should try different browser types: Fl_Browser From bf48acdbe53bd9fdebaa731831cea946f394350d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sat, 29 Dec 2018 02:16:40 +0100 Subject: [PATCH 33/34] Adding documentation for '@N', inactive color. --- FL/Fl_Browser.H | 6 ++++-- test/browser.cxx | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/FL/Fl_Browser.H b/FL/Fl_Browser.H index 350dbf709..191d98271 100644 --- a/FL/Fl_Browser.H +++ b/FL/Fl_Browser.H @@ -212,7 +212,8 @@ public: and used to modify how the rest of the line is printed: \li '\@.' Print rest of line, don't look for more '\@' signs - \li '\@\@' Doubling the format character prints the format character once, followed by the rest of line + \li '\@\@' Doubling the format character prints the format + character once, followed by the rest of line \li '\@l' Use a LARGE (24 point) font \li '\@m' Use a medium large (18 point) font \li '\@s' Use a small (11 point) font @@ -222,8 +223,9 @@ public: font (sets font to FL_COURIER) \li '\@c' Center the line horizontally \li '\@r' Right-justify the text + \li '\@N' Use fl_inactive_color() to draw the text \li '\@B0', '\@B1', ... '\@B255' Fill the backgound with - fl_color(n) + fl_color(n) \li '\@C0', '\@C1', ... '\@C255' Use fl_color(n) to draw the text \li '\@F0', '\@F1', ... Use fl_font(n) to draw the text \li '\@S1', '\@S2', ... Use point size n to draw the text diff --git a/test/browser.cxx b/test/browser.cxx index e0ea9e799..749a7ed83 100644 --- a/test/browser.cxx +++ b/test/browser.cxx @@ -44,6 +44,7 @@ That was a blank line above this. @C1RED @C2Green @C4Blue +@N@.Inactive @@ start line with '@' @.@ alternative start line with '@' From de199c327e9b55bd615f7262724da8ecba1999cf Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Sat, 29 Dec 2018 20:04:38 +0100 Subject: [PATCH 34/34] Add a CMake option to generate driver (developer) documentation. Generating driver documentation can now be configured with CMake. The new configuration OPTION_INCLUDE_DRIVER_DOCUMENTATION is "marked as advanced" since only advanced users and/or FLTK developers need this. Previously this could only be achieved by editing documentation/Doxyfile.in. Added missing documentation option descriptions as well. --- CMake/options.cmake | 4 ++++ README.CMake.txt | 31 +++++++++++++++++++++++++++---- documentation/CMakeLists.txt | 10 ++++++++-- documentation/Doxyfile.in | 3 +-- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/CMake/options.cmake b/CMake/options.cmake index bc3aa7e69..c747484bd 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -142,6 +142,10 @@ option(OPTION_FILESYSTEM_SUPPORT "allow file system support" ON) if(DOXYGEN_FOUND) option(OPTION_BUILD_HTML_DOCUMENTATION "build html docs" OFF) option(OPTION_INSTALL_HTML_DOCUMENTATION "install html docs" OFF) + + option(OPTION_INCLUDE_DRIVER_DOCUMENTATION "include driver (developer) docs" OFF) + mark_as_advanced(OPTION_INCLUDE_DRIVER_DOCUMENTATION) + if(LATEX_FOUND) option(OPTION_BUILD_PDF_DOCUMENTATION "build pdf docs" OFF) option(OPTION_INSTALL_PDF_DOCUMENTATION "install pdf docs" OFF) diff --git a/README.CMake.txt b/README.CMake.txt index 142603dad..88c48d679 100644 --- a/README.CMake.txt +++ b/README.CMake.txt @@ -103,11 +103,11 @@ OPTION_ARCHFLAGS - default EMPTY Extra architecture flags. OPTION_APPLE_X11 - default OFF - In case you want to use X11 on OSX. + In case you want to use X11 on macOS. Use this only if you know what you do, and if you have installed X11. OPTION_USE_POLL - default OFF - Don't use this one either. + Don't use this one either, it is deprecated. OPTION_BUILD_SHARED_LIBS - default OFF Normally FLTK is built as static libraries which makes more portable @@ -117,10 +117,10 @@ OPTION_BUILD_EXAMPLES - default ON Builds the many fine example programs. OPTION_CAIRO - default OFF - Enables libcairo support - see README.CMake.txt. + Enables libcairo support - see README.Cairo.txt. OPTION_CAIROEXT - default OFF - Enables extended libcairo support - see README.CMake.txt. + Enables extended libcairo support - see README.Cairo.txt. OPTION_USE_GL - default ON Enables OpenGL support. @@ -169,6 +169,28 @@ OPTION_PRINT_SUPPORT - default ON is somewhat smaller. This option makes sense only on the Unix/Linux platform or when OPTION_APPLE_X11 is ON. + +Documentation options: these options are only available if `doxygen' is + installed and found by CMake. PDF related options require also `latex'. + +OPTION_BUILD_HTML_DOCUMENTATION - default OFF +OPTION_BUILD_PDF_DOCUMENTATION - default OFF + These options can be used to switch HTML documentation generation with + doxygen on. The build targets ('html', 'pdf', or 'docs') need still to + be executed explicitly. + +OPTION_INCLUDE_DRIVER_DOCUMENTATION - default OFF + This option adds driver documentation to HTML and PDF docs (if ON). This + option is marked as "advanced" since it is only useful for FLTK developers + or advanced users. + +OPTION_INSTALL_HTML_DOCUMENTATION - default OFF +OPTION_INSTALL_PDF_DOCUMENTATION - default OFF + If these options are ON then the HTML and/or PDF docs get installed + when the 'install' target is executed, e.g. with `make install'. You + need to select above options OPTION_BUILD_*_DOCUMENTATION as well. + + 2.3 Building under Linux with Unix Makefiles ----------------------------------------------- @@ -543,3 +565,4 @@ Apr 07 2015 - AlbrechtS: update use example and more docs Jan 31 2016 - msurette: custom command instead of fltk_wrap_ui Nov 01 2016 - AlbrechtS: remove deprecated FLTK_USE_FILE, add MinGW build Jul 05 2017 - matt: added instructions for MacOS and Xcode +Dec 29 2018 - AlbrechtS: add documentation option descriptions diff --git a/documentation/CMakeLists.txt b/documentation/CMakeLists.txt index 720af95d3..cec1f5104 100644 --- a/documentation/CMakeLists.txt +++ b/documentation/CMakeLists.txt @@ -18,6 +18,14 @@ set (DOCS) +set (FL_VERSION "${FLTK_VERSION_FULL}") + +if (OPTION_INCLUDE_DRIVER_DOCUMENTATION) + set (DRIVER_DOCS "DriverDev") +else () + set (DRIVER_DOCS "") +endif () + #-------------------------- # build html documentation #-------------------------- @@ -31,7 +39,6 @@ if(OPTION_BUILD_HTML_DOCUMENTATION) set(GENERATE_HTML YES) set(GENERATE_LATEX NO) set(LATEX_HEADER "") - set(FL_VERSION "${FLTK_VERSION_FULL}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in @@ -64,7 +71,6 @@ if (OPTION_BUILD_PDF_DOCUMENTATION) set(GENERATE_HTML NO) set(GENERATE_LATEX YES) set(LATEX_HEADER "${CMAKE_CURRENT_BINARY_DIR}/fltk-book.tex") - set(FL_VERSION "${FLTK_VERSION_FULL}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in diff --git a/documentation/Doxyfile.in b/documentation/Doxyfile.in index d5a7a7681..58bc2b67f 100644 --- a/documentation/Doxyfile.in +++ b/documentation/Doxyfile.in @@ -437,8 +437,7 @@ GENERATE_DEPRECATEDLIST= YES # The ENABLED_SECTIONS tag can be used to enable conditional # documentation sections, marked by \if sectionname ... \endif. -ENABLED_SECTIONS = -# ENABLED_SECTIONS += DriverDev +ENABLED_SECTIONS = @DRIVER_DOCS@ # The MAX_INITIALIZER_LINES tag determines the maximum number of lines # the initial value of a variable or define consists of for it to appear in