2019-01-26 02:43:52 +00:00
|
|
|
# This is Mac-only.
|
|
|
|
if (NOT APPLE)
|
2020-03-14 23:11:35 +00:00
|
|
|
return()
|
2019-01-26 02:43:52 +00:00
|
|
|
endif (NOT APPLE)
|
|
|
|
|
|
|
|
# The source tree containing certain macOS resources.
|
2020-03-14 23:11:35 +00:00
|
|
|
set(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx)
|
2019-01-26 02:43:52 +00:00
|
|
|
|
2024-10-06 20:36:33 +00:00
|
|
|
# 10.9 is the minimum supported version.
|
|
|
|
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
|
|
|
|
|
2020-03-14 23:11:35 +00:00
|
|
|
set(RESOURCE_FILES
|
2019-01-26 02:43:52 +00:00
|
|
|
${OSX_DIR}/launch_fish.scpt
|
|
|
|
${OSX_DIR}/fish_term_icon.icns
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/build_tools/osx_package_scripts/add-shell
|
|
|
|
${OSX_DIR}/install.sh
|
|
|
|
)
|
|
|
|
|
|
|
|
# Resource files must be present in the source list.
|
2020-03-14 23:11:35 +00:00
|
|
|
add_executable(fish_macapp EXCLUDE_FROM_ALL
|
2019-01-26 02:43:52 +00:00
|
|
|
${OSX_DIR}/osx_fish_launcher.m
|
|
|
|
${RESOURCE_FILES}
|
|
|
|
)
|
2019-01-28 19:47:58 +00:00
|
|
|
|
|
|
|
# Compute the version. Note this is done at generation time, not build time,
|
|
|
|
# so cmake must be re-run after version changes for the app to be updated. But
|
|
|
|
# generally this will be run by make_pkg.sh which always re-runs cmake.
|
2020-03-14 23:11:35 +00:00
|
|
|
execute_process(
|
2019-01-28 19:47:58 +00:00
|
|
|
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh --stdout
|
|
|
|
COMMAND cut -d- -f1
|
|
|
|
OUTPUT_VARIABLE FISH_SHORT_VERSION
|
|
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
|
|
|
|
|
|
|
2019-01-26 02:43:52 +00:00
|
|
|
# Note CMake appends .app, so the real output name will be fish.app.
|
|
|
|
# This target does not include the 'base' resource.
|
2020-03-14 23:11:35 +00:00
|
|
|
set_target_properties(fish_macapp PROPERTIES OUTPUT_NAME "fish")
|
2019-01-26 02:43:52 +00:00
|
|
|
|
2020-03-14 23:11:35 +00:00
|
|
|
find_library(FOUNDATION_LIB Foundation)
|
|
|
|
target_link_libraries(fish_macapp ${FOUNDATION_LIB})
|
2019-01-26 02:43:52 +00:00
|
|
|
|
2020-03-14 23:11:35 +00:00
|
|
|
set_target_properties(fish_macapp PROPERTIES
|
2019-01-26 02:43:52 +00:00
|
|
|
MACOSX_BUNDLE TRUE
|
|
|
|
MACOSX_BUNDLE_INFO_PLIST ${OSX_DIR}/CMakeMacAppInfo.plist.in
|
|
|
|
MACOSX_BUNDLE_GUI_IDENTIFIER "com.ridiculousfish.fish-shell"
|
2019-01-28 19:47:58 +00:00
|
|
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${FISH_SHORT_VERSION}
|
2019-01-26 02:43:52 +00:00
|
|
|
RESOURCE "${RESOURCE_FILES}"
|
|
|
|
)
|
|
|
|
|
|
|
|
# The fish Mac app contains a fish installation inside the package.
|
|
|
|
# Here is where it gets built.
|
|
|
|
# Copy into the fish mac app after.
|
2020-03-14 23:11:35 +00:00
|
|
|
set(MACAPP_FISH_BUILDROOT ${CMAKE_CURRENT_BINARY_DIR}/macapp_buildroot/base)
|
2019-01-26 02:43:52 +00:00
|
|
|
|
2020-03-14 23:11:35 +00:00
|
|
|
add_custom_command(TARGET fish_macapp POST_BUILD
|
2019-01-26 02:43:52 +00:00
|
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${MACAPP_FISH_BUILDROOT}
|
|
|
|
COMMAND DESTDIR=${MACAPP_FISH_BUILDROOT} ${CMAKE_COMMAND}
|
|
|
|
--build ${CMAKE_CURRENT_BINARY_DIR} --target install
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${MACAPP_FISH_BUILDROOT}/..
|
|
|
|
$<TARGET_BUNDLE_CONTENT_DIR:fish_macapp>/Resources/
|
2020-02-12 23:02:19 +00:00
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
|
2020-02-13 21:34:31 +00:00
|
|
|
# The entitlements file.
|
2020-03-14 23:11:35 +00:00
|
|
|
set(MACAPP_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/osx/MacApp.entitlements")
|
2020-02-13 21:34:31 +00:00
|
|
|
|
2021-03-21 20:29:41 +00:00
|
|
|
# Group our targets in a folder.
|
2024-07-07 18:49:08 +00:00
|
|
|
set_property(TARGET fish_macapp PROPERTY FOLDER macapp)
|