mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 11:22:52 +08:00
CMake support for building Mac app
This commit is contained in:
parent
eaefed434d
commit
e0396d8ef8
|
@ -161,5 +161,8 @@ INCLUDE(cmake/Tests.cmake)
|
|||
# Set up install.
|
||||
INCLUDE(cmake/Install.cmake)
|
||||
|
||||
# Mac app.
|
||||
INCLUDE(cmake/MacApp.cmake)
|
||||
|
||||
INCLUDE(FeatureSummary)
|
||||
FEATURE_SUMMARY(WHAT ALL)
|
||||
|
|
47
cmake/MacApp.cmake
Normal file
47
cmake/MacApp.cmake
Normal file
|
@ -0,0 +1,47 @@
|
|||
# This is Mac-only.
|
||||
if (NOT APPLE)
|
||||
RETURN()
|
||||
endif (NOT APPLE)
|
||||
|
||||
# The source tree containing certain macOS resources.
|
||||
SET(OSX_DIR ${CMAKE_CURRENT_SOURCE_DIR}/osx)
|
||||
|
||||
SET(RESOURCE_FILES
|
||||
${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.
|
||||
ADD_EXECUTABLE(fish_macapp EXCLUDE_FROM_ALL
|
||||
${OSX_DIR}/osx_fish_launcher.m
|
||||
${RESOURCE_FILES}
|
||||
)
|
||||
|
||||
# Note CMake appends .app, so the real output name will be fish.app.
|
||||
# This target does not include the 'base' resource.
|
||||
SET_TARGET_PROPERTIES(fish_macapp PROPERTIES OUTPUT_NAME "fish")
|
||||
|
||||
FIND_LIBRARY(FOUNDATION_LIB Foundation)
|
||||
TARGET_LINK_LIBRARIES(fish_macapp ${FOUNDATION_LIB})
|
||||
|
||||
SET_TARGET_PROPERTIES(fish_macapp PROPERTIES
|
||||
MACOSX_BUNDLE TRUE
|
||||
MACOSX_BUNDLE_INFO_PLIST ${OSX_DIR}/CMakeMacAppInfo.plist.in
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "com.ridiculousfish.fish-shell"
|
||||
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.
|
||||
SET(MACAPP_FISH_BUILDROOT ${CMAKE_CURRENT_BINARY_DIR}/macapp_buildroot/base)
|
||||
|
||||
ADD_CUSTOM_COMMAND(TARGET fish_macapp POST_BUILD
|
||||
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/
|
||||
)
|
33
osx/CMakeMacAppInfo.plist.in
Normal file
33
osx/CMakeMacAppInfo.plist.in
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>fish shell</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>fish_term_icon</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>fish shell</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>0.1</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.productivity</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.6</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2012, ridiculous_fish
|
||||
All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -88,7 +88,7 @@ int main(void) {
|
|||
@autoreleasepool {
|
||||
/* Get the fish executable. Make sure it's absolute. */
|
||||
NSURL *fish_executable = [[NSBundle mainBundle] URLForResource:@"fish" withExtension:@""
|
||||
subdirectory:@"base/bin"];
|
||||
subdirectory:@"base/usr/local/bin"];
|
||||
if (! fish_executable)
|
||||
die("Could not find fish executable in bundle");
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user