2015-02-16 17:30:27 +03:00
|
|
|
#
|
|
|
|
# CMakeLists.txt to build fluid for the FLTK project using CMake (www.cmake.org)
|
|
|
|
#
|
2024-02-07 20:30:11 +03:00
|
|
|
# Copyright 1998-2024 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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# Targets that will be built: fluid and fluid-cmd (Windows)
|
|
|
|
set(TARGETS fluid)
|
2023-05-07 22:18:52 +03:00
|
|
|
|
2024-03-03 00:58:52 +03:00
|
|
|
# Source files for 'fluid-lib' = all source files except the main files
|
|
|
|
# (fluid.cxx and fluid.h)
|
2024-02-07 20:30:11 +03:00
|
|
|
# Note: macOS (Xcode) needs at least one source file (fluid.cxx) to link the main
|
|
|
|
# program fluid properly
|
|
|
|
|
|
|
|
set(CPPFILES
|
2020-06-13 16:19:27 +03:00
|
|
|
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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(HEADERFILES
|
2021-12-03 22:29:20 +03:00
|
|
|
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
|
2024-02-07 20:30:11 +03:00
|
|
|
fluid.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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(WIN32)
|
|
|
|
list(APPEND CPPFILES ExternalCodeEditor_WIN32.cxx)
|
|
|
|
list(APPEND HEADERFILES ExternalCodeEditor_WIN32.h)
|
|
|
|
else()
|
|
|
|
list(APPEND CPPFILES ExternalCodeEditor_UNIX.cxx)
|
|
|
|
list(APPEND HEADERFILES ExternalCodeEditor_UNIX.h)
|
|
|
|
endif(WIN32)
|
2017-02-15 23:28:13 +03:00
|
|
|
|
2021-12-03 22:29:20 +03:00
|
|
|
source_group("Header Files" FILES ${HEADERFILES})
|
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Build a local object library to avoid compiling all source files
|
2024-02-07 20:30:11 +03:00
|
|
|
# multiple times for all fluid targets on Windows (fluid + fluid-cmd).
|
2023-05-07 22:18:52 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
add_library(fluid-lib OBJECT EXCLUDE_FROM_ALL)
|
|
|
|
target_sources(fluid-lib PRIVATE ${CPPFILES} ${HEADERFILES})
|
|
|
|
target_link_libraries(fluid-lib PUBLIC fltk::images)
|
2023-05-07 22:18:52 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# Build targets
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE AND NOT FLTK_BACKEND_X11)
|
2022-04-02 23:08:50 +03:00
|
|
|
|
|
|
|
# macOS
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(ICON_NAME fluid.icns)
|
|
|
|
set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/icons/${ICON_NAME}")
|
2024-03-03 00:58:52 +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
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
set(WRAPPER "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/fluid")
|
|
|
|
add_custom_command(
|
2020-08-18 17:23:25 +03: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 20:30:11 +03:00
|
|
|
unset(WRAPPER)
|
2020-08-18 17:23:25 +03:00
|
|
|
|
2024-02-07 20:30:11 +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
|
2024-03-03 00:58:52 +03:00
|
|
|
add_executable(fluid WIN32 fluid.cxx fluid.h)
|
2015-04-07 19:08:54 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
2021-12-19 00:42:30 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
target_link_libraries(fluid PRIVATE fluid-lib)
|
2010-04-06 02:33:58 +04:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# Build the console app on Windows
|
|
|
|
# This is done for all Windows targets, even if cross-compiling.
|
2021-02-26 20:00:07 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(WIN32)
|
|
|
|
list(APPEND TARGETS fluid-cmd)
|
2024-03-03 00:58:52 +03:00
|
|
|
add_executable(fluid-cmd fluid.cxx fluid.h)
|
2024-02-07 20:30:11 +03:00
|
|
|
target_link_libraries(fluid-cmd PRIVATE fluid-lib)
|
2024-02-12 18:33:40 +03:00
|
|
|
set(FLTK_FLUID_EXECUTABLE fltk::fluid-cmd)
|
|
|
|
else()
|
|
|
|
set(FLTK_FLUID_EXECUTABLE fltk::fluid)
|
2024-02-07 20:30:11 +03:00
|
|
|
endif()
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2024-02-12 18:33:40 +03:00
|
|
|
set(FLTK_FLUID_EXECUTABLE "${FLTK_FLUID_EXECUTABLE}" PARENT_SCOPE)
|
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
# Create aliases for all targets
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
foreach(tgt ${TARGETS})
|
|
|
|
add_executable(fltk::${tgt} ALIAS ${tgt})
|
|
|
|
endforeach()
|
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
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(APPLE AND NOT FLTK_BACKEND_X11)
|
2022-01-01 15:53:21 +03:00
|
|
|
|
2024-02-14 19:06:10 +03: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 20:30:11 +03: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 23:08:50 +03:00
|
|
|
|
2024-02-14 19:06:10 +03:00
|
|
|
# Install command line tool
|
|
|
|
install(PROGRAMS $<TARGET_FILE:fluid>
|
|
|
|
DESTINATION ${FLTK_BINDIR})
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2024-02-14 19:06:10 +03:00
|
|
|
endif(APPLE AND NOT FLTK_BACKEND_X11)
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2024-02-14 19:06:10 +03:00
|
|
|
# Install the GUI and (on Windows only) the commandline tool 'fluid-cmd'
|
2022-04-02 23:08:50 +03:00
|
|
|
|
2024-02-14 19:06:10 +03: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 17:30:27 +03:00
|
|
|
|
2023-05-07 22:18:52 +03:00
|
|
|
# Install desktop files
|
2016-03-27 23:59:39 +03:00
|
|
|
|
2024-02-07 20:30:11 +03:00
|
|
|
if(UNIX)
|
|
|
|
install(FILES fluid.desktop
|
2020-06-13 16:19:27 +03:00
|
|
|
DESTINATION ${FLTK_DATADIR}/applications
|
|
|
|
)
|
2024-02-07 20:30:11 +03:00
|
|
|
# Install mime-type file(x-fluid.desktop method is deprecated)
|
|
|
|
install(FILES fluid.xml
|
2020-06-13 16:19:27 +03:00
|
|
|
DESTINATION ${FLTK_DATADIR}/mime/packages
|
|
|
|
)
|
2015-02-16 17:30:27 +03:00
|
|
|
|
2020-06-13 16:19:27 +03:00
|
|
|
# Install desktop icons
|
2024-02-07 20:30:11 +03:00
|
|
|
foreach(icon 32 48 64 128)
|
|
|
|
install(FILES icons/fluid-${icon}.png
|
2020-06-13 16:19:27 +03:00
|
|
|
DESTINATION ${FLTK_DATADIR}/icons/hicolor/${icon}x${icon}/apps
|
|
|
|
RENAME fluid.png
|
|
|
|
)
|
|
|
|
endforeach()
|
2024-02-07 20:30:11 +03:00
|
|
|
endif(UNIX)
|