From f2ea3bf935a87d0f1e824d68c9e0a77ece0b3f17 Mon Sep 17 00:00:00 2001 From: ksqsf Date: Sat, 9 Nov 2024 19:23:36 +0100 Subject: [PATCH] build: add cmake support --- .github/workflows/cmake-ci.yml | 17 ++++ .../RimeIcon.appiconset/Contents.json | 20 ++-- .../{rime-128.png => icon-128x128.png} | Bin .../{rime-256.png => icon-128x128@2.png} | Bin .../{rime-16 1.png => icon-16x16.png} | Bin .../{rime-32 1.png => icon-16x16@2.png} | Bin .../RimeIcon.appiconset/icon-256x256.png | Bin 0 -> 6452 bytes .../{rime-512.png => icon-256x256@2.png} | Bin .../{rime-32.png => icon-32x32.png} | Bin .../{rime-64.png => icon-32x32@2.png} | Bin .../RimeIcon.appiconset/icon-512x512.png | Bin 0 -> 11986 bytes .../{rime-1024.png => icon-512x512@2.png} | Bin CMakeLists.txt | 95 ++++++++++++++++++ INSTALL.md | 17 ++++ cmake/AddRime.cmake | 22 ++++ cmake/AddSparkle.cmake | 18 ++++ cmake/AppleUtils.cmake | 10 ++ data/CMakeLists.txt | 21 ++++ librime | 2 +- package/CMakeLists.txt | 12 +++ package/make_package | 9 +- resources/CMakeLists.txt | 31 ++++++ 22 files changed, 262 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/cmake-ci.yml rename Assets.xcassets/RimeIcon.appiconset/{rime-128.png => icon-128x128.png} (100%) rename Assets.xcassets/RimeIcon.appiconset/{rime-256.png => icon-128x128@2.png} (100%) rename Assets.xcassets/RimeIcon.appiconset/{rime-16 1.png => icon-16x16.png} (100%) rename Assets.xcassets/RimeIcon.appiconset/{rime-32 1.png => icon-16x16@2.png} (100%) create mode 100644 Assets.xcassets/RimeIcon.appiconset/icon-256x256.png rename Assets.xcassets/RimeIcon.appiconset/{rime-512.png => icon-256x256@2.png} (100%) rename Assets.xcassets/RimeIcon.appiconset/{rime-32.png => icon-32x32.png} (100%) rename Assets.xcassets/RimeIcon.appiconset/{rime-64.png => icon-32x32@2.png} (100%) create mode 100644 Assets.xcassets/RimeIcon.appiconset/icon-512x512.png rename Assets.xcassets/RimeIcon.appiconset/{rime-1024.png => icon-512x512@2.png} (100%) create mode 100644 CMakeLists.txt create mode 100644 cmake/AddRime.cmake create mode 100644 cmake/AddSparkle.cmake create mode 100644 cmake/AppleUtils.cmake create mode 100644 data/CMakeLists.txt create mode 100644 package/CMakeLists.txt create mode 100644 resources/CMakeLists.txt diff --git a/.github/workflows/cmake-ci.yml b/.github/workflows/cmake-ci.yml new file mode 100644 index 000000000..f88130328 --- /dev/null +++ b/.github/workflows/cmake-ci.yml @@ -0,0 +1,17 @@ +name: cmake ci +on: [workflow_dispatch] +jobs: + build: + runs-on: macos-14 + steps: + - name: Checkout last commit + uses: actions/checkout@v4 + with: + submodules: recursive + - name: Configure build environment + run: | + brew install ninja rsync + - name: Build + run: | + cmake -S. -GNinja -DCMAKE_OSX_DEPLOYMENT_TARGET=13 + ninja -Cbuild diff --git a/Assets.xcassets/RimeIcon.appiconset/Contents.json b/Assets.xcassets/RimeIcon.appiconset/Contents.json index acfdfc399..1553a9150 100644 --- a/Assets.xcassets/RimeIcon.appiconset/Contents.json +++ b/Assets.xcassets/RimeIcon.appiconset/Contents.json @@ -1,61 +1,61 @@ { "images" : [ { - "filename" : "rime-16 1.png", + "filename" : "icon-16x16.png", "idiom" : "mac", "scale" : "1x", "size" : "16x16" }, { - "filename" : "rime-32 1.png", + "filename" : "icon-16x16@2.png", "idiom" : "mac", "scale" : "2x", "size" : "16x16" }, { - "filename" : "rime-32.png", + "filename" : "icon-32x32.png", "idiom" : "mac", "scale" : "1x", "size" : "32x32" }, { - "filename" : "rime-64.png", + "filename" : "icon-32x32@2.png", "idiom" : "mac", "scale" : "2x", "size" : "32x32" }, { - "filename" : "rime-128.png", + "filename" : "icon-128x128.png", "idiom" : "mac", "scale" : "1x", "size" : "128x128" }, { - "filename" : "rime-256.png", + "filename" : "icon-128x128@2.png", "idiom" : "mac", "scale" : "2x", "size" : "128x128" }, { - "filename" : "rime-256.png", + "filename" : "icon-256x256.png", "idiom" : "mac", "scale" : "1x", "size" : "256x256" }, { - "filename" : "rime-512.png", + "filename" : "icon-256x256@2.png", "idiom" : "mac", "scale" : "2x", "size" : "256x256" }, { - "filename" : "rime-512.png", + "filename" : "icon-512x512.png", "idiom" : "mac", "scale" : "1x", "size" : "512x512" }, { - "filename" : "rime-1024.png", + "filename" : "icon-512x512@2.png", "idiom" : "mac", "scale" : "2x", "size" : "512x512" diff --git a/Assets.xcassets/RimeIcon.appiconset/rime-128.png b/Assets.xcassets/RimeIcon.appiconset/icon-128x128.png similarity index 100% rename from Assets.xcassets/RimeIcon.appiconset/rime-128.png rename to Assets.xcassets/RimeIcon.appiconset/icon-128x128.png diff --git a/Assets.xcassets/RimeIcon.appiconset/rime-256.png b/Assets.xcassets/RimeIcon.appiconset/icon-128x128@2.png similarity index 100% rename from Assets.xcassets/RimeIcon.appiconset/rime-256.png rename to Assets.xcassets/RimeIcon.appiconset/icon-128x128@2.png diff --git a/Assets.xcassets/RimeIcon.appiconset/rime-16 1.png b/Assets.xcassets/RimeIcon.appiconset/icon-16x16.png similarity index 100% rename from Assets.xcassets/RimeIcon.appiconset/rime-16 1.png rename to Assets.xcassets/RimeIcon.appiconset/icon-16x16.png diff --git a/Assets.xcassets/RimeIcon.appiconset/rime-32 1.png b/Assets.xcassets/RimeIcon.appiconset/icon-16x16@2.png similarity index 100% rename from Assets.xcassets/RimeIcon.appiconset/rime-32 1.png rename to Assets.xcassets/RimeIcon.appiconset/icon-16x16@2.png diff --git a/Assets.xcassets/RimeIcon.appiconset/icon-256x256.png b/Assets.xcassets/RimeIcon.appiconset/icon-256x256.png new file mode 100644 index 0000000000000000000000000000000000000000..e12ead07c580610d62c28986b7d233b263ca1ccc GIT binary patch literal 6452 zcmcIp2{@GP`d5k>OUByBHWNu+<*V~fUtedrzH|QPI@kHTxZdY}-rv37&wJnRE8Wf2K~`#ml$e;9 zEZK33hnUzZV7W>RBmrFfVyc+H1FHcAKf9l{B>*0B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la~x z^O2}x%GyT(BavZMI;OVR1RlKurJAuqd8Vlws z_z6=NfOT>{>wHCiGtmhZ#Al(Jdw->CTOkqtCFT;V{5{?}1aF5L{!6NJOxa5!D8&!{ zplv9WU$Do%LSn-UG+ziQ%aka_b_QHI-gQECDwY%A9YOHU{WRGkd4k(8B$UO4;{`uc zb-(I=gIk#82k_f(qn}J4n{sv4-C0rtp0u2EQ?|<+oBL|#OhI=4ThB4A9EZy%woi*e z&JVlPEIcpKwh$hl3nL82nVr+gvABFvG_^NOTKXJ6-6+Y)H`pmn;W~6oqB~UssjipH z9xY^pVbajKsYb3!te}EJ2)YheDNp7_Wex{f@Mb_jb?Omk7ruQ!E{bV5nYW^u(U%Ld zcJ23b$6?)xOq24yx-8f7zGR$2ARd2Bw^x7JDnsbEU}?d37Do`;ClaDc-i)_sDz<8Y z2*{$>n5u-X4F#Vhc!r&(a5tM%b&tZ&T6Lb`=f9WU)FE-QUBpn^tW7F>ao9=ON~ST@ z6dmUPjzGTssncPlcd6S$h{_qFrm*rOt$PLT;LDw%gtR{W<@$+_aV9FgdKNvq`}unP zJ+A!%y?()Z8reaip3yLrTQ@>dYiw0cEzy2$5 s%rxF7uwM + -DCMAKE_BUILD_TYPE=Release + -DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET} + -DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES} + -DBUILD_MERGED_PLUGINS=OFF + -DENABLE_EXTERNAL_PLUGINS=ON + -DBUILD_TEST=OFF +) + +add_library(rime INTERFACE) +add_dependencies(rime BuildRime) +target_include_directories(rime INTERFACE "${PROJECT_BINARY_DIR}/librime/include") +target_link_directories(rime INTERFACE "${PROJECT_BINARY_DIR}/librime/lib/") +target_link_libraries(rime INTERFACE -lrime) + +find_path(X11Keysym X11/keysym.h) +target_include_directories(rime INTERFACE ${X11Keysym}) diff --git a/cmake/AddSparkle.cmake b/cmake/AddSparkle.cmake new file mode 100644 index 000000000..d0bd9b4cc --- /dev/null +++ b/cmake/AddSparkle.cmake @@ -0,0 +1,18 @@ +include(ExternalProject) + +ExternalProject_Add(BuildSparkle + SOURCE_DIR "${PROJECT_SOURCE_DIR}/Sparkle" + + CONFIGURE_COMMAND "" + + BUILD_COMMAND xcodebuild -project "/Sparkle.xcodeproj" -scheme Sparkle -configuration Release + BUILD_IN_SOURCE TRUE + + # Install Sparkle.framework + INSTALL_COMMAND cp -a "/build/Release/Sparkle.framework" "${CMAKE_BINARY_DIR}" +) + +add_library(Sparkle INTERFACE) +add_dependencies(Sparkle BuildSparkle) +target_include_directories(Sparkle INTERFACE "${CMAKE_BINARY_DIR}/Sparkle.framework/Headers") +target_link_libraries(Sparkle INTERFACE "${CMAKE_BINARY_DIR}/Sparkle.framework") diff --git a/cmake/AppleUtils.cmake b/cmake/AppleUtils.cmake new file mode 100644 index 000000000..4fbe4e816 --- /dev/null +++ b/cmake/AppleUtils.cmake @@ -0,0 +1,10 @@ +macro(process_xcstrings path outdir) + get_filename_component(basename ${path} NAME_WLE) + set(target ${outdir}/en.lproj/${basename}.strings) + add_custom_command( + OUTPUT ${target} + COMMAND xcrun xcstringstool compile ${path} --output-directory ${outdir} + COMMENT "Process ${basename}.xcstrings" + ) + add_custom_target(xcstrings_${basename} ALL DEPENDS ${target}) +endmacro() diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 000000000..7cf9a1c4f --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,21 @@ +set(OUTDIR "${BUNDLE_SHARED_SUPPORT_DIR}") + +# ############################################################################## +# Plum +# ############################################################################## +add_custom_command( + OUTPUT "${OUTDIR}/default.yaml" + COMMAND make "OUTPUT=${OUTDIR}" -C "${PROJECT_SOURCE_DIR}/plum" + COMMENT "plum: update default schemas") +add_custom_target(plum-data ALL + DEPENDS "${OUTDIR}/default.yaml") + +# ############################################################################## +# OpenCC +# ############################################################################## +add_custom_command( + OUTPUT "${OUTDIR}/opencc/s2t.json" + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/librime/share/opencc ${OUTDIR}/opencc + COMMENT "opencc: copy data") +add_custom_target(opencc-data ALL + DEPENDS "${OUTDIR}/opencc/s2t.json") diff --git a/librime b/librime index 6b1b41f53..0cf0e63b3 160000 --- a/librime +++ b/librime @@ -1 +1 @@ -Subproject commit 6b1b41f53cd7fb8cd605c65cfb1e8d5c780f1308 +Subproject commit 0cf0e63b3a5460541bdd5110ec8f4bd31d647885 diff --git a/package/CMakeLists.txt b/package/CMakeLists.txt new file mode 100644 index 000000000..4b0caf82b --- /dev/null +++ b/package/CMakeLists.txt @@ -0,0 +1,12 @@ +add_custom_target(sign + COMMAND codesign --deep --force --options runtime --timestamp --verbose + --entitlements "${PROJECT_SOURCE_DIR}/resources/Squirrel.entitlements" + --sign "${SIGN_KEY}" "${BUNDLE_PATH}" + DEPENDS Squirrel +) + +add_custom_target(package + COMMAND ./make_package + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS sign +) diff --git a/package/make_package b/package/make_package index 61ce71b69..6efc96ac9 100755 --- a/package/make_package +++ b/package/make_package @@ -7,9 +7,16 @@ INSTALL_LOCATION='/Library/Input Methods' cd "$(dirname $0)" source common.sh +if [ -e "${PROJECT_ROOT}/build/Squirrel.app" ]; then + ROOT=`mktemp -d` + cp -a "${PROJECT_ROOT}/build/Squirrel.app" "$ROOT" +else + ROOT="${PROJECT_ROOT}/${DERIVED_DATA_PATH}/Build/Products/Release" +fi + pkgbuild \ --info PackageInfo \ - --root "${PROJECT_ROOT}/${DERIVED_DATA_PATH}/Build/Products/Release" \ + --root "$ROOT" \ --filter '.*\.swiftmodule$' \ --component-plist Squirrel-component.plist \ --identifier "${BUNDLE_IDENTIFIER}" \ diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt new file mode 100644 index 000000000..9ba96cc96 --- /dev/null +++ b/resources/CMakeLists.txt @@ -0,0 +1,31 @@ +# Info.plist +file(READ "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist" INFO_PLIST) +string(REPLACE "$(PRODUCT_BUNDLE_IDENTIFIER)" "@MACOSX_BUNDLE_GUI_IDENTIFIER@" INFO_PLIST "${INFO_PLIST}") +string(REPLACE "$(CURRENT_PROJECT_VERSION)" "@MACOSX_BUNDLE_BUNDLE_VERSION@" INFO_PLIST "${INFO_PLIST}") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/Info.plist" "${INFO_PLIST}") +set_target_properties(Squirrel PROPERTIES + MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_BINARY_DIR}/Info.plist +) + +# Static resources +set(FILES + ${PROJECT_SOURCE_DIR}/README.md + ${PROJECT_SOURCE_DIR}/LICENSE.txt + rime.pdf +) +foreach(f ${FILES}) + get_filename_component(filename ${f} NAME) + configure_file(${f} ${BUNDLE_RESOURCES_DIR}/${filename} COPYONLY) +endforeach() + +# Localization +include(AppleUtils) +process_xcstrings(${CMAKE_CURRENT_SOURCE_DIR}/Localizable.xcstrings ${BUNDLE_RESOURCES_DIR}) +process_xcstrings(${CMAKE_CURRENT_SOURCE_DIR}/InfoPlist.xcstrings ${BUNDLE_RESOURCES_DIR}) + +# RimeIcon.icns +add_custom_command( + OUTPUT ${BUNDLE_RESOURCES_DIR}/RimeIcon.icns + COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/Assets.xcassets/RimeIcon.appiconset ${CMAKE_BINARY_DIR}/RimeIcon.iconset && iconutil -c icns ${CMAKE_BINARY_DIR}/RimeIcon.iconset -o ${BUNDLE_RESOURCES_DIR}/RimeIcon.icns +) +add_custom_target(RimeIcon.icns ALL DEPENDS ${BUNDLE_RESOURCES_DIR}/RimeIcon.icns)