From ebaf8df9259d2a03717f5627380a5292111df675 Mon Sep 17 00:00:00 2001 From: SageMik Date: Thu, 17 Oct 2024 21:26:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Windows=20=E9=9B=86?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/simple.yml | 45 ++++++++++++++++++++++++++++++++++++ .gitignore | 29 +++++++++++++++++++++++ CMakeLists.txt | 13 +++++++++++ README.md | 14 +++++++++++ 4 files changed, 101 insertions(+) create mode 100644 .github/workflows/simple.yml create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 README.md diff --git a/.github/workflows/simple.yml b/.github/workflows/simple.yml new file mode 100644 index 0000000..b6576e0 --- /dev/null +++ b/.github/workflows/simple.yml @@ -0,0 +1,45 @@ +name: 编译 Simple 原生库 + +on: + push: + branches: [ "simple-native" ] + pull_request: + branches: [ "simple-native" ] + workflow_dispatch: + +jobs: + Windows-CMake-DLL: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + # Flutter 不支持 32位 Windows,所以只编译 x64 即可,不需要 x86 + - name: '设置构建类型和构建目录' + id: preset + run: | + echo "BUILD_TYPE=Release" >> $env:GITHUB_OUTPUT + echo "BUILD_ARCH=X64" >> $env:GITHUB_OUTPUT + echo "BUILD_DIR=${{ github.workspace }}/windows_build" >> $env:GITHUB_OUTPUT + + - name: 'CMake 编译,通过 VS16 生成器' + uses: lukka/run-cmake@v3 + with: + cmakeListsOrSettingsJson: CMakeListsTxtAdvanced + cmakeListsTxtPath: "${{ github.workspace }}/CMakeLists.txt" + buildDirectory: ${{ steps.preset.outputs.BUILD_DIR }} + useVcpkgToolchainFile: true + cmakeBuildType: ${{ steps.preset.outputs.BUILD_TYPE }} + buildWithCMake: true + cmakeGenerator: VS16Win64 + cmakeAppendedArgs: -A ${{ steps.preset.outputs.BUILD_ARCH }} + buildWithCMakeArgs: --config ${{ steps.preset.outputs.BUILD_TYPE }} + + - name: '上传编译产物' + uses: actions/upload-artifact@v4 + with: + name: windows + path: "${{ steps.preset.outputs.BUILD_DIR }}/_deps/simple-build/src/${{ steps.preset.outputs.BUILD_TYPE }}/simple.dll" + retention-days: 90 + compression-level: 0 + overwrite: true \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1351143 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. +/pubspec.lock +**/doc/api/ +.dart_tool/ +build/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3e7dd1d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.19) + +project(simple_without_sqlite3) + +include(FetchContent) + +FetchContent_Declare(simple + GIT_REPOSITORY https://github.com/wangfenjin/simple.git + GIT_TAG 473fc89 +) +set(BUILD_SQLITE3 OFF) +set(BUILD_TEST_EXAMPLE OFF) +FetchContent_MakeAvailable(simple) diff --git a/README.md b/README.md new file mode 100644 index 0000000..2d3dcc3 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# simple-native + +该分支用于编译和维护不含 SQLite 的 Simple 原生库,以供主分支使用。 + +通过 Github Actions 进行持续集成(CI),详见 [`.github/workflow/simple.yaml`](.github/workflows/simple.yml) 。 + +| 平台 | 持续集成 | +| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| **Android** | 否,通过 Gradle & CMake 编译:[simple-android-native](https://github.com/SageMik/simple-android-native),
Android 项目可从 Maven Central 引入 | +| **iOS** | 待集成,手动编译产物在主分支 | +| **Windows** | ✔ | +| **MacOS** | 待集成 | +| **Linux** | 待定 | +| **Web** | 待定 |