mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 15:32:12 +08:00
CMake: refactor and reformat CMake files
- raise minimum CMake version from 2.6.3 to 3.2.3 (Jun 01, 2015)
- indent all CMake files according to the CMP (2 col.)
- refactor FLTK version number definitions and usage
- unify CMake and autoconf/configure variable names:
- FL_VERSION -> FLTK_VERSION
- FL_MAJOR_VERSION -> FLTK_VERSION_MAJOR
- etc. for _MINOR_ and _PATCH_, respectively
- note: this does not affect FL_VERSION etc. in source code
- generate "export headers" for all libraries (experimental: OFF)
- port some forgotten goodies from branch-1.3 to master
- merge and improve macro 'create_example' (WIP)
- remove "temporary" options and code for older CMake versions
- include and use 'GenerateExportHeader' (experimental, WIP: OFF)
- note: created header files are not yet used
- build only *one* DLL with Visual Studio (tested, works)
- similar to the bundled IDE projects in 1.3.x
- add some dynamically linked test/demo programs ('*-shared')
if shared libraries are built (WIP)
- split 'macros.cmake': use one file per macro
This commit is contained in:
@@ -0,0 +1,55 @@
|
|||||||
|
#
|
||||||
|
# FLTK-Functions.cmake
|
||||||
|
# Written by Michael Surette
|
||||||
|
#
|
||||||
|
# Copyright 1998-2020 by Bill Spitzak and others.
|
||||||
|
#
|
||||||
|
# This library is free software. Distribution and use rights are outlined in
|
||||||
|
# the file "COPYING" which should have been included with this file. If this
|
||||||
|
# file is missing or damaged, see the license at:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/COPYING.php
|
||||||
|
#
|
||||||
|
# Please see the following page on how to report bugs and issues:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/bugs.php
|
||||||
|
#
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# functions used by the build system and exported for the end-user
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
|
||||||
|
|
||||||
|
function (FLTK_RUN_FLUID TARGET SOURCES)
|
||||||
|
set (CXX_FILES)
|
||||||
|
foreach (src ${SOURCES})
|
||||||
|
if ("${src}" MATCHES "\\.fl$")
|
||||||
|
string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${basename}.cxx" "${basename}.h"
|
||||||
|
COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
|
||||||
|
DEPENDS ${src}
|
||||||
|
MAIN_DEPENDENCY ${src}
|
||||||
|
)
|
||||||
|
list (APPEND CXX_FILES "${basename}.cxx")
|
||||||
|
endif ("${src}" MATCHES "\\.fl$")
|
||||||
|
set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
|
||||||
|
endforeach ()
|
||||||
|
endfunction (FLTK_RUN_FLUID TARGET SOURCES)
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
# sets the bundle icon for OSX bundles
|
||||||
|
|
||||||
|
function (FLTK_SET_BUNDLE_ICON TARGET ICON_PATH)
|
||||||
|
get_filename_component (ICON_NAME "${ICON_PATH}" NAME)
|
||||||
|
set_target_properties ("${TARGET}" PROPERTIES
|
||||||
|
MACOSX_BUNDLE_ICON_FILE "${ICON_NAME}"
|
||||||
|
RESOURCE "${ICON_PATH}"
|
||||||
|
)
|
||||||
|
endfunction (FLTK_SET_BUNDLE_ICON TARGET ICON_PATH)
|
||||||
|
|
||||||
|
#
|
||||||
|
# End of file
|
||||||
|
#
|
||||||
+9
-1
@@ -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)
|
||||||
# Written by Michael Surette
|
# Written by Michael Surette
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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
|
||||||
@@ -18,6 +18,7 @@
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# final config and export
|
# final config and export
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
# Set the fluid executable path
|
# Set the fluid executable path
|
||||||
if (CMAKE_CROSSCOMPILING)
|
if (CMAKE_CROSSCOMPILING)
|
||||||
find_file(FLUID_PATH
|
find_file(FLUID_PATH
|
||||||
@@ -42,6 +43,13 @@ add_subdirectory(src)
|
|||||||
# generate FLTK-Targets.cmake for build directory use
|
# generate FLTK-Targets.cmake for build directory use
|
||||||
export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
|
export(TARGETS ${FLUID} ${FLTK_LIBRARIES} FILE ${CMAKE_CURRENT_BINARY_DIR}/FLTK-Targets.cmake)
|
||||||
|
|
||||||
|
# generate FLTK-Functions.cmake for build directory use
|
||||||
|
configure_file (
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTK-Functions.cmake
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/FLTK-Functions.cmake
|
||||||
|
COPYONLY
|
||||||
|
)
|
||||||
|
|
||||||
# generate FLTKConfig.cmake for build directory use
|
# generate FLTKConfig.cmake for build directory use
|
||||||
set (INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
|
set (INCLUDE_DIRS "${FLTK_INCLUDE_DIRS}")
|
||||||
set (CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
set (CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|||||||
@@ -0,0 +1,123 @@
|
|||||||
|
#
|
||||||
|
# Macro used by the CMake build system for the Fast Light Tool Kit (FLTK).
|
||||||
|
# Written by Michael Surette
|
||||||
|
#
|
||||||
|
# Copyright 1998-2020 by Bill Spitzak and others.
|
||||||
|
#
|
||||||
|
# This library is free software. Distribution and use rights are outlined in
|
||||||
|
# the file "COPYING" which should have been included with this file. If this
|
||||||
|
# file is missing or damaged, see the license at:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/COPYING.php
|
||||||
|
#
|
||||||
|
# Please see the following page on how to report bugs and issues:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/bugs.php
|
||||||
|
#
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# FL_ADD_LIBRARY - add a static or shared library to the build
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
macro (FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
||||||
|
|
||||||
|
if (${LIBTYPE} STREQUAL "SHARED")
|
||||||
|
set (TARGET_NAME ${LIBNAME}_SHARED)
|
||||||
|
else ()
|
||||||
|
set (TARGET_NAME ${LIBNAME})
|
||||||
|
endif (${LIBTYPE} STREQUAL "SHARED")
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
set (OUTPUT_NAME_DEBUG "${LIBNAME}d")
|
||||||
|
set (OUTPUT_NAME_RELEASE "${LIBNAME}")
|
||||||
|
else ()
|
||||||
|
set (OUTPUT_NAME_DEBUG "${LIBNAME}")
|
||||||
|
set (OUTPUT_NAME_RELEASE "${LIBNAME}")
|
||||||
|
endif (MSVC)
|
||||||
|
|
||||||
|
add_library(${TARGET_NAME} ${LIBTYPE} ${LIBFILES})
|
||||||
|
|
||||||
|
# target properties for all libraries
|
||||||
|
|
||||||
|
set_target_properties(${TARGET_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
CLEAN_DIRECT_OUTPUT TRUE
|
||||||
|
COMPILE_DEFINITIONS "FL_LIBRARY"
|
||||||
|
)
|
||||||
|
|
||||||
|
# additional target properties for static libraries
|
||||||
|
|
||||||
|
if (${LIBTYPE} STREQUAL "STATIC")
|
||||||
|
set_target_properties(${TARGET_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
OUTPUT_NAME ${LIBNAME}
|
||||||
|
OUTPUT_NAME_DEBUG ${OUTPUT_NAME_DEBUG}
|
||||||
|
OUTPUT_NAME_RELEASE ${OUTPUT_NAME_RELEASE}
|
||||||
|
)
|
||||||
|
endif (${LIBTYPE} STREQUAL "STATIC")
|
||||||
|
|
||||||
|
# additional target properties for shared (dynamic) libraries (DLL's)
|
||||||
|
|
||||||
|
if (${LIBTYPE} STREQUAL "SHARED")
|
||||||
|
set_target_properties(${TARGET_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
VERSION ${FLTK_VERSION}
|
||||||
|
SOVERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
|
||||||
|
OUTPUT_NAME ${LIBNAME}
|
||||||
|
OUTPUT_NAME_DEBUG ${OUTPUT_NAME_DEBUG}
|
||||||
|
OUTPUT_NAME_RELEASE ${OUTPUT_NAME_RELEASE}
|
||||||
|
)
|
||||||
|
# MSVC only:
|
||||||
|
if (MSVC)
|
||||||
|
set_target_properties(${TARGET_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
OUTPUT_NAME lib${LIBNAME}
|
||||||
|
OUTPUT_NAME_DEBUG lib${OUTPUT_NAME_DEBUG}
|
||||||
|
OUTPUT_NAME_RELEASE lib${OUTPUT_NAME_RELEASE}
|
||||||
|
# PREFIX "lib" # for MSVC static/shared coexistence *DOES NOT WORK*
|
||||||
|
)
|
||||||
|
endif (MSVC)
|
||||||
|
endif (${LIBTYPE} STREQUAL "SHARED")
|
||||||
|
|
||||||
|
# Debug library output names (optional)
|
||||||
|
set (DEBUG_ONAME 0)
|
||||||
|
|
||||||
|
if (DEBUG_ONAME)
|
||||||
|
get_target_property (XX_ONAME ${TARGET_NAME} OUTPUT_NAME)
|
||||||
|
get_target_property (XX_ONAME_DEBUG ${TARGET_NAME} OUTPUT_NAME_DEBUG)
|
||||||
|
get_target_property (XX_ONAME_RELEASE ${TARGET_NAME} OUTPUT_NAME_RELEASE)
|
||||||
|
|
||||||
|
fl_debug_var (TARGET_NAME)
|
||||||
|
fl_debug_var (XX_ONAME)
|
||||||
|
fl_debug_var (XX_ONAME_DEBUG)
|
||||||
|
fl_debug_var (XX_ONAME_RELEASE)
|
||||||
|
message (STATUS "---")
|
||||||
|
endif (DEBUG_ONAME)
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
if (OPTION_LARGE_FILE)
|
||||||
|
set_target_properties(${TARGET_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
LINK_FLAGS /LARGEADDRESSAWARE
|
||||||
|
)
|
||||||
|
endif (OPTION_LARGE_FILE)
|
||||||
|
|
||||||
|
if (${LIBTYPE} STREQUAL "SHARED")
|
||||||
|
set_target_properties(${TARGET_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
COMPILE_DEFINITIONS "FL_DLL"
|
||||||
|
)
|
||||||
|
endif (${LIBTYPE} STREQUAL "SHARED")
|
||||||
|
endif (MSVC)
|
||||||
|
|
||||||
|
install (TARGETS ${TARGET_NAME}
|
||||||
|
EXPORT FLTK-Targets
|
||||||
|
RUNTIME DESTINATION ${FLTK_BINDIR}
|
||||||
|
LIBRARY DESTINATION ${FLTK_LIBDIR}
|
||||||
|
ARCHIVE DESTINATION ${FLTK_LIBDIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
list (APPEND FLTK_LIBRARIES "${TARGET_NAME}")
|
||||||
|
set (FLTK_LIBRARIES ${FLTK_LIBRARIES} PARENT_SCOPE)
|
||||||
|
|
||||||
|
endmacro (FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
||||||
@@ -0,0 +1,145 @@
|
|||||||
|
#
|
||||||
|
# A macro used by the CMake build system for the Fast Light Tool Kit (FLTK).
|
||||||
|
# Written by Michael Surette
|
||||||
|
#
|
||||||
|
# Copyright 1998-2020 by Bill Spitzak and others.
|
||||||
|
#
|
||||||
|
# This library is free software. Distribution and use rights are outlined in
|
||||||
|
# the file "COPYING" which should have been included with this file. If this
|
||||||
|
# file is missing or damaged, see the license at:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/COPYING.php
|
||||||
|
#
|
||||||
|
# Please see the following page on how to report bugs and issues:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/bugs.php
|
||||||
|
#
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# macro CREATE_EXAMPLE - Create a test/demo program
|
||||||
|
#
|
||||||
|
# Input:
|
||||||
|
#
|
||||||
|
# - NAME: program name, e.g. 'hello'
|
||||||
|
#
|
||||||
|
# - SOURCES: list of source files, separated by ';' (needs quotes)
|
||||||
|
# Sources can be:
|
||||||
|
# - .c/.cxx files, e.g. 'hello.cxx'
|
||||||
|
# - .fl (fluid) files, e.g. 'radio.fl'
|
||||||
|
# - .plist file (macOS), e.g. 'editor-Info.plist'
|
||||||
|
# - .icns file (macOS Icon), e.g. 'checkers.icns'
|
||||||
|
# File name (type), e.g. '.icns' matters, it is parsed internally.
|
||||||
|
# Order of sources doesn't matter, multiple .cxx and .fl files are
|
||||||
|
# supported, but only one .plist and .icns file.
|
||||||
|
# macOS specific files are ignored on other platforms.
|
||||||
|
#
|
||||||
|
# - LIBRARIES:
|
||||||
|
# List of libraries (CMake target names), separated by ';'. Needs
|
||||||
|
# quotes if more than one library is needed, e.g. "fltk_gl;fltk"
|
||||||
|
#
|
||||||
|
# CREATE_EXAMPLE can have an optional fourth argument with a list of options
|
||||||
|
# - the option ANDROID_OK is set if CREATE_EXAMPLE creates code for Android
|
||||||
|
# builds in addition to the native build
|
||||||
|
#
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
macro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||||
|
|
||||||
|
set (srcs) # source files
|
||||||
|
set (flsrcs) # fluid source (.fl) files
|
||||||
|
set (TARGET_NAME ${NAME}) # CMake target name
|
||||||
|
set (FLUID_SOURCES) # generated sources
|
||||||
|
set (ICON_NAME) # macOS icon (max. one)
|
||||||
|
set (PLIST) # macOS .plist file (max. one)
|
||||||
|
set (RESOURCE_PATH) # macOS resource path
|
||||||
|
|
||||||
|
# rename target name "help" (reserved since CMake 2.8.12 and later)
|
||||||
|
# FIXME: not necessary in FLTK 1.4 but left for compatibility (06/2020)
|
||||||
|
|
||||||
|
if (${TARGET_NAME} STREQUAL "help")
|
||||||
|
set (TARGET_NAME "test_help")
|
||||||
|
endif (${TARGET_NAME} STREQUAL "help")
|
||||||
|
|
||||||
|
# filter input files for different handling (fluid, icon, plist, source)
|
||||||
|
|
||||||
|
foreach (src ${SOURCES})
|
||||||
|
if ("${src}" MATCHES "\\.fl$")
|
||||||
|
list (APPEND flsrcs ${src})
|
||||||
|
elseif ("${src}" MATCHES "\\.icns$")
|
||||||
|
set (ICON_NAME "${src}")
|
||||||
|
elseif ("${src}" MATCHES "\\.plist$")
|
||||||
|
set (PLIST "${src}")
|
||||||
|
else ()
|
||||||
|
list (APPEND srcs ${src})
|
||||||
|
endif ("${src}" MATCHES "\\.fl$")
|
||||||
|
endforeach (src)
|
||||||
|
|
||||||
|
if (flsrcs)
|
||||||
|
FLTK_RUN_FLUID (FLUID_SOURCES "${flsrcs}")
|
||||||
|
endif (flsrcs)
|
||||||
|
|
||||||
|
## FIXME ## #############################################################
|
||||||
|
## FIXME ## The macOS specific code needs reorganization/simplification
|
||||||
|
## FIXME ## -- Albrecht (06/2020)
|
||||||
|
## FIXME ## =============================================================
|
||||||
|
## FIXME ## Use "new" function `FLTK_SET_BUNDLE_ICON()` (?)
|
||||||
|
## FIXME ## -- see CMake/FLTK-Functions.cmake (may need some tweaks)
|
||||||
|
## FIXME ## -- ported from FLTK 1.3 (06/2020)
|
||||||
|
## FIXME ## #############################################################
|
||||||
|
|
||||||
|
if (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL))
|
||||||
|
|
||||||
|
## -- Code from FLTK 1.3 for reference (variable names adjusted):
|
||||||
|
## add_executable (${TARGET_NAME} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${ICON_NAME})
|
||||||
|
## if (ICON_NAME)
|
||||||
|
## FLTK_SET_BUNDLE_ICON (${TARGET_NAME} ${ICON_NAME})
|
||||||
|
## endif ()
|
||||||
|
## -- End of code from FLTK 1.3
|
||||||
|
|
||||||
|
if (ICON_NAME)
|
||||||
|
set (RESOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_NAME}.app/Contents/Resources/${ICON_NAME}")
|
||||||
|
elseif (${TARGET_NAME} STREQUAL "demo")
|
||||||
|
set (RESOURCE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/demo.menu")
|
||||||
|
endif (ICON_NAME)
|
||||||
|
|
||||||
|
if (RESOURCE_PATH)
|
||||||
|
add_executable (${TARGET_NAME} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${RESOURCE_PATH})
|
||||||
|
if (${TARGET_NAME} STREQUAL "demo")
|
||||||
|
target_compile_definitions (demo PUBLIC USING_XCODE)
|
||||||
|
endif (${TARGET_NAME} STREQUAL "demo")
|
||||||
|
else ()
|
||||||
|
add_executable (${TARGET_NAME} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES})
|
||||||
|
endif (RESOURCE_PATH)
|
||||||
|
else ()
|
||||||
|
add_executable (${TARGET_NAME} WIN32 ${srcs} ${FLUID_SOURCES})
|
||||||
|
endif (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL))
|
||||||
|
|
||||||
|
set_target_properties (${TARGET_NAME}
|
||||||
|
PROPERTIES OUTPUT_NAME ${NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (APPLE AND RESOURCE_PATH)
|
||||||
|
if (ICON_NAME)
|
||||||
|
set_target_properties (${TARGET_NAME} PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
||||||
|
endif (ICON_NAME)
|
||||||
|
set_target_properties (${TARGET_NAME} PROPERTIES RESOURCE ${RESOURCE_PATH})
|
||||||
|
endif (APPLE AND RESOURCE_PATH)
|
||||||
|
|
||||||
|
if (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL) AND PLIST)
|
||||||
|
set_target_properties (${TARGET_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/${PLIST}")
|
||||||
|
endif (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL) AND PLIST)
|
||||||
|
|
||||||
|
target_link_libraries (${TARGET_NAME} ${LIBRARIES})
|
||||||
|
|
||||||
|
# Parse optional fourth argument 'ANDROID_OK', see description above.
|
||||||
|
|
||||||
|
if (${ARGC} GREATER 3)
|
||||||
|
foreach (OPTION ${ARGV3})
|
||||||
|
if (${OPTION} STREQUAL ANDROID_OK AND OPTION_CREATE_ANDROID_STUDIO_IDE)
|
||||||
|
CREATE_ANDROID_IDE_FOR_TEST (${NAME} ${SOURCES} ${LIBRARIES})
|
||||||
|
endif ()
|
||||||
|
endforeach ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
endmacro (CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
#
|
||||||
|
# Macro used by the CMake build system for the Fast Light Tool Kit (FLTK).
|
||||||
|
# Written by Michael Surette
|
||||||
|
#
|
||||||
|
# Copyright 1998-2020 by Bill Spitzak and others.
|
||||||
|
#
|
||||||
|
# This library is free software. Distribution and use rights are outlined in
|
||||||
|
# the file "COPYING" which should have been included with this file. If this
|
||||||
|
# file is missing or damaged, see the license at:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/COPYING.php
|
||||||
|
#
|
||||||
|
# Please see the following page on how to report bugs and issues:
|
||||||
|
#
|
||||||
|
# https://www.fltk.org/bugs.php
|
||||||
|
#
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# fl_debug_var - a macro to output debugging info
|
||||||
|
#######################################################################
|
||||||
|
#
|
||||||
|
# This macro displays the name and value of a CMake variable.
|
||||||
|
# The variable name is expanded with spaces to be (at least)
|
||||||
|
# <min_len> (currently 24) characters wide for better readability.
|
||||||
|
# VARNAME must be a string literal, e.g. WIN32 or "WIN32".
|
||||||
|
#
|
||||||
|
# Syntax:
|
||||||
|
# fl_debug_var(VARNAME)
|
||||||
|
#
|
||||||
|
# Example:
|
||||||
|
# fl_debug_var(WIN32)
|
||||||
|
# fl_debug_var("UNIX")
|
||||||
|
#
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
macro (fl_debug_var name)
|
||||||
|
set (min_len 24)
|
||||||
|
set (var "${name}")
|
||||||
|
string(LENGTH "${var}" len)
|
||||||
|
while (len LESS min_len)
|
||||||
|
# add one space until min_len is reached
|
||||||
|
# ** string(APPEND var " ") # requires CMake 3.4.x (otherwise loop...)
|
||||||
|
set (var "${var} ")
|
||||||
|
string(LENGTH "${var}" len)
|
||||||
|
endwhile (len LESS min_len)
|
||||||
|
message (STATUS "${var} = '${${name}}'")
|
||||||
|
endmacro (fl_debug_var)
|
||||||
+18
-7
@@ -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)
|
||||||
# Written by Michael Surette
|
# Written by Michael Surette
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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
|
||||||
@@ -29,12 +29,13 @@ add_custom_target(uninstall
|
|||||||
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/FL
|
install (DIRECTORY
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/FL
|
||||||
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
||||||
PATTERN ".svn" EXCLUDE
|
|
||||||
)
|
)
|
||||||
|
|
||||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/FL
|
install (DIRECTORY
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/FL
|
||||||
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
DESTINATION ${FLTK_INCLUDEDIR} USE_SOURCE_PERMISSIONS
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -58,7 +59,13 @@ configure_file(
|
|||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake
|
install (FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/etc/FLTKConfig.cmake
|
||||||
|
DESTINATION ${FLTK_CONFIG_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
install (FILES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/CMake/FLTK-Functions.cmake
|
||||||
DESTINATION ${FLTK_CONFIG_PATH}
|
DESTINATION ${FLTK_CONFIG_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,7 +75,9 @@ configure_file(
|
|||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/UseFLTK.cmake
|
# Deprecated: install UseFLTK.cmake with deprecation warnings only
|
||||||
|
install (FILES
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/etc/UseFLTK.cmake
|
||||||
DESTINATION ${FLTK_CONFIG_PATH}
|
DESTINATION ${FLTK_CONFIG_PATH}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -87,13 +96,15 @@ configure_file(
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config"
|
"${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config"
|
||||||
@ONLY
|
@ONLY
|
||||||
)
|
)
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
execute_process (COMMAND chmod 755 fltk-config
|
execute_process (COMMAND chmod 755 fltk-config
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
||||||
)
|
)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config
|
install (PROGRAMS
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/bin/fltk-config
|
||||||
DESTINATION ${FLTK_BINDIR}
|
DESTINATION ${FLTK_BINDIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,204 +0,0 @@
|
|||||||
#
|
|
||||||
# Macros used by the CMake build system for the Fast Light Tool Kit (FLTK).
|
|
||||||
# Written by Michael Surette
|
|
||||||
#
|
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
|
||||||
#
|
|
||||||
# This library is free software. Distribution and use rights are outlined in
|
|
||||||
# the file "COPYING" which should have been included with this file. If this
|
|
||||||
# file is missing or damaged, see the license at:
|
|
||||||
#
|
|
||||||
# https://www.fltk.org/COPYING.php
|
|
||||||
#
|
|
||||||
# Please see the following page on how to report bugs and issues:
|
|
||||||
#
|
|
||||||
# https://www.fltk.org/bugs.php
|
|
||||||
#
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# macros used for debugging purposes
|
|
||||||
#######################################################################
|
|
||||||
|
|
||||||
# This macro displays the name and value of a CMake variable.
|
|
||||||
# The variable name is expanded with spaces to be (at least)
|
|
||||||
# <min_len> (currently 24) characters wide for better readability.
|
|
||||||
# VARNAME must be a string literal, e.g. WIN32 or "WIN32".
|
|
||||||
#
|
|
||||||
# Syntax:
|
|
||||||
# fl_debug_var(VARNAME)
|
|
||||||
#
|
|
||||||
# Example:
|
|
||||||
# fl_debug_var(WIN32)
|
|
||||||
# fl_debug_var("UNIX")
|
|
||||||
#
|
|
||||||
|
|
||||||
macro (fl_debug_var name)
|
|
||||||
set (min_len 24)
|
|
||||||
set (var "${name}")
|
|
||||||
string(LENGTH "${var}" len)
|
|
||||||
while (len LESS min_len)
|
|
||||||
# add one space until min_len is reached
|
|
||||||
# ** string(APPEND var " ") # requires CMake 3.4.x (otherwise loop...)
|
|
||||||
set (var "${var} ")
|
|
||||||
string(LENGTH "${var}" len)
|
|
||||||
endwhile (len LESS min_len)
|
|
||||||
message (STATUS "${var} = '${${name}}'")
|
|
||||||
endmacro (fl_debug_var)
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# macros used by the build system
|
|
||||||
#######################################################################
|
|
||||||
macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
|
||||||
|
|
||||||
if (${LIBTYPE} STREQUAL "SHARED")
|
|
||||||
set (TARGET_NAME ${LIBNAME}_SHARED)
|
|
||||||
else ()
|
|
||||||
set (TARGET_NAME ${LIBNAME})
|
|
||||||
endif (${LIBTYPE} STREQUAL "SHARED")
|
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
set (DEBUG_OUTPUT_NAME "${LIBNAME}d")
|
|
||||||
else ()
|
|
||||||
set (DEBUG_OUTPUT_NAME "${LIBNAME}")
|
|
||||||
endif (MSVC)
|
|
||||||
|
|
||||||
add_library(${TARGET_NAME} ${LIBTYPE} ${LIBFILES})
|
|
||||||
|
|
||||||
set_target_properties(${TARGET_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
OUTPUT_NAME ${LIBNAME}
|
|
||||||
DEBUG_OUTPUT_NAME ${DEBUG_OUTPUT_NAME}
|
|
||||||
CLEAN_DIRECT_OUTPUT TRUE
|
|
||||||
COMPILE_DEFINITIONS "FL_LIBRARY"
|
|
||||||
)
|
|
||||||
|
|
||||||
if (${LIBTYPE} STREQUAL "SHARED")
|
|
||||||
set_target_properties(${TARGET_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
OUTPUT_NAME ${LIBNAME}
|
|
||||||
DEBUG_OUTPUT_NAME ${DEBUG_OUTPUT_NAME}
|
|
||||||
VERSION ${FLTK_VERSION_FULL}
|
|
||||||
SOVERSION ${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
|
|
||||||
PREFIX "lib" # for MSVC static/shared coexistence
|
|
||||||
)
|
|
||||||
endif (${LIBTYPE} STREQUAL "SHARED")
|
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
if (OPTION_LARGE_FILE)
|
|
||||||
set_target_properties(${TARGET_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
LINK_FLAGS /LARGEADDRESSAWARE
|
|
||||||
)
|
|
||||||
endif (OPTION_LARGE_FILE)
|
|
||||||
|
|
||||||
if (${LIBTYPE} STREQUAL "SHARED")
|
|
||||||
set_target_properties(${TARGET_NAME}
|
|
||||||
PROPERTIES
|
|
||||||
COMPILE_DEFINITIONS "FL_DLL"
|
|
||||||
)
|
|
||||||
endif (${LIBTYPE} STREQUAL "SHARED")
|
|
||||||
endif (MSVC)
|
|
||||||
|
|
||||||
install(TARGETS ${TARGET_NAME}
|
|
||||||
EXPORT FLTK-Targets
|
|
||||||
RUNTIME DESTINATION ${FLTK_BINDIR}
|
|
||||||
LIBRARY DESTINATION ${FLTK_LIBDIR}
|
|
||||||
ARCHIVE DESTINATION ${FLTK_LIBDIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
list(APPEND FLTK_LIBRARIES "${TARGET_NAME}")
|
|
||||||
set (FLTK_LIBRARIES ${FLTK_LIBRARIES} PARENT_SCOPE)
|
|
||||||
|
|
||||||
endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
|
|
||||||
function(FLTK_RUN_FLUID TARGET SOURCES)
|
|
||||||
set (CXX_FILES)
|
|
||||||
foreach(src ${SOURCES})
|
|
||||||
if ("${src}" MATCHES "\\.fl$")
|
|
||||||
string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT "${basename}.cxx" "${basename}.h"
|
|
||||||
COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
|
|
||||||
DEPENDS ${src}
|
|
||||||
MAIN_DEPENDENCY ${src}
|
|
||||||
)
|
|
||||||
list(APPEND CXX_FILES "${basename}.cxx")
|
|
||||||
endif ("${src}" MATCHES "\\.fl$")
|
|
||||||
set (${TARGET} ${CXX_FILES} PARENT_SCOPE)
|
|
||||||
endforeach(src)
|
|
||||||
endfunction(FLTK_RUN_FLUID TARGET SOURCES)
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|
||||||
|
|
||||||
set (srcs) # source files
|
|
||||||
set (flsrcs) # fluid source files
|
|
||||||
|
|
||||||
set (tname ${NAME}) # target name
|
|
||||||
set (oname ${NAME}) # output (executable) name
|
|
||||||
|
|
||||||
foreach(src ${SOURCES})
|
|
||||||
if ("${src}" MATCHES "\\.fl$")
|
|
||||||
list(APPEND flsrcs ${src})
|
|
||||||
else ()
|
|
||||||
list(APPEND srcs ${src})
|
|
||||||
endif ("${src}" MATCHES "\\.fl$")
|
|
||||||
endforeach(src)
|
|
||||||
|
|
||||||
set (FLUID_SOURCES)
|
|
||||||
if (flsrcs)
|
|
||||||
FLTK_RUN_FLUID(FLUID_SOURCES "${flsrcs}")
|
|
||||||
endif (flsrcs)
|
|
||||||
|
|
||||||
if (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL))
|
|
||||||
unset (RESOURCE_PATH)
|
|
||||||
if (${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
|
|
||||||
set (ICON_NAME ${tname}.icns)
|
|
||||||
set (RESOURCE_PATH "${PROJECT_SOURCE_DIR}/test/${tname}.app/Contents/Resources/${ICON_NAME}")
|
|
||||||
elseif (${tname} STREQUAL "demo")
|
|
||||||
set (RESOURCE_PATH "${PROJECT_SOURCE_DIR}/test/demo.menu")
|
|
||||||
endif (${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
|
|
||||||
|
|
||||||
if (DEFINED RESOURCE_PATH)
|
|
||||||
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${RESOURCE_PATH})
|
|
||||||
if (${tname} STREQUAL "demo")
|
|
||||||
target_compile_definitions(demo PUBLIC USING_XCODE)
|
|
||||||
endif (${tname} STREQUAL "demo")
|
|
||||||
else ()
|
|
||||||
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES})
|
|
||||||
endif (DEFINED RESOURCE_PATH)
|
|
||||||
else ()
|
|
||||||
add_executable(${tname} WIN32 ${srcs} ${FLUID_SOURCES})
|
|
||||||
endif (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL))
|
|
||||||
|
|
||||||
set_target_properties(${tname}
|
|
||||||
PROPERTIES OUTPUT_NAME ${oname}
|
|
||||||
)
|
|
||||||
if (APPLE AND DEFINED RESOURCE_PATH)
|
|
||||||
if (NOT ${tname} STREQUAL "demo")
|
|
||||||
set_target_properties(${tname} PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
|
||||||
endif (NOT ${tname} STREQUAL "demo")
|
|
||||||
set_target_properties(${tname} PROPERTIES RESOURCE ${RESOURCE_PATH})
|
|
||||||
endif (APPLE AND DEFINED RESOURCE_PATH)
|
|
||||||
if (APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL) AND ${tname} STREQUAL "editor")
|
|
||||||
set_target_properties("editor" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/test/editor-Info.plist" )
|
|
||||||
endif(APPLE AND (NOT OPTION_APPLE_X11) AND (NOT OPTION_APPLE_SDL) AND ${tname} STREQUAL "editor")
|
|
||||||
|
|
||||||
target_link_libraries(${tname} ${LIBRARIES})
|
|
||||||
|
|
||||||
# CREATE_EXAMPLE can have an optional fourth argument with a list of options
|
|
||||||
# - the option ANDROID_OK is set if CREATE_EXAMPLE creates code for Androids
|
|
||||||
# builds in addition to the native build
|
|
||||||
if (${ARGC} GREATER 3)
|
|
||||||
foreach(OPTION ${ARGV3})
|
|
||||||
if (${OPTION} STREQUAL ANDROID_OK AND OPTION_CREATE_ANDROID_STUDIO_IDE)
|
|
||||||
CREATE_ANDROID_IDE_FOR_TEST(${NAME} ${SOURCES} ${LIBRARIES})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
endmacro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
+4
-25
@@ -22,23 +22,6 @@ if (DEBUG_OPTIONS_CMAKE)
|
|||||||
fl_debug_var (FLTK_LDLIBS)
|
fl_debug_var (FLTK_LDLIBS)
|
||||||
endif (DEBUG_OPTIONS_CMAKE)
|
endif (DEBUG_OPTIONS_CMAKE)
|
||||||
|
|
||||||
#######################################################################
|
|
||||||
# *Temporary* option to modify header file searches
|
|
||||||
#######################################################################
|
|
||||||
# Note: The old, deprecated behavior (ON) was to use find_file() for
|
|
||||||
# header searches, the new behavior (ON) is to use check_include_files()
|
|
||||||
# which seems to be more reliable but more difficult to set up and
|
|
||||||
# slower because it uses a compilation test. Default is "new" (OFF).
|
|
||||||
# This option should be removed as soon as the new search strategy
|
|
||||||
# is considered stable.
|
|
||||||
# Currently used only in resources.cmake.
|
|
||||||
#######################################################################
|
|
||||||
option(USE_FIND_FILE
|
|
||||||
"Deprecated: use find_file() for header searches. Should be OFF."
|
|
||||||
OFF
|
|
||||||
)
|
|
||||||
mark_as_advanced(USE_FIND_FILE)
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# options
|
# options
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -66,6 +49,7 @@ set(FL_ABI_VERSION ${OPTION_ABI_VERSION})
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
option (OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
|
option (OPTION_CREATE_LINKS "create backwards compatibility links" OFF)
|
||||||
|
list (APPEND FLTK_LDLIBS -lm)
|
||||||
endif (UNIX)
|
endif (UNIX)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -194,7 +178,7 @@ if(OPTION_USE_GL)
|
|||||||
if (OPTION_APPLE_X11)
|
if (OPTION_APPLE_X11)
|
||||||
set (OPENGL_FOUND TRUE)
|
set (OPENGL_FOUND TRUE)
|
||||||
set (OPENGL_LIBRARIES -L${PATH_TO_XLIBS} -lGLU -lGL)
|
set (OPENGL_LIBRARIES -L${PATH_TO_XLIBS} -lGLU -lGL)
|
||||||
set(HAVE_GL_GLU_H /opt/X11/include/GL/glu.h)
|
find_file (HAVE_GL_GLU_H GL/glu.h PATHS /opt/X11/include)
|
||||||
elseif (OPTION_APPLE_SDL)
|
elseif (OPTION_APPLE_SDL)
|
||||||
set (OPENGL_FOUND FALSE)
|
set (OPENGL_FOUND FALSE)
|
||||||
else()
|
else()
|
||||||
@@ -567,16 +551,12 @@ endif(OPTION_FILESYSTEM_SUPPORT)
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
option (OPTION_CREATE_ANDROID_STUDIO_IDE "create files needed to compile FLtk for Android" OFF)
|
option (OPTION_CREATE_ANDROID_STUDIO_IDE "create files needed to compile FLTK for Android" OFF)
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# prior to CMake 3.0 this feature was buggy
|
option (CMAKE_SUPPRESS_REGENERATION "suppress rules to re-run CMake on rebuild" OFF)
|
||||||
if(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
|
|
||||||
option(CMAKE_SUPPRESS_REGENERATION
|
|
||||||
"suppress rules to re-run CMake on rebuild" OFF)
|
|
||||||
mark_as_advanced (CMAKE_SUPPRESS_REGENERATION)
|
mark_as_advanced (CMAKE_SUPPRESS_REGENERATION)
|
||||||
endif(NOT CMAKE_VERSION VERSION_LESS 3.0.0)
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# Debugging ...
|
# Debugging ...
|
||||||
@@ -587,7 +567,6 @@ if (DEBUG_OPTIONS_CMAKE)
|
|||||||
fl_debug_var (LIBS)
|
fl_debug_var (LIBS)
|
||||||
fl_debug_var (GLLIBS)
|
fl_debug_var (GLLIBS)
|
||||||
fl_debug_var (FLTK_LDLIBS)
|
fl_debug_var (FLTK_LDLIBS)
|
||||||
fl_debug_var (USE_FIND_FILE)
|
|
||||||
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)
|
||||||
|
|||||||
+6
-31
@@ -1,8 +1,8 @@
|
|||||||
#
|
#
|
||||||
# Main CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
# Resource definitions to build the FLTK project using CMake (www.cmake.org)
|
||||||
# Written by Michael Surette
|
# Written by Michael Surette
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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,38 +19,17 @@
|
|||||||
# check for headers, libraries and functions
|
# check for headers, libraries and functions
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
# The following code is work in progress (as of Feb 2018) - AlbrechtS
|
# If CMAKE_REQUIRED_QUIET is 1 (default) the search is mostly quiet,
|
||||||
|
# if it is 0 (or not defined) check_include_files() is more verbose
|
||||||
# The cache option USE_FIND_FILE can be set to ON to switch back to the old
|
# and the result of the search is logged with fl_debug_var().
|
||||||
# behavior that tries to find headers by find_file() which appears to be
|
|
||||||
# error prone at least under Windows when MSYS2 and MinGW are both
|
|
||||||
# installed on one system.
|
|
||||||
# If USE_FIND_FILE is OFF (new behavior), then headers are searched for by
|
|
||||||
# check_include_files() which tries to compile a small file to test if
|
|
||||||
# the header file can be used. In some cases this needs more than one
|
|
||||||
# header in a list because another header must be included before the
|
|
||||||
# header being searched for.
|
|
||||||
# Example: X11/Xlib.h must be included before X11/Xregion.h so Xregion.h
|
|
||||||
# can be compiled successfully.
|
|
||||||
|
|
||||||
# If CMAKE_REQUIRED_QUIET is 1 (default) the search is mostly quiet, if
|
|
||||||
# it is 0 (or not defined) check_include_files() is more verbose and
|
|
||||||
# the result of the search is logged with fl_debug_var().
|
|
||||||
# This is useful for debugging.
|
# This is useful for debugging.
|
||||||
|
|
||||||
set (CMAKE_REQUIRED_QUIET 1)
|
set (CMAKE_REQUIRED_QUIET 1)
|
||||||
|
|
||||||
include (CheckIncludeFiles)
|
include (CheckIncludeFiles)
|
||||||
|
|
||||||
# The following macro is used to switch between old and new behavior.
|
|
||||||
# Once this is stable (USE_FIND_FILE = 0) the unused part may be removed.
|
|
||||||
|
|
||||||
macro (fl_find_header VAR HEADER)
|
macro (fl_find_header VAR HEADER)
|
||||||
if (USE_FIND_FILE)
|
|
||||||
find_file (${VAR} "${HEADER}")
|
|
||||||
else (USE_FIND_FILE)
|
|
||||||
check_include_files ("${HEADER}" ${VAR})
|
check_include_files ("${HEADER}" ${VAR})
|
||||||
endif (USE_FIND_FILE)
|
|
||||||
if (NOT CMAKE_REQUIRED_QUIET)
|
if (NOT CMAKE_REQUIRED_QUIET)
|
||||||
fl_debug_var (${VAR})
|
fl_debug_var (${VAR})
|
||||||
endif (NOT CMAKE_REQUIRED_QUIET)
|
endif (NOT CMAKE_REQUIRED_QUIET)
|
||||||
@@ -70,13 +49,8 @@ fl_find_header (HAVE_STRINGS_H strings.h)
|
|||||||
fl_find_header (HAVE_SYS_SELECT_H sys/select.h)
|
fl_find_header (HAVE_SYS_SELECT_H sys/select.h)
|
||||||
fl_find_header (HAVE_SYS_STDTYPES_H sys/stdtypes.h)
|
fl_find_header (HAVE_SYS_STDTYPES_H sys/stdtypes.h)
|
||||||
|
|
||||||
if (USE_FIND_FILE)
|
|
||||||
fl_find_header (HAVE_X11_XREGION_H "X11/Xregion.h")
|
|
||||||
fl_find_header (HAVE_XDBE_H "X11/extensions/Xdbe.h")
|
|
||||||
else ()
|
|
||||||
fl_find_header (HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
|
fl_find_header (HAVE_X11_XREGION_H "X11/Xlib.h;X11/Xregion.h")
|
||||||
fl_find_header (HAVE_XDBE_H "X11/Xlib.h;X11/extensions/Xdbe.h")
|
fl_find_header (HAVE_XDBE_H "X11/Xlib.h;X11/extensions/Xdbe.h")
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WIN32 AND NOT CYGWIN)
|
if (WIN32 AND NOT CYGWIN)
|
||||||
# we don't use pthreads on Windows (except for Cygwin, see options.cmake)
|
# we don't use pthreads on Windows (except for Cygwin, see options.cmake)
|
||||||
@@ -139,6 +113,7 @@ endif (MSVC)
|
|||||||
# once we found the first suitable header file.
|
# once we found the first suitable header file.
|
||||||
|
|
||||||
fl_find_header (HAVE_DIRENT_H dirent.h)
|
fl_find_header (HAVE_DIRENT_H dirent.h)
|
||||||
|
|
||||||
if (NOT HAVE_DIRENT_H)
|
if (NOT HAVE_DIRENT_H)
|
||||||
fl_find_header (HAVE_SYS_NDIR_H sys/ndir.h)
|
fl_find_header (HAVE_SYS_NDIR_H sys/ndir.h)
|
||||||
if (NOT HAVE_SYS_NDIR_H)
|
if (NOT HAVE_SYS_NDIR_H)
|
||||||
|
|||||||
+4
-19
@@ -2,7 +2,7 @@
|
|||||||
# CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
# CMakeLists.txt to build the FLTK project using CMake (www.cmake.org)
|
||||||
# Written by Michael Surette
|
# Written by Michael Surette
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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,13 +19,6 @@
|
|||||||
# basic setup
|
# basic setup
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
# The FLTK version
|
|
||||||
set(FLTK_VERSION_MAJOR "1")
|
|
||||||
set(FLTK_VERSION_MINOR "4")
|
|
||||||
set(FLTK_VERSION_PATCH "0")
|
|
||||||
set(FLTK_VERSION "${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}")
|
|
||||||
set(FLTK_VERSION_FULL "${FLTK_VERSION}.${FLTK_VERSION_PATCH}")
|
|
||||||
|
|
||||||
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||||
set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
set (LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||||
set (ARCHIVE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
set (ARCHIVE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
||||||
@@ -40,18 +33,10 @@ include_directories(${FLTK_INCLUDE_DIRS})
|
|||||||
# Used for instance to find the source directory for doxygen docs
|
# Used for instance to find the source directory for doxygen docs
|
||||||
set (FLTK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
set (FLTK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
# Setup install locations
|
# Setup install locations (requires CMake 2.8.4)
|
||||||
if(CMAKE_VERSION VERSION_GREATER 2.8.4)
|
|
||||||
# Use GNUInstallDirs if available.
|
|
||||||
include(GNUInstallDirs)
|
include(GNUInstallDirs)
|
||||||
else()
|
|
||||||
# Else set reasonable defaults.
|
|
||||||
set(CMAKE_INSTALL_BINDIR bin)
|
|
||||||
set(CMAKE_INSTALL_LIBDIR lib)
|
|
||||||
set(CMAKE_INSTALL_INCLUDEDIR include)
|
|
||||||
set(CMAKE_INSTALL_DATADIR share)
|
|
||||||
set(CMAKE_INSTALL_MANDIR share/man)
|
|
||||||
endif(CMAKE_VERSION VERSION_GREATER 2.8.4)
|
|
||||||
|
|
||||||
set (FLTK_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH
|
set (FLTK_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE PATH
|
||||||
"Binary install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
"Binary install path relative to CMAKE_INSTALL_PREFIX unless set to an absolute path.")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
# This file sets variables for common use in export.cmake and install.cmake
|
# This file sets variables for common use in export.cmake and install.cmake
|
||||||
# Written by Michael Surette
|
# Written by Michael Surette
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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,9 +16,6 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
set (FL_MAJOR_VERSION ${FLTK_VERSION_MAJOR})
|
|
||||||
set (FL_MINOR_VERSION ${FLTK_VERSION_MINOR})
|
|
||||||
set (FL_PATCH_VERSION ${FLTK_VERSION_PATCH})
|
|
||||||
|
|
||||||
set (DEBUG_VARIABLES_CMAKE 0)
|
set (DEBUG_VARIABLES_CMAKE 0)
|
||||||
if (DEBUG_VARIABLES_CMAKE)
|
if (DEBUG_VARIABLES_CMAKE)
|
||||||
|
|||||||
+75
-9
@@ -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)
|
||||||
# Written by Michael Surette
|
# Written by Michael Surette
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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,17 +15,39 @@
|
|||||||
# https://www.fltk.org/bugs.php
|
# https://www.fltk.org/bugs.php
|
||||||
#
|
#
|
||||||
|
|
||||||
# Prevent annoying warning under Cygwin; this must be before project().
|
#######################################################################
|
||||||
# Remove when CMake >= 2.8.4 is required
|
# set CMake minimum version (must be before `project()`
|
||||||
set(CMAKE_LEGACY_CYGWIN_WIN32 0)
|
#######################################################################
|
||||||
|
|
||||||
project(FLTK)
|
# Note: previous (1.3.x) minimum version
|
||||||
cmake_minimum_required(VERSION 2.6.3)
|
# cmake_minimum_required (VERSION 2.6.3)
|
||||||
|
|
||||||
|
# Note: minimum CMake version required by GNUInstallDirs
|
||||||
|
# cmake_minimum_required (VERSION 2.8.4)
|
||||||
|
|
||||||
|
# Minimum CMake version required by FLTK 1.4 (06/2020, work in progress)
|
||||||
|
cmake_minimum_required (VERSION 3.2.3 FATAL_ERROR)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# define some macros
|
# define the FLTK project and version
|
||||||
#######################################################################
|
#######################################################################
|
||||||
include(CMake/macros.cmake)
|
|
||||||
|
project (FLTK VERSION 1.4.0)
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# include macro definitions of generally used macros
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
include (CMake/fl_debug_var.cmake)
|
||||||
|
include (CMake/fl_add_library.cmake)
|
||||||
|
|
||||||
|
if (false)
|
||||||
|
fl_debug_var (FLTK_VERSION_MAJOR)
|
||||||
|
fl_debug_var (FLTK_VERSION_MINOR)
|
||||||
|
fl_debug_var (FLTK_VERSION_PATCH)
|
||||||
|
fl_debug_var (FLTK_VERSION)
|
||||||
|
fl_debug_var (FLTK_VERSION)
|
||||||
|
endif (false)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# basic setup
|
# basic setup
|
||||||
@@ -49,12 +71,12 @@ if (OPTION_CREATE_ANDROID_STUDIO_IDE)
|
|||||||
include (CMake/android.cmake)
|
include (CMake/android.cmake)
|
||||||
endif (OPTION_CREATE_ANDROID_STUDIO_IDE)
|
endif (OPTION_CREATE_ANDROID_STUDIO_IDE)
|
||||||
|
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# print (debug) several build variables and options
|
# print (debug) several build variables and options
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
set (debug_build 0) # set to 1 to show debug info
|
set (debug_build 0) # set to 1 to show debug info
|
||||||
|
|
||||||
if (debug_build)
|
if (debug_build)
|
||||||
message ("")
|
message ("")
|
||||||
message (STATUS "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt: set debug_build to 0 to disable the following info:")
|
message (STATUS "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt: set debug_build to 0 to disable the following info:")
|
||||||
@@ -73,6 +95,7 @@ if (debug_build)
|
|||||||
fl_debug_var (CMAKE_EXE_LINKER_FLAGS)
|
fl_debug_var (CMAKE_EXE_LINKER_FLAGS)
|
||||||
message (STATUS "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt: end of debug_build info.")
|
message (STATUS "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt: end of debug_build info.")
|
||||||
endif (debug_build)
|
endif (debug_build)
|
||||||
|
|
||||||
unset (debug_build)
|
unset (debug_build)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -112,3 +135,46 @@ endif (OPTION_CREATE_ANDROID_STUDIO_IDE)
|
|||||||
# installation
|
# installation
|
||||||
#######################################################################
|
#######################################################################
|
||||||
include (CMake/install.cmake)
|
include (CMake/install.cmake)
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# Generate Library Export Headers *** EXPERIMENTAL *** WIP ***
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
# Enable (1) or disable (0) generation of experimental headers (WIP)
|
||||||
|
set (GENERATE_EXPORT_HEADERS 0)
|
||||||
|
|
||||||
|
if (OPTION_BUILD_SHARED_LIBS AND GENERATE_EXPORT_HEADERS)
|
||||||
|
|
||||||
|
include (GenerateExportHeader)
|
||||||
|
|
||||||
|
generate_export_header (fltk_SHARED
|
||||||
|
BASE_NAME fl
|
||||||
|
EXPORT_FILE_NAME FL/fltk_export.h
|
||||||
|
STATIC_DEFINE FL_STATIC_LIB
|
||||||
|
)
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
|
||||||
|
# Visual Studio builds only one shared lib (DLL)
|
||||||
|
|
||||||
|
generate_export_header (fltk_images_SHARED
|
||||||
|
BASE_NAME fl_images
|
||||||
|
EXPORT_FILE_NAME FL/fltk_images_export.h
|
||||||
|
STATIC_DEFINE FL_STATIC_LIB
|
||||||
|
)
|
||||||
|
|
||||||
|
generate_export_header (fltk_forms_SHARED
|
||||||
|
BASE_NAME fl_forms
|
||||||
|
EXPORT_FILE_NAME FL/fltk_forms_export.h
|
||||||
|
STATIC_DEFINE FL_STATIC_LIB
|
||||||
|
)
|
||||||
|
|
||||||
|
generate_export_header (fltk_gl_SHARED
|
||||||
|
BASE_NAME fl_gl
|
||||||
|
EXPORT_FILE_NAME FL/fltk_gl_export.h
|
||||||
|
STATIC_DEFINE FL_STATIC_LIB
|
||||||
|
)
|
||||||
|
|
||||||
|
endif (NOT MSVC)
|
||||||
|
|
||||||
|
endif (OPTION_BUILD_SHARED_LIBS AND GENERATE_EXPORT_HEADERS)
|
||||||
|
|||||||
+3
-3
@@ -552,9 +552,9 @@ add_executable(CubeView WIN32 CubeMain.cxx CubeView.cxx CubeViewUI.cxx)
|
|||||||
target_link_libraries(CubeView fltk fltk_gl)
|
target_link_libraries(CubeView fltk fltk_gl)
|
||||||
---
|
---
|
||||||
|
|
||||||
You can repeat the add_custom_command for each fluid file or if you have
|
You can repeat the add_custom_command for each fluid file or if you
|
||||||
a large number of them see the CMake/macros.cmake function FLTK_RUN_FLUID
|
have a large number of them see the CMake/FLTK-Functions.cmake function
|
||||||
for an example of how to run it in a loop.
|
FLTK_RUN_FLUID for an example of how to run it in a loop.
|
||||||
|
|
||||||
The two lines
|
The two lines
|
||||||
|
|
||||||
|
|||||||
+11
-10
@@ -56,19 +56,20 @@ case $host_os in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
dnl FLTK library versions...
|
dnl FLTK library versions...
|
||||||
FL_MAJOR_VERSION=1
|
FLTK_VERSION_MAJOR=1
|
||||||
FL_MINOR_VERSION=4
|
FLTK_VERSION_MINOR=4
|
||||||
FL_PATCH_VERSION=0
|
FLTK_VERSION_PATCH=0
|
||||||
FL_DSO_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}
|
FLTK_VERSION=${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}.${FLTK_VERSION_PATCH}
|
||||||
FL_ABI_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}.0
|
|
||||||
FL_VERSION=${FL_MAJOR_VERSION}.${FL_MINOR_VERSION}.${FL_PATCH_VERSION}
|
|
||||||
|
|
||||||
AC_SUBST(FL_MAJOR_VERSION)
|
FL_DSO_VERSION=${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}
|
||||||
AC_SUBST(FL_MINOR_VERSION)
|
FL_ABI_VERSION=${FLTK_VERSION_MAJOR}.${FLTK_VERSION_MINOR}.0
|
||||||
AC_SUBST(FL_PATCH_VERSION)
|
|
||||||
|
AC_SUBST(FLTK_VERSION_MAJOR)
|
||||||
|
AC_SUBST(FLTK_VERSION_MINOR)
|
||||||
|
AC_SUBST(FLTK_VERSION_PATCH)
|
||||||
|
AC_SUBST(FLTK_VERSION)
|
||||||
AC_SUBST(FL_DSO_VERSION)
|
AC_SUBST(FL_DSO_VERSION)
|
||||||
AC_SUBST(FL_ABI_VERSION)
|
AC_SUBST(FL_ABI_VERSION)
|
||||||
AC_SUBST(FL_VERSION)
|
|
||||||
|
|
||||||
AC_SUBST(ARCHFLAGS)
|
AC_SUBST(ARCHFLAGS)
|
||||||
AC_SUBST(OPTIM)
|
AC_SUBST(OPTIM)
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
set (DOCS)
|
set (DOCS)
|
||||||
|
|
||||||
set (FL_VERSION "${FLTK_VERSION_FULL}")
|
|
||||||
|
|
||||||
if (OPTION_INCLUDE_DRIVER_DOCUMENTATION)
|
if (OPTION_INCLUDE_DRIVER_DOCUMENTATION)
|
||||||
set (DRIVER_DOCS "DriverDev")
|
set (DRIVER_DOCS "DriverDev")
|
||||||
else ()
|
else ()
|
||||||
@@ -83,7 +81,6 @@ if (OPTION_BUILD_PDF_DOCUMENTATION)
|
|||||||
|
|
||||||
# generate LaTeX header fltk-book.tex
|
# generate LaTeX header fltk-book.tex
|
||||||
|
|
||||||
set(FL_VERSION ${FLTK_VERSION_FULL})
|
|
||||||
set (DOXY_VERSION ${DOXYGEN_VERSION})
|
set (DOXY_VERSION ${DOXYGEN_VERSION})
|
||||||
execute_process (COMMAND date +%Y
|
execute_process (COMMAND date +%Y
|
||||||
OUTPUT_VARIABLE YEAR
|
OUTPUT_VARIABLE YEAR
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ DOXYFILE_ENCODING = UTF-8
|
|||||||
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
|
||||||
# by quotes) that should identify the project.
|
# by quotes) that should identify the project.
|
||||||
|
|
||||||
PROJECT_NAME = "FLTK @FL_VERSION@"
|
PROJECT_NAME = "FLTK @FLTK_VERSION@"
|
||||||
|
|
||||||
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
|
||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ uninstall-linux uninstall-osx:
|
|||||||
|
|
||||||
Doxyfile: Doxyfile.in
|
Doxyfile: Doxyfile.in
|
||||||
echo "Generating Doxyfile ..."
|
echo "Generating Doxyfile ..."
|
||||||
sed -e's,@FL_VERSION@,$(FL_VERSION),' \
|
sed -e's,@FLTK_VERSION@,$(FLTK_VERSION),' \
|
||||||
-e's,@GENERATE_HTML@,YES,' \
|
-e's,@GENERATE_HTML@,YES,' \
|
||||||
-e's,@GENERATE_LATEX@,NO,' \
|
-e's,@GENERATE_LATEX@,NO,' \
|
||||||
-e's, @LATEX_HEADER@,,' \
|
-e's, @LATEX_HEADER@,,' \
|
||||||
@@ -142,7 +142,7 @@ Doxyfile: Doxyfile.in
|
|||||||
|
|
||||||
Doxybook: Doxyfile.in
|
Doxybook: Doxyfile.in
|
||||||
echo "Generating Doxybook ..."
|
echo "Generating Doxybook ..."
|
||||||
sed -e's,@FL_VERSION@,$(FL_VERSION),' \
|
sed -e's,@FLTK_VERSION@,$(FLTK_VERSION),' \
|
||||||
-e's,@GENERATE_HTML@,NO,' \
|
-e's,@GENERATE_HTML@,NO,' \
|
||||||
-e's,@GENERATE_LATEX@,YES,' \
|
-e's,@GENERATE_LATEX@,YES,' \
|
||||||
-e's,@LATEX_HEADER@,src/fltk-book.tex,' \
|
-e's,@LATEX_HEADER@,src/fltk-book.tex,' \
|
||||||
@@ -183,6 +183,6 @@ src/fltk-book.tex: src/fltk-book.tex.in
|
|||||||
DOXY_VERSION=`$(DOXYDOC) --version`; \
|
DOXY_VERSION=`$(DOXYDOC) --version`; \
|
||||||
YEAR=`date +%Y`; \
|
YEAR=`date +%Y`; \
|
||||||
sed -e"s/@YEAR@/$$YEAR/g" \
|
sed -e"s/@YEAR@/$$YEAR/g" \
|
||||||
-e"s/@FL_VERSION@/$(FL_VERSION)/g" \
|
-e"s/@FLTK_VERSION@/$(FLTK_VERSION)/g" \
|
||||||
-e"s/@DOXY_VERSION@/$$DOXY_VERSION/g" \
|
-e"s/@DOXY_VERSION@/$$DOXY_VERSION/g" \
|
||||||
< $< > $@
|
< $< > $@
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
\begin{titlepage}
|
\begin{titlepage}
|
||||||
\vspace*{5cm}
|
\vspace*{5cm}
|
||||||
\begin{center}%
|
\begin{center}%
|
||||||
{\Huge FLTK @FL_VERSION@ Programming Manual}\\
|
{\Huge FLTK @FLTK_VERSION@ Programming Manual}\\
|
||||||
\vspace*{2cm}
|
\vspace*{2cm}
|
||||||
\begin{DoxyImageNoCaption}
|
\begin{DoxyImageNoCaption}
|
||||||
\mbox{\includegraphics[width=6cm]{FL200.png}}
|
\mbox{\includegraphics[width=6cm]{FL200.png}}
|
||||||
|
|||||||
+3
-3
@@ -17,9 +17,9 @@
|
|||||||
# https://www.fltk.org/bugs.php
|
# https://www.fltk.org/bugs.php
|
||||||
#
|
#
|
||||||
|
|
||||||
MAJOR_VERSION=@FL_MAJOR_VERSION@
|
MAJOR_VERSION=@FLTK_VERSION_MAJOR@
|
||||||
MINOR_VERSION=@FL_MINOR_VERSION@
|
MINOR_VERSION=@FLTK_VERSION_MINOR@
|
||||||
PATCH_VERSION=@FL_PATCH_VERSION@
|
PATCH_VERSION=@FLTK_VERSION_PATCH@
|
||||||
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
|
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$PATCH_VERSION"
|
||||||
APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
|
APIVERSION="$MAJOR_VERSION.$MINOR_VERSION"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -21,7 +21,7 @@
|
|||||||
%vendor FLTK Development Team
|
%vendor FLTK Development Team
|
||||||
%license COPYING
|
%license COPYING
|
||||||
%readme README.txt
|
%readme README.txt
|
||||||
%version @FL_MAJOR_VERSION@.@FL_MINOR_VERSION@.@FL_PATCH_VERSION@
|
%version @FLTK_VERSION_MAJOR@.@FLTK_VERSION_MINOR@.@FLTK_VERSION_PATCH@
|
||||||
%description The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a
|
%description The Fast Light Tool Kit ("FLTK", pronounced "fulltick") is a
|
||||||
%description cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11),
|
%description cross-platform C++ GUI toolkit for UNIX(r)/Linux(r) (X11),
|
||||||
%description Microsoft(r) Windows(r), and MacOS(r) X. FLTK provides modern
|
%description Microsoft(r) Windows(r), and MacOS(r) X. FLTK provides modern
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
# https://www.fltk.org/bugs.php
|
# https://www.fltk.org/bugs.php
|
||||||
#
|
#
|
||||||
|
|
||||||
%define version @FL_MAJOR_VERSION@.@FL_MINOR_VERSION@.@FL_PATCH_VERSION@
|
%define version @FLTK_VERSION_MAJOR@.@FLTK_VERSION_MINOR@.@FLTK_VERSION_PATCH@
|
||||||
%define release 1
|
%define release 1
|
||||||
%define prefix /usr
|
%define prefix /usr
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
|
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
|
||||||
#
|
#
|
||||||
# Copyright 1998-2018 by Bill Spitzak and others.
|
# Copyright 1998-2020 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
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
# https://www.fltk.org/bugs.php
|
# https://www.fltk.org/bugs.php
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
|
|
||||||
set (CPPFILES
|
set (CPPFILES
|
||||||
@@ -81,12 +80,12 @@ if(UNIX)
|
|||||||
install (FILES fluid.desktop
|
install (FILES fluid.desktop
|
||||||
DESTINATION ${FLTK_DATADIR}/applications
|
DESTINATION ${FLTK_DATADIR}/applications
|
||||||
)
|
)
|
||||||
# Install mime-type file. x-fluid.desktop method is deprecated.
|
# Install mime-type file (x-fluid.desktop method is deprecated)
|
||||||
install (FILES fluid.xml
|
install (FILES fluid.xml
|
||||||
DESTINATION ${FLTK_DATADIR}/mime/packages
|
DESTINATION ${FLTK_DATADIR}/mime/packages
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install desktop icons.
|
# Install desktop icons
|
||||||
foreach (icon 32 48 64 128)
|
foreach (icon 32 48 64 128)
|
||||||
install (FILES icons/fluid-${icon}.png
|
install (FILES icons/fluid-${icon}.png
|
||||||
DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
|
DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
|
||||||
|
|||||||
+1
-5
@@ -16,13 +16,9 @@
|
|||||||
|
|
||||||
# FLTK version numbers
|
# FLTK version numbers
|
||||||
|
|
||||||
FL_MAJOR_VERSION = @FL_MAJOR_VERSION@
|
FL_VERSION = @FLTK_VERSION@
|
||||||
FL_MINOR_VERSION = @FL_MINOR_VERSION@
|
|
||||||
FL_PATCH_VERSION = @FL_PATCH_VERSION@
|
|
||||||
|
|
||||||
FL_DSO_VERSION = @FL_DSO_VERSION@
|
FL_DSO_VERSION = @FL_DSO_VERSION@
|
||||||
FL_ABI_VERSION = @FL_ABI_VERSION@
|
FL_ABI_VERSION = @FL_ABI_VERSION@
|
||||||
FL_VERSION = @FL_VERSION@
|
|
||||||
|
|
||||||
# FLTK configuration options: BUILD = { WIN | OSX | X11 | XFT }
|
# FLTK configuration options: BUILD = { WIN | OSX | X11 | XFT }
|
||||||
|
|
||||||
|
|||||||
+51
-24
@@ -221,6 +221,7 @@ if (USE_X11)
|
|||||||
drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx
|
drivers/Xlib/Fl_Xlib_Graphics_Driver_font_x.cxx
|
||||||
)
|
)
|
||||||
endif (USE_XFT)
|
endif (USE_XFT)
|
||||||
|
|
||||||
set (DRIVER_HEADER_FILES
|
set (DRIVER_HEADER_FILES
|
||||||
drivers/Posix/Fl_Posix_System_Driver.H
|
drivers/Posix/Fl_Posix_System_Driver.H
|
||||||
drivers/X11/Fl_X11_Screen_Driver.H
|
drivers/X11/Fl_X11_Screen_Driver.H
|
||||||
@@ -361,7 +362,7 @@ set (CPPFILES
|
|||||||
${DRIVER_FILES}
|
${DRIVER_FILES}
|
||||||
)
|
)
|
||||||
|
|
||||||
set (FLCPPFILES
|
set (FORMS_FILES
|
||||||
forms_compatibility.cxx
|
forms_compatibility.cxx
|
||||||
forms_bitmap.cxx
|
forms_bitmap.cxx
|
||||||
forms_free.cxx
|
forms_free.cxx
|
||||||
@@ -547,7 +548,7 @@ target_link_libraries(fltk ${OPTIONAL_LIBS})
|
|||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|
||||||
FL_ADD_LIBRARY(fltk_forms STATIC "${FLCPPFILES}")
|
FL_ADD_LIBRARY (fltk_forms STATIC "${FORMS_FILES}")
|
||||||
target_link_libraries (fltk_forms fltk)
|
target_link_libraries (fltk_forms fltk)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
@@ -583,36 +584,23 @@ endif (OPENGL_FOUND)
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# Build shared libraries (optional)
|
# Build shared libraries (optional)
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
# Shared libraries, part 1: everything except Visual Studio (MSVC)
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
# Note to devs: As of 08 Aug 2016 we can build shared libs (dlls)
|
if (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
|
||||||
# under Windows with Visual Studio (MSVC) but we can't link for instance
|
|
||||||
# fltk_images_SHARED with fltk_SHARED - we have to use fltk, i.e. the
|
|
||||||
# "static" object library instead. I don't know how to fix this, but
|
|
||||||
# at least we can build shared libraries (dlls) with Visual Studio.
|
|
||||||
# AlbrechtS
|
|
||||||
|
|
||||||
if (OPTION_BUILD_SHARED_LIBS)
|
|
||||||
|
|
||||||
FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}")
|
FL_ADD_LIBRARY (fltk SHARED "${SHARED_FILES}")
|
||||||
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS})
|
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS})
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
FL_ADD_LIBRARY(fltk_forms SHARED "${FLCPPFILES}")
|
FL_ADD_LIBRARY (fltk_forms SHARED "${FORMS_FILES}")
|
||||||
if (MSVC)
|
|
||||||
target_link_libraries(fltk_forms_SHARED fltk)
|
|
||||||
else ()
|
|
||||||
target_link_libraries (fltk_forms_SHARED fltk_SHARED)
|
target_link_libraries (fltk_forms_SHARED fltk_SHARED)
|
||||||
endif (MSVC)
|
|
||||||
|
|
||||||
###################################################################
|
###################################################################
|
||||||
|
|
||||||
FL_ADD_LIBRARY (fltk_images SHARED "${IMGCPPFILES}")
|
FL_ADD_LIBRARY (fltk_images SHARED "${IMGCPPFILES}")
|
||||||
if (MSVC)
|
|
||||||
target_link_libraries(fltk_images_SHARED fltk)
|
|
||||||
else ()
|
|
||||||
target_link_libraries (fltk_images_SHARED fltk_SHARED)
|
target_link_libraries (fltk_images_SHARED fltk_SHARED)
|
||||||
endif (MSVC)
|
|
||||||
|
|
||||||
if (OPTION_USE_SYSTEM_LIBJPEG)
|
if (OPTION_USE_SYSTEM_LIBJPEG)
|
||||||
target_link_libraries (fltk_images_SHARED ${FLTK_JPEG_LIBRARIES})
|
target_link_libraries (fltk_images_SHARED ${FLTK_JPEG_LIBRARIES})
|
||||||
@@ -636,13 +624,52 @@ if (OPTION_BUILD_SHARED_LIBS)
|
|||||||
|
|
||||||
if (OPENGL_FOUND)
|
if (OPENGL_FOUND)
|
||||||
FL_ADD_LIBRARY (fltk_gl SHARED "${GLCPPFILES};${GL_HEADER_FILES};${GL_DRIVER_HEADER_FILES}")
|
FL_ADD_LIBRARY (fltk_gl SHARED "${GLCPPFILES};${GL_HEADER_FILES};${GL_DRIVER_HEADER_FILES}")
|
||||||
if (MSVC)
|
|
||||||
target_link_libraries(fltk_gl_SHARED fltk ${OPENGL_LIBRARIES})
|
|
||||||
else ()
|
|
||||||
target_link_libraries (fltk_gl_SHARED fltk_SHARED ${OPENGL_LIBRARIES})
|
target_link_libraries (fltk_gl_SHARED fltk_SHARED ${OPENGL_LIBRARIES})
|
||||||
endif (MSVC)
|
|
||||||
endif (OPENGL_FOUND)
|
endif (OPENGL_FOUND)
|
||||||
|
|
||||||
endif (OPTION_BUILD_SHARED_LIBS)
|
endif (OPTION_BUILD_SHARED_LIBS AND NOT MSVC)
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
# Shared libraries, part 2: Visual Studio (MSVC)
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
# Note to devs: As of June 2020 we can't build separate shared libs (DLL's)
|
||||||
|
# under Windows with Visual Studio (MSVC) but we can build one big DLL
|
||||||
|
# that comprises all FLTK and optional PNG, JPEG, and ZLIB libs.
|
||||||
|
# AlbrechtS
|
||||||
|
|
||||||
|
if (OPTION_BUILD_SHARED_LIBS AND MSVC)
|
||||||
|
|
||||||
|
set (SOURCES ${SHARED_FILES} ${FORMS_FILES} ${IMGCPPFILES})
|
||||||
|
if (OPENGL_FOUND)
|
||||||
|
list (APPEND SOURCES ${GLCPPFILES} ${GL_HEADER_FILES} ${GL_DRIVER_HEADER_FILES})
|
||||||
|
endif (OPENGL_FOUND)
|
||||||
|
|
||||||
|
FL_ADD_LIBRARY (fltk SHARED "${SOURCES}")
|
||||||
|
target_link_libraries (fltk_SHARED ${OPTIONAL_LIBS})
|
||||||
|
|
||||||
|
if (OPTION_USE_SYSTEM_LIBJPEG)
|
||||||
|
target_link_libraries (fltk_SHARED ${FLTK_JPEG_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries (fltk_SHARED fltk_jpeg_SHARED)
|
||||||
|
endif (OPTION_USE_SYSTEM_LIBJPEG)
|
||||||
|
|
||||||
|
if (OPTION_USE_SYSTEM_LIBPNG)
|
||||||
|
target_link_libraries (fltk_SHARED ${FLTK_PNG_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries (fltk_SHARED fltk_png_SHARED)
|
||||||
|
endif (OPTION_USE_SYSTEM_LIBPNG)
|
||||||
|
|
||||||
|
if (OPTION_USE_SYSTEM_ZLIB)
|
||||||
|
target_link_libraries (fltk_SHARED ${FLTK_ZLIB_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_link_libraries (fltk_SHARED fltk_z_SHARED)
|
||||||
|
endif (OPTION_USE_SYSTEM_ZLIB)
|
||||||
|
|
||||||
|
if (OPENGL_FOUND)
|
||||||
|
target_link_libraries (fltk_SHARED ${OPENGL_LIBRARIES})
|
||||||
|
endif (OPENGL_FOUND)
|
||||||
|
|
||||||
|
endif (OPTION_BUILD_SHARED_LIBS AND MSVC)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
# https://www.fltk.org/bugs.php
|
# https://www.fltk.org/bugs.php
|
||||||
#
|
#
|
||||||
|
|
||||||
# Note: see ../configure.in and/or ../makeinclude for definition of
|
# Note: see ../configure.ac and/or ../makeinclude for definition of
|
||||||
# FL_VERSION (x.y.z), FL_ABI_VERSION (x.y.0), and FL_DSO_VERSION (x.y)
|
# FL_VERSION (x.y.z), FL_ABI_VERSION (x.y.0), and FL_DSO_VERSION (x.y)
|
||||||
|
|
||||||
CPPFILES = \
|
CPPFILES = \
|
||||||
|
|||||||
+69
-8
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# CMakeLists.txt used to build test and demo apps by the CMake build system
|
# CMakeLists.txt used to build test and demo apps by the CMake build system
|
||||||
#
|
#
|
||||||
# Copyright 2004-2019 by Bill Spitzak and others.
|
# Copyright 2004-2020 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
|
||||||
@@ -17,6 +17,9 @@
|
|||||||
|
|
||||||
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin/examples)
|
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/../bin/examples)
|
||||||
|
|
||||||
|
include (../CMake/FLTK-Functions.cmake)
|
||||||
|
include (../CMake/fl_create_example.cmake)
|
||||||
|
|
||||||
#######################################################################
|
#######################################################################
|
||||||
# audio libs for test apps
|
# audio libs for test apps
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
@@ -39,7 +42,9 @@ include_directories(
|
|||||||
#######################################################################
|
#######################################################################
|
||||||
# Add the ANDROID_OK option if the example can be compiled for Android
|
# Add the ANDROID_OK option if the example can be compiled for Android
|
||||||
# as well as for other platforms.
|
# as well as for other platforms.
|
||||||
|
|
||||||
if (NOT ANDROID)
|
if (NOT ANDROID)
|
||||||
|
|
||||||
CREATE_EXAMPLE (adjuster adjuster.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (adjuster adjuster.cxx fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE (arc arc.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (arc arc.cxx fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE (animated animated.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (animated animated.cxx fltk ANDROID_OK)
|
||||||
@@ -57,9 +62,9 @@ CREATE_EXAMPLE(color_chooser color_chooser.cxx fltk ANDROID_OK)
|
|||||||
CREATE_EXAMPLE (cursor cursor.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (cursor cursor.cxx fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE (curve curve.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (curve curve.cxx fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE (demo demo.cxx fltk)
|
CREATE_EXAMPLE (demo demo.cxx fltk)
|
||||||
CREATE_EXAMPLE(device device.cxx "fltk;fltk_images")
|
CREATE_EXAMPLE (device device.cxx "fltk_images;fltk")
|
||||||
CREATE_EXAMPLE (doublebuffer doublebuffer.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (doublebuffer doublebuffer.cxx fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE(editor editor.cxx fltk ANDROID_OK)
|
CREATE_EXAMPLE (editor "editor.cxx;editor-Info.plist" fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE (fast_slow fast_slow.fl fltk ANDROID_OK)
|
CREATE_EXAMPLE (fast_slow fast_slow.fl fltk ANDROID_OK)
|
||||||
CREATE_EXAMPLE (file_chooser file_chooser.cxx "fltk_images;fltk")
|
CREATE_EXAMPLE (file_chooser file_chooser.cxx "fltk_images;fltk")
|
||||||
CREATE_EXAMPLE (fonts fonts.cxx fltk)
|
CREATE_EXAMPLE (fonts fonts.cxx fltk)
|
||||||
@@ -108,6 +113,7 @@ CREATE_EXAMPLE(utf8 utf8.cxx fltk)
|
|||||||
CREATE_EXAMPLE (valuators valuators.fl fltk)
|
CREATE_EXAMPLE (valuators valuators.fl fltk)
|
||||||
CREATE_EXAMPLE (unittests unittests.cxx fltk)
|
CREATE_EXAMPLE (unittests unittests.cxx fltk)
|
||||||
CREATE_EXAMPLE (windowfocus windowfocus.cxx fltk)
|
CREATE_EXAMPLE (windowfocus windowfocus.cxx fltk)
|
||||||
|
|
||||||
CREATE_EXAMPLE (fltk-versions ../examples/fltk-versions.cxx fltk)
|
CREATE_EXAMPLE (fltk-versions ../examples/fltk-versions.cxx fltk)
|
||||||
|
|
||||||
# OpenGL demos...
|
# OpenGL demos...
|
||||||
@@ -128,6 +134,64 @@ else ()
|
|||||||
CREATE_EXAMPLE (cairo_test cairo_test.cxx fltk)
|
CREATE_EXAMPLE (cairo_test cairo_test.cxx fltk)
|
||||||
endif (FLTK_HAVE_CAIRO)
|
endif (FLTK_HAVE_CAIRO)
|
||||||
|
|
||||||
|
# /EXPERIMENTAL/ Build some of the demo programs linked against the shared lib(s)
|
||||||
|
|
||||||
|
if (OPTION_BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
|
if (MSVC) # MS Visual C++ aka. Visual Studio
|
||||||
|
|
||||||
|
# We need to link with fl_call_main.c, but this must not be compiled with
|
||||||
|
# macro FL_DLL, whereas the other source file(s) must be compiled with FL_DLL
|
||||||
|
# to link against the shared libs.
|
||||||
|
#
|
||||||
|
# ;-) I *love* Visual Studio (MSVC) ;-)
|
||||||
|
#
|
||||||
|
# Trick: build an object library with just this one file and link the executable
|
||||||
|
# against the shared library plus this object library. Another way would be to
|
||||||
|
# add the extra source file fl_call_main.c to the source files of all targets
|
||||||
|
# and set the FL_DLL compile_definition property only on the main *source* files
|
||||||
|
# but this doesn't work since the same file must be compiled for the "static"
|
||||||
|
# and the "shared" target, for instance hello.cxx for "hello" and "hello-shared".
|
||||||
|
|
||||||
|
add_library (CALL_MAIN OBJECT EXCLUDE_FROM_ALL ../src/fl_call_main.c)
|
||||||
|
|
||||||
|
# define a list of shared targets so we can set COMPILE_DEFINITIONS in a loop
|
||||||
|
set (SHARED_TARGETS)
|
||||||
|
|
||||||
|
CREATE_EXAMPLE (hello-shared hello.cxx "fltk_SHARED;CALL_MAIN")
|
||||||
|
CREATE_EXAMPLE (pixmap_browser-shared pixmap_browser.cxx "fltk_SHARED;CALL_MAIN")
|
||||||
|
CREATE_EXAMPLE (unittests-shared unittests.cxx "fltk_SHARED;CALL_MAIN")
|
||||||
|
|
||||||
|
list (APPEND SHARED_TARGETS hello pixmap_browser unittests)
|
||||||
|
|
||||||
|
if (OPENGL_FOUND)
|
||||||
|
CREATE_EXAMPLE (glpuzzle-shared glpuzzle.cxx "fltk_SHARED;CALL_MAIN;${OPENGL_LIBRARIES}")
|
||||||
|
CREATE_EXAMPLE (shape-shared shape.cxx "fltk_SHARED;CALL_MAIN;${OPENGL_LIBRARIES}")
|
||||||
|
|
||||||
|
list (APPEND SHARED_TARGETS glpuzzle shape)
|
||||||
|
|
||||||
|
endif (OPENGL_FOUND)
|
||||||
|
|
||||||
|
# apply property COMPILE_DEFINITIONS in a loop for all necessary source files
|
||||||
|
foreach (tgt ${SHARED_TARGETS})
|
||||||
|
target_compile_definitions (${tgt}-shared PRIVATE "FL_DLL")
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
else () # not MSVC
|
||||||
|
|
||||||
|
CREATE_EXAMPLE (hello-shared hello.cxx fltk_SHARED)
|
||||||
|
CREATE_EXAMPLE (pixmap_browser-shared pixmap_browser.cxx "fltk_images_SHARED;fltk_SHARED")
|
||||||
|
CREATE_EXAMPLE (unittests-shared unittests.cxx fltk_SHARED)
|
||||||
|
|
||||||
|
if (OPENGL_FOUND)
|
||||||
|
CREATE_EXAMPLE (glpuzzle-shared glpuzzle.cxx "fltk_gl_SHARED;fltk_SHARED;${OPENGL_LIBRARIES}")
|
||||||
|
CREATE_EXAMPLE (shape-shared shape.cxx "fltk_gl_SHARED;fltk_SHARED;${OPENGL_LIBRARIES}")
|
||||||
|
endif (OPENGL_FOUND)
|
||||||
|
|
||||||
|
endif (MSVC) # (not MSVC)
|
||||||
|
|
||||||
|
endif (OPTION_BUILD_SHARED_LIBS)
|
||||||
|
|
||||||
endif (NOT ANDROID)
|
endif (NOT ANDROID)
|
||||||
|
|
||||||
# We need some support files for the demo programs:
|
# We need some support files for the demo programs:
|
||||||
@@ -140,15 +204,12 @@ endif(NOT ANDROID)
|
|||||||
|
|
||||||
# prepare for a "better" test file installation path
|
# prepare for a "better" test file installation path
|
||||||
set (TESTFILE_PATH ${EXECUTABLE_OUTPUT_PATH})
|
set (TESTFILE_PATH ${EXECUTABLE_OUTPUT_PATH})
|
||||||
|
# fl_debug_var (TESTFILE_PATH)
|
||||||
# *FIXME* *DEBUG*
|
|
||||||
# message ("test/CMakeLists.txt: EXECUTABLE_OUTPUT_PATH = '${EXECUTABLE_OUTPUT_PATH}'")
|
|
||||||
# message ("test/CMakeLists.txt: TESTFILE_PATH = '${TESTFILE_PATH}'")
|
|
||||||
|
|
||||||
# use a target filename to make sure the target directory gets created
|
# use a target filename to make sure the target directory gets created
|
||||||
configure_file (demo.menu ${TESTFILE_PATH}/demo.menu COPYONLY)
|
configure_file (demo.menu ${TESTFILE_PATH}/demo.menu COPYONLY)
|
||||||
|
|
||||||
# use target directory only to avoid redundancy
|
# use target directory only (no filename) to avoid redundancy
|
||||||
configure_file (rgb.txt ${TESTFILE_PATH} COPYONLY)
|
configure_file (rgb.txt ${TESTFILE_PATH} COPYONLY)
|
||||||
configure_file (help_dialog.html ${TESTFILE_PATH} COPYONLY)
|
configure_file (help_dialog.html ${TESTFILE_PATH} COPYONLY)
|
||||||
configure_file (browser.cxx ${TESTFILE_PATH} COPYONLY)
|
configure_file (browser.cxx ${TESTFILE_PATH} COPYONLY)
|
||||||
|
|||||||
Reference in New Issue
Block a user