2015-02-16 17:30:27 +03:00
|
|
|
#
|
|
|
|
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
|
|
|
|
#
|
2023-03-09 14:21:49 +03:00
|
|
|
# Copyright 1998-2023 by Bill Spitzak and others.
|
2015-02-16 17:30:27 +03:00
|
|
|
#
|
|
|
|
# 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:
|
|
|
|
#
|
2018-12-04 16:16:55 +03:00
|
|
|
# https://www.fltk.org/COPYING.php
|
2015-02-16 17:30:27 +03:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# Please see the following page on how to report bugs and issues:
|
2015-02-16 17:30:27 +03:00
|
|
|
#
|
2020-07-01 19:03:10 +03:00
|
|
|
# https://www.fltk.org/bugs.php
|
2015-02-16 17:30:27 +03:00
|
|
|
#
|
2010-04-06 02:33:58 +04:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Source files for 'fluid-lib' = all source files except fluid.cxx
|
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (CPPFILES
|
|
|
|
CodeEditor.cxx
|
2020-09-16 19:33:24 +03:00
|
|
|
StyleParse.cxx
|
2023-03-18 19:33:27 +03:00
|
|
|
Fd_Snap_Action.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
Fl_Function_Type.cxx
|
2023-10-20 20:00:42 +03:00
|
|
|
Fl_Grid_Type.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
Fl_Group_Type.cxx
|
|
|
|
Fl_Menu_Type.cxx
|
|
|
|
Fl_Type.cxx
|
|
|
|
Fl_Widget_Type.cxx
|
|
|
|
Fl_Window_Type.cxx
|
2023-07-19 18:44:44 +03:00
|
|
|
Fl_Button_Type.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
Fluid_Image.cxx
|
|
|
|
about_panel.cxx
|
|
|
|
align_widget.cxx
|
|
|
|
alignment_panel.cxx
|
|
|
|
code.cxx
|
2023-02-15 17:24:25 +03:00
|
|
|
custom_widgets.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
factory.cxx
|
|
|
|
file.cxx
|
2023-10-22 20:30:37 +03:00
|
|
|
fluid_filename.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
function_panel.cxx
|
2023-10-27 00:31:12 +03:00
|
|
|
mergeback.cxx
|
2021-12-05 01:18:21 +03:00
|
|
|
pixmaps.cxx
|
2021-12-08 17:52:15 +03:00
|
|
|
shell_command.cxx
|
2023-08-29 03:20:45 +03:00
|
|
|
sourceview_panel.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
template_panel.cxx
|
|
|
|
undo.cxx
|
2021-12-08 17:52:15 +03:00
|
|
|
widget_browser.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
widget_panel.cxx
|
2004-10-19 00:29:58 +04:00
|
|
|
)
|
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# List header files in Apple's Xcode IDE
|
2021-12-03 22:29:20 +03:00
|
|
|
|
|
|
|
set (HEADERFILES
|
|
|
|
CodeEditor.h
|
2023-03-18 19:33:27 +03:00
|
|
|
Fd_Snap_Action.h
|
2021-12-08 17:52:15 +03:00
|
|
|
Fl_Function_Type.h
|
2023-10-20 20:00:42 +03:00
|
|
|
Fl_Grid_Type.h
|
2021-12-08 17:52:15 +03:00
|
|
|
Fl_Group_Type.h
|
|
|
|
Fl_Menu_Type.h
|
2021-12-03 22:29:20 +03:00
|
|
|
Fl_Type.h
|
|
|
|
Fl_Widget_Type.h
|
2021-12-08 17:52:15 +03:00
|
|
|
Fl_Window_Type.h
|
2023-07-19 18:44:44 +03:00
|
|
|
Fl_Button_Type.h
|
2021-12-03 22:29:20 +03:00
|
|
|
Fluid_Image.h
|
|
|
|
StyleParse.h
|
|
|
|
about_panel.h
|
2021-12-08 17:52:15 +03:00
|
|
|
align_widget.h
|
2021-12-03 22:29:20 +03:00
|
|
|
alignment_panel.h
|
2021-12-08 17:52:15 +03:00
|
|
|
code.h
|
2021-12-03 22:29:20 +03:00
|
|
|
comments.h
|
2023-02-15 17:24:25 +03:00
|
|
|
custom_widgets.h
|
2021-12-08 17:52:15 +03:00
|
|
|
factory.h
|
|
|
|
file.h
|
2021-12-03 22:29:20 +03:00
|
|
|
function_panel.h
|
2023-10-27 00:31:12 +03:00
|
|
|
mergeback.h
|
2021-12-03 22:29:20 +03:00
|
|
|
print_panel.h
|
2021-12-05 01:18:21 +03:00
|
|
|
pixmaps.h
|
2021-12-08 17:52:15 +03:00
|
|
|
shell_command.h
|
2023-08-29 03:20:45 +03:00
|
|
|
sourceview_panel.h
|
2021-12-03 22:29:20 +03:00
|
|
|
template_panel.h
|
|
|
|
undo.h
|
2021-12-08 17:52:15 +03:00
|
|
|
widget_browser.h
|
2021-12-03 22:29:20 +03:00
|
|
|
widget_panel.h
|
|
|
|
)
|
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Add ExternalCodeEditor: platform specific files
|
2017-02-15 23:28:13 +03:00
|
|
|
|
|
|
|
if (WIN32)
|
2020-06-13 16:19:27 +03:00
|
|
|
list (APPEND CPPFILES ExternalCodeEditor_WIN32.cxx)
|
2021-12-03 22:29:20 +03:00
|
|
|
list (APPEND HEADERFILES ExternalCodeEditor_WIN32.h)
|
2017-02-15 23:28:13 +03:00
|
|
|
else ()
|
2020-06-13 16:19:27 +03:00
|
|
|
list (APPEND CPPFILES ExternalCodeEditor_UNIX.cxx)
|
2021-12-03 22:29:20 +03:00
|
|
|
list (APPEND HEADERFILES ExternalCodeEditor_UNIX.h)
|
2017-02-15 23:28:13 +03:00
|
|
|
endif (WIN32)
|
|
|
|
|
2021-12-03 22:29:20 +03:00
|
|
|
source_group("Header Files" FILES ${HEADERFILES})
|
|
|
|
|
2023-11-01 19:22:31 +03:00
|
|
|
# make a group in the IDE for easy access to documentation files
|
|
|
|
|
2023-11-05 16:20:04 +03:00
|
|
|
set ( USER_DOC_FILES
|
2023-11-01 19:22:31 +03:00
|
|
|
Doxyfile
|
|
|
|
documentation/src/index.dox
|
2023-11-03 00:25:49 +03:00
|
|
|
documentation/src/page_introduction.dox
|
|
|
|
documentation/src/page_getting_started.dox
|
|
|
|
documentation/src/page_ui_overview.dox
|
|
|
|
documentation/src/page_basics.dox
|
|
|
|
documentation/src/page_widget_types.dox
|
|
|
|
documentation/src/page_layout.dox
|
|
|
|
documentation/src/page_code_integration.dox
|
2023-11-07 16:28:15 +03:00
|
|
|
documentation/src/page_build_integration.dox
|
2023-11-03 00:25:49 +03:00
|
|
|
documentation/src/page_advanced.dox
|
|
|
|
documentation/src/page_shortcuts.dox
|
|
|
|
documentation/src/page_faqs.dox
|
|
|
|
documentation/src/page_glossary.dox
|
|
|
|
documentation/src/page_appendices.dox
|
|
|
|
documentation/src/page_index.dox
|
|
|
|
documentation/src/page_legal.dox
|
|
|
|
documentation/src/page_conclusion.dox
|
2023-11-01 19:22:31 +03:00
|
|
|
)
|
2023-11-05 16:20:04 +03:00
|
|
|
source_group("Documentation: User" FILES ${USER_DOC_FILES})
|
|
|
|
|
|
|
|
set ( DEV_DOC_FILES
|
|
|
|
Doxyfile-dev
|
|
|
|
documentation/src-dev/index.dox
|
|
|
|
documentation/src-dev/page_introduction.dox
|
|
|
|
)
|
|
|
|
source_group("Documentation: Developer" FILES ${DEV_DOC_FILES})
|
2023-11-01 19:22:31 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Build a local object library to avoid compiling all source files
|
|
|
|
# for all fluid targets (fluid, fluid-cmd, fluid-shared). This
|
|
|
|
# library includes everything except the main program (fluid.cxx).
|
|
|
|
|
2023-11-05 16:20:04 +03:00
|
|
|
add_library (fluid-lib OBJECT EXCLUDE_FROM_ALL ${CPPFILES} ${HEADERFILES} ${USER_DOC_FILES} ${DEV_DOC_FILES})
|
2023-05-07 22:18:52 +03:00
|
|
|
|
|
|
|
# Build fluid with all its variants (fluid-cmd, fluid-shared) ...
|
|
|
|
|
|
|
|
set (FLUID_TARGETS fluid) # fluid and optional fluid-cmd target
|
|
|
|
set (FLUID_LIBS fluid-lib fltk fltk_images) # libraries used to link fluid executables
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2022-01-23 03:33:47 +03:00
|
|
|
if (APPLE AND (NOT OPTION_APPLE_X11))
|
2022-04-02 23:08:50 +03:00
|
|
|
|
|
|
|
# macOS
|
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (ICON_NAME fluid.icns)
|
2021-05-13 17:16:50 +03:00
|
|
|
set (ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_NAME}")
|
2023-07-10 18:07:34 +03:00
|
|
|
add_executable (fluid MACOSX_BUNDLE fluid.cxx fluid.h ${ICON_PATH})
|
2020-08-18 17:23:25 +03:00
|
|
|
|
|
|
|
# create macOS bundle wrapper script
|
|
|
|
|
|
|
|
set (WRAPPER "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/fluid")
|
|
|
|
add_custom_command (
|
|
|
|
TARGET fluid POST_BUILD
|
|
|
|
COMMAND cp ${CMAKE_CURRENT_SOURCE_DIR}/../CMake/macOS-bundle-wrapper.in ${WRAPPER}
|
|
|
|
COMMAND chmod u+x,g+x,o+x ${WRAPPER}
|
|
|
|
BYPRODUCTS ${WRAPPER}
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
unset (WRAPPER)
|
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
else ()
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Option 'WIN32' builds a Windows GUI program, ignored on other platforms
|
2023-07-10 18:07:34 +03:00
|
|
|
add_executable (fluid WIN32 fluid.cxx fluid.h)
|
2015-04-07 19:08:54 +03:00
|
|
|
|
2022-04-02 23:08:50 +03:00
|
|
|
endif ()
|
2021-12-19 00:42:30 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Link fluid with Cairo if OPTION_CAIRO is enabled
|
2021-02-28 16:56:19 +03:00
|
|
|
if (FLTK_HAVE_CAIRO)
|
2023-03-09 14:21:49 +03:00
|
|
|
target_include_directories (fluid PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
|
|
|
|
if (PKG_CAIRO_LIBRARY_DIRS)
|
2023-11-15 23:30:12 +03:00
|
|
|
target_link_directories (fluid PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
2023-03-09 14:21:49 +03:00
|
|
|
endif ()
|
2021-02-28 16:56:19 +03:00
|
|
|
endif (FLTK_HAVE_CAIRO)
|
2010-04-06 02:33:58 +04:00
|
|
|
|
2021-02-26 20:00:07 +03:00
|
|
|
if (USE_GDIPLUS) # can only be true on Windows
|
2022-04-02 23:08:50 +03:00
|
|
|
list (APPEND FLUID_LIBS gdiplus)
|
2021-02-26 20:00:07 +03:00
|
|
|
endif (USE_GDIPLUS)
|
|
|
|
|
2022-04-02 23:08:50 +03:00
|
|
|
target_link_libraries (fluid ${FLUID_LIBS})
|
|
|
|
|
|
|
|
# Add fluid-cmd console app (Windows only) for converting .fl to .cxx/.h files.
|
|
|
|
# This is done for all Windows targets, even if cross-compiling.
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
list (APPEND FLUID_TARGETS fluid-cmd)
|
2023-07-10 18:07:34 +03:00
|
|
|
add_executable (fluid-cmd fluid.cxx fluid.h)
|
2022-04-02 23:08:50 +03:00
|
|
|
target_link_libraries (fluid-cmd ${FLUID_LIBS})
|
2023-03-09 14:21:49 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Link fluid-cmd with Cairo if OPTION_CAIRO is enabled (same as above)
|
|
|
|
|
2022-04-02 23:08:50 +03:00
|
|
|
if (FLTK_HAVE_CAIRO)
|
2023-03-09 14:21:49 +03:00
|
|
|
target_include_directories (fluid-cmd PRIVATE ${PKG_CAIRO_INCLUDE_DIRS})
|
|
|
|
if (PKG_CAIRO_LIBRARY_DIRS)
|
2023-11-15 23:30:12 +03:00
|
|
|
target_link_directories (fluid-cmd PRIVATE ${PKG_CAIRO_LIBRARY_DIRS})
|
2023-03-09 14:21:49 +03:00
|
|
|
endif ()
|
2022-04-02 23:08:50 +03:00
|
|
|
endif (FLTK_HAVE_CAIRO)
|
2023-03-09 14:21:49 +03:00
|
|
|
endif (WIN32)
|
|
|
|
|
|
|
|
# Build fluid-shared (experimental)
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2023-03-09 14:21:49 +03:00
|
|
|
if (OPTION_BUILD_SHARED_LIBS)
|
|
|
|
list (APPEND FLUID_TARGETS fluid-shared)
|
2023-07-10 18:07:34 +03:00
|
|
|
add_executable (fluid-shared fluid.cxx fluid.h)
|
2023-03-09 14:21:49 +03:00
|
|
|
if (MSVC)
|
2023-09-13 00:18:46 +03:00
|
|
|
# Todo: this should link against fltk_SHARED rather than fltk_images but for an unknown
|
|
|
|
# reason this would issue link errors (about 25 undefined symbols). Needs investigation.
|
|
|
|
# AlbrechtS: Sep. 12, 2023
|
|
|
|
target_link_libraries (fluid-shared PRIVATE fluid-lib fltk_images) # should be: fltk_SHARED)
|
2023-03-09 14:21:49 +03:00
|
|
|
else ()
|
2023-09-13 00:18:46 +03:00
|
|
|
target_link_libraries (fluid-shared PRIVATE fluid-lib fltk_images_SHARED)
|
2023-03-09 14:21:49 +03:00
|
|
|
endif (MSVC)
|
|
|
|
endif ()
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Install fluid GUI and commandline tool
|
2015-12-30 17:37:35 +03:00
|
|
|
|
2022-01-23 03:33:47 +03:00
|
|
|
if (APPLE AND (NOT OPTION_APPLE_X11))
|
2022-01-01 15:53:21 +03:00
|
|
|
|
|
|
|
# On macOS, Fluid must be installed twice. The bundled version of Fluid needs
|
|
|
|
# to go into the /Applications folder to make it visible as a user App with
|
|
|
|
# full GUI. The binary without bundle should go into ${FLTK_BINDIR}, usually
|
|
|
|
# /usr/local/bin, so it will be picked up as a command line tool by
|
|
|
|
# the build process of other apps.
|
2022-04-02 23:08:50 +03:00
|
|
|
# On macOS the command line tool is the same target ('fluid') as the one
|
|
|
|
# included in the bundle.
|
2022-01-01 15:53:21 +03:00
|
|
|
|
2016-03-27 23:59:39 +03:00
|
|
|
# create bundle
|
2021-05-13 17:16:50 +03:00
|
|
|
set_target_properties (fluid PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/fluid.plist")
|
2020-06-13 16:19:27 +03:00
|
|
|
set_target_properties (fluid PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
2023-02-02 22:54:19 +03:00
|
|
|
set_target_properties (fluid PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.fltk.fluid")
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2022-01-01 15:53:21 +03:00
|
|
|
# The line below would wrongly install /Applications/fluid.icns
|
2022-04-02 23:08:50 +03:00
|
|
|
# ## set_target_properties (fluid PROPERTIES RESOURCE ${ICON_PATH})
|
|
|
|
|
|
|
|
# install fluid GUI and commandline tools
|
2023-03-09 14:21:49 +03:00
|
|
|
# install (TARGETS fluid DESTINATION "/Applications")
|
2022-01-01 15:53:21 +03:00
|
|
|
|
|
|
|
# install command line tool
|
2022-04-02 23:08:50 +03:00
|
|
|
install (PROGRAMS $<TARGET_FILE:fluid> DESTINATION ${FLTK_BINDIR})
|
2022-01-01 15:53:21 +03:00
|
|
|
|
2015-04-07 19:08:54 +03:00
|
|
|
else()
|
2022-04-02 23:08:50 +03:00
|
|
|
|
|
|
|
# install Fluid GUI and optional commandline tool 'fluid-cmd' (only on Windows)
|
|
|
|
|
|
|
|
install (TARGETS ${FLUID_TARGETS}
|
2014-09-27 04:41:06 +04:00
|
|
|
EXPORT FLTK-Targets
|
2015-02-16 17:30:27 +03:00
|
|
|
RUNTIME DESTINATION ${FLTK_BINDIR}
|
|
|
|
LIBRARY DESTINATION ${FLTK_LIBDIR}
|
|
|
|
ARCHIVE DESTINATION ${FLTK_LIBDIR}
|
2020-06-13 16:19:27 +03:00
|
|
|
)
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2023-03-09 14:21:49 +03:00
|
|
|
endif (APPLE AND (NOT OPTION_APPLE_X11))
|
2015-02-16 17:30:27 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Install desktop files
|
2016-03-27 23:59:39 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
if (UNIX)
|
|
|
|
install (FILES fluid.desktop
|
|
|
|
DESTINATION ${FLTK_DATADIR}/applications
|
|
|
|
)
|
|
|
|
# Install mime-type file (x-fluid.desktop method is deprecated)
|
|
|
|
install (FILES fluid.xml
|
|
|
|
DESTINATION ${FLTK_DATADIR}/mime/packages
|
|
|
|
)
|
2015-02-16 17:30:27 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
# Install desktop icons
|
|
|
|
foreach (icon 32 48 64 128)
|
|
|
|
install (FILES icons/fluid-${icon}.png
|
|
|
|
DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
|
|
|
|
RENAME fluid.png
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
endif (UNIX)
|