2015-02-16 17:30:27 +03:00
|
|
|
#
|
|
|
|
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
|
|
|
|
#
|
2022-04-02 23:08:50 +03:00
|
|
|
# Copyright 1998-2022 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
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
set (CPPFILES
|
|
|
|
CodeEditor.cxx
|
2020-09-16 19:33:24 +03:00
|
|
|
StyleParse.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
Fl_Function_Type.cxx
|
|
|
|
Fl_Group_Type.cxx
|
|
|
|
Fl_Menu_Type.cxx
|
|
|
|
Fl_Type.cxx
|
|
|
|
Fl_Widget_Type.cxx
|
|
|
|
Fl_Window_Type.cxx
|
|
|
|
Fluid_Image.cxx
|
2021-12-11 21:43:00 +03:00
|
|
|
Shortcut_Button.cxx
|
2020-06-13 16:19:27 +03:00
|
|
|
about_panel.cxx
|
|
|
|
align_widget.cxx
|
|
|
|
alignment_panel.cxx
|
|
|
|
code.cxx
|
|
|
|
factory.cxx
|
|
|
|
file.cxx
|
|
|
|
fluid.cxx
|
|
|
|
function_panel.cxx
|
2021-12-05 01:18:21 +03:00
|
|
|
pixmaps.cxx
|
2021-12-08 17:52:15 +03:00
|
|
|
shell_command.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
|
|
|
)
|
|
|
|
|
2021-12-03 22:29:20 +03:00
|
|
|
# also list header files in Apple's Xcode IDE
|
|
|
|
|
|
|
|
set (HEADERFILES
|
|
|
|
CodeEditor.h
|
2021-12-08 17:52:15 +03:00
|
|
|
Fl_Function_Type.h
|
|
|
|
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
|
2021-12-03 22:29:20 +03:00
|
|
|
Fluid_Image.h
|
|
|
|
Shortcut_Button.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
|
2021-12-08 17:52:15 +03:00
|
|
|
factory.h
|
|
|
|
file.h
|
|
|
|
fluid.h
|
2021-12-03 22:29:20 +03:00
|
|
|
function_panel.h
|
|
|
|
print_panel.h
|
2021-12-05 01:18:21 +03:00
|
|
|
pixmaps.h
|
2021-12-08 17:52:15 +03:00
|
|
|
shell_command.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
|
|
|
|
)
|
|
|
|
|
2017-02-15 23:28:13 +03:00
|
|
|
# ExternalCodeEditor: platform specific files
|
|
|
|
|
|
|
|
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})
|
|
|
|
|
2022-04-02 23:08:50 +03:00
|
|
|
set (FLUID_TARGETS fluid) # fluid and optional fluid-cmd target
|
|
|
|
set (FLUID_LIBS fltk fltk_images) # libraries used to link fluid executables
|
|
|
|
|
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}")
|
2021-12-03 22:29:20 +03:00
|
|
|
add_executable (fluid MACOSX_BUNDLE ${CPPFILES} ${HEADERFILES} ${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
|
|
|
|
|
|
|
# option WIN32 builds a Windows GUI program, ignored on other platforms
|
2021-12-03 22:29:20 +03:00
|
|
|
add_executable (fluid WIN32 ${CPPFILES} ${HEADERFILES})
|
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
|
|
|
|
|
|
|
# we must link all programs with fltk_cairo if option CAIROEXT is enabled
|
|
|
|
if (FLTK_HAVE_CAIROEXT)
|
2022-04-02 23:08:50 +03:00
|
|
|
list (APPEND FLUID_LIBS fltk_cairo cairo)
|
2021-12-19 00:42:30 +03:00
|
|
|
endif (FLTK_HAVE_CAIROEXT)
|
|
|
|
|
2021-02-28 16:56:19 +03:00
|
|
|
if (FLTK_HAVE_CAIRO)
|
2021-07-26 18:14:29 +03:00
|
|
|
fl_target_link_directories (fluid PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
|
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)
|
|
|
|
add_executable (fluid-cmd ${CPPFILES} ${HEADERFILES})
|
|
|
|
target_link_libraries (fluid-cmd ${FLUID_LIBS})
|
|
|
|
if (FLTK_HAVE_CAIRO)
|
|
|
|
fl_target_link_directories (fluid-cmd PRIVATE "${PKG_CAIRO_LIBRARY_DIRS}")
|
|
|
|
endif (FLTK_HAVE_CAIRO)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
# 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
|
2022-09-23 01:18:38 +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
|
|
|
|
|
|
|
endif (APPLE AND (NOT OPTION_APPLE_X11))
|
2015-02-16 17:30:27 +03:00
|
|
|
|
2016-03-27 23:59:39 +03:00
|
|
|
# install desktop files
|
|
|
|
|
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)
|