Minor updates of bundled libraries and README.CMake.txt

Update Makefiles, CMakeLists.txt, improve formatting.
This commit is contained in:
Albrecht Schlosser 2023-12-04 17:31:18 +01:00
parent a73a14347d
commit cf07fa09dc
8 changed files with 43 additions and 46 deletions

View File

@ -2,7 +2,7 @@
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org) # Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
# Originally written by Michael Surette # Originally written by Michael Surette
# #
# Copyright 1998-2022 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
@ -125,12 +125,12 @@ endif ()
# If either of them is not available, we fall back to using both local libraries # If either of them is not available, we fall back to using both local libraries
if (OPTION_USE_SYSTEM_LIBPNG AND NOT (OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND)) if (OPTION_USE_SYSTEM_LIBPNG AND NOT (OPTION_USE_SYSTEM_ZLIB AND ZLIB_FOUND))
set (PNG_FOUND FALSE) set (PNG_FOUND FALSE)
set (OPTION_USE_SYSTEM_LIBPNG FALSE) set (OPTION_USE_SYSTEM_LIBPNG OFF)
message (STATUS "Local z lib selected: overriding png lib to local for compatibility.\n") message (STATUS "Local z lib selected: overriding png lib to local for compatibility.\n")
endif () endif ()
if (OPTION_USE_SYSTEM_ZLIB AND NOT (OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND)) if (OPTION_USE_SYSTEM_ZLIB AND NOT (OPTION_USE_SYSTEM_LIBPNG AND PNG_FOUND))
set (ZLIB_FOUND FALSE) set (ZLIB_FOUND FALSE)
set (OPTION_USE_SYSTEM_ZLIB FALSE) set (OPTION_USE_SYSTEM_ZLIB OFF)
message (STATUS "Local png lib selected: overriding z lib to local for compatibility.\n") message (STATUS "Local png lib selected: overriding z lib to local for compatibility.\n")
endif () endif ()
@ -951,6 +951,14 @@ if (DEBUG_OPTIONS_CMAKE)
fl_debug_var (OPENGL_FOUND) fl_debug_var (OPENGL_FOUND)
fl_debug_var (OPENGL_INCLUDE_DIR) fl_debug_var (OPENGL_INCLUDE_DIR)
fl_debug_var (OPENGL_LIBRARIES) fl_debug_var (OPENGL_LIBRARIES)
fl_debug_var (CMAKE_MSVC_RUNTIME_LIBRARY)
message ("--- bundled libraries ---")
fl_debug_var (OPTION_USE_SYSTEM_LIBJPEG)
fl_debug_var (OPTION_USE_SYSTEM_LIBPNG)
fl_debug_var (OPTION_USE_SYSTEM_ZLIB)
fl_debug_var (FLTK_USE_BUILTIN_JPEG)
fl_debug_var (FLTK_USE_BUILTIN_PNG)
fl_debug_var (FLTK_USE_BUILTIN_ZLIB)
message ("--- X11 ---") message ("--- X11 ---")
fl_debug_var (X11_FOUND) fl_debug_var (X11_FOUND)
fl_debug_var (X11_INCLUDE_DIR) fl_debug_var (X11_INCLUDE_DIR)

View File

@ -580,12 +580,12 @@ find_package(FLTK REQUIRED CONFIG)
add_executable(hello WIN32 MACOSX_BUNDLE hello.cxx) add_executable(hello WIN32 MACOSX_BUNDLE hello.cxx)
if (APPLE) if (APPLE)
target_link_libraries(hello PRIVATE "-framework cocoa") target_link_libraries (hello PRIVATE "-framework cocoa")
endif (APPLE) endif (APPLE)
target_include_directories(hello PRIVATE ${FLTK_INCLUDE_DIRS}) target_include_directories (hello PRIVATE ${FLTK_INCLUDE_DIRS})
target_link_libraries(hello PRIVATE fltk) target_link_libraries (hello PRIVATE fltk)
--- ---
The set(FLTK_DIR ...) command is a superhint to the find_package command. The set(FLTK_DIR ...) command is a superhint to the find_package command.
@ -644,12 +644,12 @@ add_custom_command(
add_executable(CubeView WIN32 MACOSX_BUNDLE add_executable(CubeView WIN32 MACOSX_BUNDLE
CubeMain.cxx CubeView.cxx CubeViewUI.cxx) CubeMain.cxx CubeView.cxx CubeViewUI.cxx)
target_include_directories(CubeView PRIVATE ${FLTK_INCLUDE_DIRS}) target_include_directories (CubeView PRIVATE ${FLTK_INCLUDE_DIRS})
target_include_directories(CubeView PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories (CubeView PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(CubeView PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories (CubeView PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(CubeView PRIVATE fltk fltk_gl) target_link_libraries (CubeView PRIVATE fltk fltk_gl)
--- ---
You can repeat the add_custom_command for each fluid file or if you You can repeat the add_custom_command for each fluid file or if you
@ -658,8 +658,8 @@ FLTK_RUN_FLUID for an example of how to run it in a loop.
The two lines The two lines
target_include_directories(CubeView PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories (CubeView PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(CubeView PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories (CubeView PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add the current build ("binary") and source directories as include directories. add the current build ("binary") and source directories as include directories.
This is necessary for the compiler to find the local header files since the This is necessary for the compiler to find the local header files since the

View File

@ -1,7 +1,7 @@
# #
# JPEG library CMake configuration for the Fast Light Toolkit (FLTK). # JPEG library CMake configuration for the Fast Light Toolkit (FLTK).
# #
# Copyright 1998-2021 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this

View File

@ -4,7 +4,7 @@
# #
# JPEG library makefile for the Fast Light Toolkit (FLTK). # JPEG library makefile for the Fast Light Toolkit (FLTK).
# #
# Copyright 1997-2011 by Bill Spitzak and others. # Copyright 1997-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
@ -19,7 +19,6 @@
include ../makeinclude include ../makeinclude
# #
# Object files... # Object files...
# #
@ -74,14 +73,12 @@ OBJS = \
LIBJPEG = ../lib/libfltk_jpeg$(LIBEXT) LIBJPEG = ../lib/libfltk_jpeg$(LIBEXT)
# #
# Make all targets... # Make all targets...
# #
all: $(LIBJPEG) all: $(LIBJPEG)
# #
# Clean all targets and object files... # Clean all targets and object files...
# #
@ -90,7 +87,6 @@ clean:
$(RM) $(OBJS) $(RM) $(OBJS)
$(RM) $(LIBJPEG) $(RM) $(LIBJPEG)
# #
# Install everything... # Install everything...
# #
@ -108,7 +104,6 @@ install: $(LIBJPEG)
$(INSTALL_DATA) jpeglib.h $(DESTDIR)$(includedir)/FL/images $(INSTALL_DATA) jpeglib.h $(DESTDIR)$(includedir)/FL/images
$(INSTALL_DATA) fltk_jpeg_prefix.h $(DESTDIR)$(includedir)/FL/images $(INSTALL_DATA) fltk_jpeg_prefix.h $(DESTDIR)$(includedir)/FL/images
# #
# Uninstall everything... # Uninstall everything...
# #
@ -123,7 +118,6 @@ uninstall:
$(RM) $(includedir)/FL/images/jpeglib.h $(RM) $(includedir)/FL/images/jpeglib.h
$(RM) $(includedir)/FL/images/fltk_jpeg_prefix.h $(RM) $(includedir)/FL/images/fltk_jpeg_prefix.h
# #
# libfltk_jpeg.a # libfltk_jpeg.a
# #
@ -134,7 +128,6 @@ $(LIBJPEG): $(OBJS)
$(LIBCOMMAND) $@ $(OBJS) $(LIBCOMMAND) $@ $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
# #
# Make dependencies... # Make dependencies...
# #

View File

@ -1,7 +1,7 @@
# #
# PNG library CMake configuration for the Fast Light Toolkit (FLTK). # PNG library CMake configuration for the Fast Light Toolkit (FLTK).
# #
# Copyright 1998-2022 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
@ -15,7 +15,7 @@
# #
# source files for png # source files for png
set(PNG_SRCS set (PNG_SRCS
png.c png.c
pngerror.c pngerror.c
pngget.c pngget.c
@ -33,6 +33,13 @@ set(PNG_SRCS
pngwutil.c pngwutil.c
) )
#######################################################################
# Note: This file is used only if we build the bundled PNG library,
# and if we do this we MUST also build and use the *bundled* ZLIB,
# hence we MUST also link against the bundled ZLIB (see below).
# There's no need to check which ZLIB version to use in this context.
#######################################################################
####################################################################### #######################################################################
# Build some files on ARM (e.g. Apple M1 systems) # Build some files on ARM (e.g. Apple M1 systems)
####################################################################### #######################################################################
@ -43,16 +50,16 @@ set(PNG_SRCS
# This includes all non-macOS platforms. # This includes all non-macOS platforms.
if (CMAKE_OSX_ARCHITECTURES) if (CMAKE_OSX_ARCHITECTURES)
string(REGEX MATCH "arm64" is_arm "${CMAKE_OSX_ARCHITECTURES}") string (REGEX MATCH "arm64" is_arm "${CMAKE_OSX_ARCHITECTURES}")
else () else ()
set (is_arm TRUE) set (is_arm TRUE)
endif () endif ()
if (is_arm) if (is_arm)
LIST (APPEND PNG_SRCS LIST (APPEND PNG_SRCS
arm/arm_init.c arm/arm_init.c
arm/filter_neon_intrinsics.c arm/filter_neon_intrinsics.c
arm/palette_neon_intrinsics.c arm/palette_neon_intrinsics.c
) )
endif () endif ()
@ -65,8 +72,8 @@ unset (is_arm)
####################################################################### #######################################################################
LIST (APPEND PNG_SRCS LIST (APPEND PNG_SRCS
powerpc/powerpc_init.c powerpc/powerpc_init.c
powerpc/filter_vsx_intrinsics.c powerpc/filter_vsx_intrinsics.c
) )
####################################################################### #######################################################################
@ -74,7 +81,7 @@ LIST (APPEND PNG_SRCS
####################################################################### #######################################################################
FL_ADD_LIBRARY (fltk_png STATIC "${PNG_SRCS}") FL_ADD_LIBRARY (fltk_png STATIC "${PNG_SRCS}")
target_link_libraries (fltk_png ${FLTK_ZLIB_LIBRARIES}) target_link_libraries (fltk_png PUBLIC fltk_z)
####################################################################### #######################################################################
# Build the shared library (optional) # Build the shared library (optional)
@ -83,12 +90,7 @@ target_link_libraries (fltk_png ${FLTK_ZLIB_LIBRARIES})
if (OPTION_BUILD_SHARED_LIBS) if (OPTION_BUILD_SHARED_LIBS)
FL_ADD_LIBRARY (fltk_png SHARED "${PNG_SRCS}") FL_ADD_LIBRARY (fltk_png SHARED "${PNG_SRCS}")
target_link_libraries (fltk_png_SHARED PUBLIC fltk_z_SHARED)
if (FLTK_USE_BUILTIN_ZLIB)
target_link_libraries (fltk_png_SHARED fltk_z)
else()
target_link_libraries (fltk_png_SHARED ${FLTK_ZLIB_LIBRARIES})
endif ()
endif () endif ()

View File

@ -2,7 +2,7 @@
# PNG library Makefile for the Fast Light Toolkit (FLTK). # PNG library Makefile for the Fast Light Toolkit (FLTK).
# #
# Copyright 1997-2011 by Easy Software Products. # Copyright 1997-2011 by Easy Software Products.
# Copyright 2012-2020 by Bill Spitzak and others. # Copyright 2012-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this

View File

@ -1,7 +1,7 @@
# #
# ZLIB library CMake configuration for the Fast Light Toolkit (FLTK). # ZLIB library CMake configuration for the Fast Light Toolkit (FLTK).
# #
# Copyright 1998-2021 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this

View File

@ -1,7 +1,7 @@
# #
# GNU ZIP library makefile for the Fast Light Toolkit (FLTK). # ZIP library makefile for the Fast Light Toolkit (FLTK).
# #
# Copyright 1998-2021 by Bill Spitzak and others. # Copyright 1998-2023 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
@ -16,7 +16,6 @@
include ../makeinclude include ../makeinclude
# #
# Object files... # Object files...
# #
@ -27,14 +26,12 @@ OBJS = adler32.o compress.o crc32.o uncompr.o deflate.o \
LIBZ = ../lib/libfltk_z$(LIBEXT) LIBZ = ../lib/libfltk_z$(LIBEXT)
# #
# Make all targets... # Make all targets...
# #
all: $(LIBZ) all: $(LIBZ)
# #
# Clean all targets and object files... # Clean all targets and object files...
# #
@ -43,7 +40,6 @@ clean:
$(RM) $(OBJS) $(RM) $(OBJS)
$(RM) $(LIBZ) $(RM) $(LIBZ)
# #
# Install everything... # Install everything...
# #
@ -59,7 +55,6 @@ install: $(LIBZ)
$(INSTALL_DATA) zlib.h $(DESTDIR)$(includedir)/FL/images $(INSTALL_DATA) zlib.h $(DESTDIR)$(includedir)/FL/images
$(INSTALL_DATA) zutil.h $(DESTDIR)$(includedir)/FL/images $(INSTALL_DATA) zutil.h $(DESTDIR)$(includedir)/FL/images
# #
# Uninstall everything... # Uninstall everything...
# #
@ -72,7 +67,6 @@ uninstall:
$(RM) $(includedir)/FL/images/zlib.h $(RM) $(includedir)/FL/images/zlib.h
$(RM) $(includedir)/FL/images/zutil.h $(RM) $(includedir)/FL/images/zutil.h
# #
# libfltk_z.a # libfltk_z.a
# #