2015-02-16 14:30:27 +00:00
|
|
|
#
|
|
|
|
|
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
|
|
|
|
|
#
|
2025-03-07 15:34:35 +00:00
|
|
|
# Copyright 1998-2025 by Bill Spitzak and others.
|
2015-02-16 14:30:27 +00: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 13:16:55 +00:00
|
|
|
# https://www.fltk.org/COPYING.php
|
2015-02-16 14:30:27 +00:00
|
|
|
#
|
2020-07-01 16:03:10 +00:00
|
|
|
# Please see the following page on how to report bugs and issues:
|
2015-02-16 14:30:27 +00:00
|
|
|
#
|
2020-07-01 16:03:10 +00:00
|
|
|
# https://www.fltk.org/bugs.php
|
2015-02-16 14:30:27 +00:00
|
|
|
#
|
2010-04-05 22:33:58 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
# Targets that will be built: fluid and fluid-cmd (Windows)
|
|
|
|
|
set(TARGETS fluid)
|
2023-05-07 19:18:52 +00:00
|
|
|
|
2024-03-02 21:58:52 +00:00
|
|
|
# Source files for 'fluid-lib' = all source files except the main files
|
2025-03-07 15:34:35 +00:00
|
|
|
# (main.cxx and main.h)
|
|
|
|
|
# Note: macOS (Xcode) needs at least one source file (main.cxx) to link the main
|
2024-02-07 17:30:11 +00:00
|
|
|
# program fluid properly
|
|
|
|
|
|
|
|
|
|
set(CPPFILES
|
2025-03-16 21:16:12 +00:00
|
|
|
Fluid.cxx
|
|
|
|
|
Project.cxx
|
|
|
|
|
app/args.cxx
|
|
|
|
|
app/Snap_Action.cxx
|
|
|
|
|
app/Image_Asset.cxx
|
|
|
|
|
app/history.cxx
|
|
|
|
|
app/Menu.cxx
|
2025-03-07 15:34:35 +00:00
|
|
|
app/shell_command.cxx
|
2025-03-16 21:16:12 +00:00
|
|
|
app/templates.cxx
|
2025-03-07 23:14:09 +00:00
|
|
|
io/Code_Writer.cxx
|
|
|
|
|
io/Project_Writer.cxx
|
|
|
|
|
io/Project_Reader.cxx
|
2025-03-16 21:16:12 +00:00
|
|
|
io/String_Writer.cxx
|
|
|
|
|
nodes/Tree.cxx
|
|
|
|
|
nodes/Button_Node.cxx
|
|
|
|
|
nodes/Function_Node.cxx
|
|
|
|
|
nodes/Grid_Node.cxx
|
|
|
|
|
nodes/Group_Node.cxx
|
|
|
|
|
nodes/Menu_Node.cxx
|
|
|
|
|
nodes/Node.cxx
|
|
|
|
|
nodes/Widget_Node.cxx
|
|
|
|
|
nodes/Window_Node.cxx
|
|
|
|
|
nodes/callbacks.cxx
|
2025-03-07 15:34:35 +00:00
|
|
|
nodes/factory.cxx
|
|
|
|
|
panels/about_panel.cxx
|
|
|
|
|
panels/codeview_panel.cxx
|
|
|
|
|
panels/function_panel.cxx
|
|
|
|
|
panels/settings_panel.cxx
|
|
|
|
|
panels/template_panel.cxx
|
|
|
|
|
panels/widget_panel.cxx
|
2025-03-16 21:16:12 +00:00
|
|
|
panels/widget_panel/Grid_Tab.cxx
|
|
|
|
|
panels/widget_panel/Grid_Child_Tab.cxx
|
|
|
|
|
proj/align_widget.cxx
|
|
|
|
|
proj/mergeback.cxx
|
|
|
|
|
proj/undo.cxx
|
2025-03-07 15:34:35 +00:00
|
|
|
rsrcs/pixmaps.cxx
|
|
|
|
|
tools/autodoc.cxx
|
2025-03-07 23:14:09 +00:00
|
|
|
tools/filename.cxx
|
2025-04-15 13:28:31 +00:00
|
|
|
widgets/App_Menu_Bar.cxx
|
2025-03-07 17:54:03 +00:00
|
|
|
widgets/Code_Editor.cxx
|
|
|
|
|
widgets/Code_Viewer.cxx
|
|
|
|
|
widgets/Text_Viewer.cxx
|
|
|
|
|
widgets/Formula_Input.cxx
|
|
|
|
|
widgets/Bin_Button.cxx
|
|
|
|
|
widgets/Style_Parser.cxx
|
2025-03-07 18:52:54 +00:00
|
|
|
widgets/Node_Browser.cxx
|
2004-10-18 20:29:58 +00:00
|
|
|
)
|
|
|
|
|
|
2023-05-07 19:18:52 +00:00
|
|
|
# List header files in Apple's Xcode IDE
|
2021-12-03 19:29:20 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
set(HEADERFILES
|
2025-03-16 21:16:12 +00:00
|
|
|
Fluid.h
|
|
|
|
|
Project.h
|
|
|
|
|
app/args.h
|
|
|
|
|
app/Snap_Action.h
|
|
|
|
|
app/Image_Asset.h
|
|
|
|
|
app/history.h
|
|
|
|
|
app/Menu.h
|
2025-03-07 15:34:35 +00:00
|
|
|
app/shell_command.h
|
2025-03-16 21:16:12 +00:00
|
|
|
app/templates.h
|
2025-03-07 23:14:09 +00:00
|
|
|
io/Code_Writer.h
|
|
|
|
|
io/Project_Writer.h
|
|
|
|
|
io/Project_Reader.h
|
2025-03-16 21:16:12 +00:00
|
|
|
io/String_Writer.h
|
|
|
|
|
nodes/Tree.h
|
|
|
|
|
nodes/Button_Node.h
|
|
|
|
|
nodes/Function_Node.h
|
|
|
|
|
nodes/Grid_Node.h
|
|
|
|
|
nodes/Group_Node.h
|
|
|
|
|
nodes/Menu_Node.h
|
|
|
|
|
nodes/Node.h
|
|
|
|
|
nodes/Widget_Node.h
|
|
|
|
|
nodes/Window_Node.h
|
|
|
|
|
nodes/callbacks.h
|
2025-03-07 15:34:35 +00:00
|
|
|
nodes/factory.h
|
|
|
|
|
panels/about_panel.h
|
|
|
|
|
panels/codeview_panel.h
|
|
|
|
|
panels/function_panel.h
|
|
|
|
|
panels/settings_panel.h
|
|
|
|
|
panels/template_panel.h
|
|
|
|
|
panels/widget_panel.h
|
2025-03-16 21:16:12 +00:00
|
|
|
panels/widget_panel/Grid_Tab.h
|
|
|
|
|
panels/widget_panel/Grid_Child_Tab.h
|
|
|
|
|
proj/align_widget.h
|
|
|
|
|
proj/mergeback.h
|
|
|
|
|
proj/undo.h
|
2025-03-07 15:34:35 +00:00
|
|
|
rsrcs/comments.h
|
|
|
|
|
rsrcs/pixmaps.h
|
|
|
|
|
tools/autodoc.h
|
2025-03-07 23:14:09 +00:00
|
|
|
tools/filename.h
|
2025-04-15 13:28:31 +00:00
|
|
|
widgets/App_Menu_Bar.h
|
2025-03-07 17:54:03 +00:00
|
|
|
widgets/Code_Editor.h
|
|
|
|
|
widgets/Code_Viewer.h
|
|
|
|
|
widgets/Text_Viewer.h
|
|
|
|
|
widgets/Formula_Input.h
|
|
|
|
|
widgets/Bin_Button.h
|
|
|
|
|
widgets/Style_Parser.h
|
2025-03-07 18:52:54 +00:00
|
|
|
widgets/Node_Browser.h
|
2021-12-03 19:29:20 +00:00
|
|
|
)
|
|
|
|
|
|
2025-04-04 13:54:36 +00:00
|
|
|
set(MAIN_FILES main.cxx main.h)
|
|
|
|
|
|
2023-05-07 19:18:52 +00:00
|
|
|
# Add ExternalCodeEditor: platform specific files
|
2017-02-15 20:28:13 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
if(WIN32)
|
2025-03-07 15:34:35 +00:00
|
|
|
list(APPEND CPPFILES tools/ExternalCodeEditor_WIN32.cxx)
|
|
|
|
|
list(APPEND HEADERFILES tools/ExternalCodeEditor_WIN32.h)
|
2024-02-07 17:30:11 +00:00
|
|
|
else()
|
2025-03-07 15:34:35 +00:00
|
|
|
list(APPEND CPPFILES tools/ExternalCodeEditor_UNIX.cxx)
|
|
|
|
|
list(APPEND HEADERFILES tools/ExternalCodeEditor_UNIX.h)
|
2024-02-07 17:30:11 +00:00
|
|
|
endif(WIN32)
|
2017-02-15 20:28:13 +00:00
|
|
|
|
2025-03-07 15:34:35 +00:00
|
|
|
source_group(
|
|
|
|
|
TREE
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
|
FILES
|
|
|
|
|
${CPPFILES}
|
|
|
|
|
${HEADERFILES}
|
2025-04-04 13:54:36 +00:00
|
|
|
${MAIN_FILES}
|
2025-03-07 15:34:35 +00:00
|
|
|
CMakeLists.txt
|
|
|
|
|
)
|
2021-12-03 19:29:20 +00:00
|
|
|
|
2023-05-07 19:18:52 +00:00
|
|
|
# Build a local object library to avoid compiling all source files
|
2024-02-07 17:30:11 +00:00
|
|
|
# multiple times for all fluid targets on Windows (fluid + fluid-cmd).
|
2023-05-07 19:18:52 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
add_library(fluid-lib OBJECT EXCLUDE_FROM_ALL)
|
|
|
|
|
target_sources(fluid-lib PRIVATE ${CPPFILES} ${HEADERFILES})
|
2025-04-04 13:54:36 +00:00
|
|
|
target_include_directories(fluid-lib PUBLIC .)
|
2024-02-07 17:30:11 +00:00
|
|
|
target_link_libraries(fluid-lib PUBLIC fltk::images)
|
2023-05-07 19:18:52 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
# Build targets
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
if(APPLE AND NOT FLTK_BACKEND_X11)
|
2022-04-02 20:08:50 +00:00
|
|
|
|
|
|
|
|
# macOS
|
|
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
set(ICON_NAME fluid.icns)
|
2025-03-07 15:46:39 +00:00
|
|
|
set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_NAME}")
|
2025-04-04 13:54:36 +00:00
|
|
|
add_executable(fluid MACOSX_BUNDLE ${MAIN_FILES} ${ICON_PATH})
|
2020-08-18 14:23:25 +00:00
|
|
|
|
|
|
|
|
# create macOS bundle wrapper script
|
|
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
set(WRAPPER "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/fluid")
|
|
|
|
|
add_custom_command(
|
2020-08-18 14:23:25 +00:00
|
|
|
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
|
|
|
|
|
)
|
2024-02-07 17:30:11 +00:00
|
|
|
unset(WRAPPER)
|
2020-08-18 14:23:25 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
else()
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2023-05-07 19:18:52 +00:00
|
|
|
# Option 'WIN32' builds a Windows GUI program, ignored on other platforms
|
2025-04-04 13:54:36 +00:00
|
|
|
add_executable(fluid WIN32 ${MAIN_FILES})
|
2015-04-07 16:08:54 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
endif()
|
2021-12-18 21:42:30 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
target_link_libraries(fluid PRIVATE fluid-lib)
|
2010-04-05 22:33:58 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
# Build the console app on Windows
|
|
|
|
|
# This is done for all Windows targets, even if cross-compiling.
|
2021-02-26 17:00:07 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
if(WIN32)
|
|
|
|
|
list(APPEND TARGETS fluid-cmd)
|
2025-04-04 13:54:36 +00:00
|
|
|
add_executable(fluid-cmd ${MAIN_FILES})
|
2024-02-07 17:30:11 +00:00
|
|
|
target_link_libraries(fluid-cmd PRIVATE fluid-lib)
|
2024-02-12 15:33:40 +00:00
|
|
|
set(FLTK_FLUID_EXECUTABLE fltk::fluid-cmd)
|
|
|
|
|
else()
|
|
|
|
|
set(FLTK_FLUID_EXECUTABLE fltk::fluid)
|
2024-02-07 17:30:11 +00:00
|
|
|
endif()
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-12 15:33:40 +00:00
|
|
|
set(FLTK_FLUID_EXECUTABLE "${FLTK_FLUID_EXECUTABLE}" PARENT_SCOPE)
|
|
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
# Create aliases for all targets
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
foreach(tgt ${TARGETS})
|
|
|
|
|
add_executable(fltk::${tgt} ALIAS ${tgt})
|
|
|
|
|
endforeach()
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2023-05-07 19:18:52 +00:00
|
|
|
# Install fluid GUI and commandline tool
|
2015-12-30 14:37:35 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
if(APPLE AND NOT FLTK_BACKEND_X11)
|
2022-01-01 12:53:21 +00:00
|
|
|
|
2024-02-14 16:06:10 +00:00
|
|
|
# On macOS, fluid will be installed twice:
|
|
|
|
|
# - The bundled version of Fluid goes into the destination folder ${FLTK_BINDIR}.
|
|
|
|
|
# - The binary without bundle goes into ${FLTK_BINDIR} as well.
|
|
|
|
|
# The command line tool is the same executable as the one included in the bundle.
|
|
|
|
|
# Note:
|
|
|
|
|
# Both the bundle and the commandline tool are currently installed side by side.
|
|
|
|
|
# This may be changed in the future.
|
|
|
|
|
|
|
|
|
|
# Set bundle properties
|
2024-02-07 17:30:11 +00:00
|
|
|
set_target_properties(fluid PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/fluid.plist")
|
|
|
|
|
set_target_properties(fluid PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
|
|
|
|
set_target_properties(fluid PROPERTIES XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.fltk.fluid")
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-14 16:06:10 +00:00
|
|
|
# Install command line tool
|
|
|
|
|
install(PROGRAMS $<TARGET_FILE:fluid>
|
|
|
|
|
DESTINATION ${FLTK_BINDIR})
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-14 16:06:10 +00:00
|
|
|
endif(APPLE AND NOT FLTK_BACKEND_X11)
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-14 16:06:10 +00:00
|
|
|
# Install the GUI and (on Windows only) the commandline tool 'fluid-cmd'
|
2022-04-02 20:08:50 +00:00
|
|
|
|
2024-02-14 16:06:10 +00:00
|
|
|
install(TARGETS ${TARGETS}
|
|
|
|
|
EXPORT FLTK-Targets
|
|
|
|
|
RUNTIME DESTINATION ${FLTK_BINDIR}
|
|
|
|
|
LIBRARY DESTINATION ${FLTK_LIBDIR}
|
|
|
|
|
ARCHIVE DESTINATION ${FLTK_LIBDIR}
|
|
|
|
|
BUNDLE DESTINATION ${FLTK_BINDIR} # macOS: bundles
|
|
|
|
|
)
|
2015-02-16 14:30:27 +00:00
|
|
|
|
2023-05-07 19:18:52 +00:00
|
|
|
# Install desktop files
|
2016-03-27 20:59:39 +00:00
|
|
|
|
2024-02-07 17:30:11 +00:00
|
|
|
if(UNIX)
|
|
|
|
|
install(FILES fluid.desktop
|
2020-06-13 13:19:27 +00:00
|
|
|
DESTINATION ${FLTK_DATADIR}/applications
|
|
|
|
|
)
|
2024-02-07 17:30:11 +00:00
|
|
|
# Install mime-type file(x-fluid.desktop method is deprecated)
|
|
|
|
|
install(FILES fluid.xml
|
2020-06-13 13:19:27 +00:00
|
|
|
DESTINATION ${FLTK_DATADIR}/mime/packages
|
|
|
|
|
)
|
2015-02-16 14:30:27 +00:00
|
|
|
|
2020-06-13 13:19:27 +00:00
|
|
|
# Install desktop icons
|
2024-02-07 17:30:11 +00:00
|
|
|
foreach(icon 32 48 64 128)
|
2025-03-07 15:46:39 +00:00
|
|
|
install(FILES icons/fluid-${icon}.png
|
|
|
|
|
DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
|
2020-06-13 13:19:27 +00:00
|
|
|
RENAME fluid.png
|
|
|
|
|
)
|
|
|
|
|
endforeach()
|
2024-02-07 17:30:11 +00:00
|
|
|
endif(UNIX)
|