fork/fish-shell

git clone https://git.julia.blue/fork/fish-shell

Daniel Rainergit_version_gen: always output to stdout860bba759

master
2.3 KiB68 linesraw
1# This is Mac-only.
2if (NOT APPLE)
3    return()
4endif (NOT APPLE)
5
6# The source tree containing certain macOS resources.
7set(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx)
8
9# 10.9 is the minimum supported version.
10set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9")
11
12set(RESOURCE_FILES
13    ${OSX_DIR}/launch_fish.scpt
14    ${OSX_DIR}/fish_term_icon.icns
15    ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/osx_package_scripts/add-shell
16    ${OSX_DIR}/install.sh
17)
18
19# Resource files must be present in the source list.
20add_executable(fish_macapp EXCLUDE_FROM_ALL
21    ${OSX_DIR}/osx_fish_launcher.m
22    ${RESOURCE_FILES}
23)
24
25# Compute the version. Note this is done at generation time, not build time,
26# so cmake must be re-run after version changes for the app to be updated. But
27# generally this will be run by make_macos_pkg.sh which always re-runs cmake.
28execute_process(
29    COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/git_version_gen.sh
30    COMMAND cut -d- -f1
31    OUTPUT_VARIABLE FISH_SHORT_VERSION
32    OUTPUT_STRIP_TRAILING_WHITESPACE)
33
34
35# Note CMake appends .app, so the real output name will be fish.app.
36# This target does not include the 'base' resource.
37set_target_properties(fish_macapp PROPERTIES OUTPUT_NAME "fish")
38
39find_library(FOUNDATION_LIB Foundation)
40target_link_libraries(fish_macapp ${FOUNDATION_LIB})
41
42set_target_properties(fish_macapp PROPERTIES
43    MACOSX_BUNDLE TRUE
44    MACOSX_BUNDLE_INFO_PLIST ${OSX_DIR}/CMakeMacAppInfo.plist.in
45    MACOSX_BUNDLE_GUI_IDENTIFIER "com.ridiculousfish.fish-shell"
46    MACOSX_BUNDLE_SHORT_VERSION_STRING ${FISH_SHORT_VERSION}
47    RESOURCE "${RESOURCE_FILES}"
48)
49
50# The fish Mac app contains a fish installation inside the package.
51# Here is where it gets built.
52# Copy into the fish mac app after.
53set(MACAPP_FISH_BUILDROOT ${CMAKE_CURRENT_BINARY_DIR}/macapp_buildroot/base)
54
55add_custom_command(TARGET fish_macapp POST_BUILD
56    COMMAND ${CMAKE_COMMAND} -E make_directory ${MACAPP_FISH_BUILDROOT}
57    COMMAND DESTDIR=${MACAPP_FISH_BUILDROOT} ${CMAKE_COMMAND}
58            --build ${CMAKE_CURRENT_BINARY_DIR} --target install
59    COMMAND ${CMAKE_COMMAND} -E copy_directory ${MACAPP_FISH_BUILDROOT}/..
60            $<TARGET_BUNDLE_CONTENT_DIR:fish_macapp>/Resources/
61    VERBATIM
62)
63
64# The entitlements file.
65set(MACAPP_ENTITLEMENTS "${CMAKE_SOURCE_DIR}/osx/MacApp.entitlements")
66
67# Group our targets in a folder.
68set_property(TARGET fish_macapp PROPERTY FOLDER macapp)