Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 28 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ on:
pull_request:
branches: [ master ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write
pull-requests: write

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Windows:
Expand All @@ -24,13 +32,12 @@ jobs:
steps:
- name: "Set Build Type"
id: build_type
shell: pwsh
run: |
if ("${{ github.ref }}".StartsWith("refs/tags/")) {
echo "BUILD_TYPE::Release";
echo "::set-output name=BUILD_TYPE::Release";
echo "BUILD_TYPE=Release" >> $env:GITHUB_OUTPUT
} else {
echo "BUILD_TYPE::Debug";
echo "::set-output name=BUILD_TYPE::Debug";
echo "BUILD_TYPE=Debug" >> $env:GITHUB_OUTPUT
}

if ("${{ matrix.arch }}" -eq "x64") {
Expand All @@ -50,7 +57,7 @@ jobs:
# uses: ammaraskar/msvc-problem-matcher@master

# Install latest CMake
- uses: lukka/get-cmake@latest
- uses: lukka/get-cmake@v3.31.6

# Restore from cache the previously built ports
- name: Restore artifacts, or setup vcpkg
Expand All @@ -66,6 +73,7 @@ jobs:

- name: 'Run CMake'
uses: lukka/run-cmake@v10
continue-on-error: false
with:
configurePreset: 'windows-msvc-vs17'
buildPreset: ${{ startsWith(github.ref, 'refs/tags/') && 'windows-msvc-vs17-release' || 'windows-msvc-vs17' }}
Expand Down Expand Up @@ -108,23 +116,21 @@ jobs:
working-directory: "${{ github.workspace }}/../../_temp/windows/"
- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
files: "D:/a/_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
# files: "${{ github.workspace }}/../../_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
files: "${{ github.workspace }}/../../_temp/windows/libsimple-windows-${{ matrix.arch }}.zip"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_TYPE: ${{ github.ref_type == 'tag' && 'Release' || 'Debug' }}

Linux:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-22.04-arm
- os: ubuntu-latest
os: [ubuntu-20.04, ubuntu-22.04-arm, ubuntu-latest]
timeout-minutes: 60
steps:
- name: "Release Build Type"
if: startsWith(github.ref, 'refs/tags/')
Expand Down Expand Up @@ -167,7 +173,7 @@ jobs:

- name: 'Run CMake'
uses: lukka/run-cmake@v10
if: startsWith(github.ref, 'refs/tags/') != true
continue-on-error: false
with:
configurePreset: 'ninja-vcpkg-coverage'
buildPreset: 'ninja-vcpkg-coverage'
Expand Down Expand Up @@ -243,7 +249,7 @@ jobs:
working-directory: "${{ github.workspace }}/build"
- name: Release without changelog
if: ${{ startsWith(github.ref, 'refs/tags/') && matrix.os != 'ubuntu-latest' }}
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
draft: true
files: ${{ github.workspace }}/build/libsimple-linux-${{ matrix.os }}.zip
Expand All @@ -259,6 +265,13 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build Summary
if: always()
run: |
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
echo "- Build Type: ${{ env.BUILD_TYPE }}" >> $GITHUB_STEP_SUMMARY
echo "- OS: ${{ runner.os }}" >> $GITHUB_STEP_SUMMARY

MacOS:
runs-on: macos-latest
needs: Linux
Expand Down Expand Up @@ -348,4 +361,5 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: build-iOS
if: success()
run: ./build-ios.sh
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ if(BUILD_SQLITE3)
set(SQLITE_INSTALL_DIR ${SQLITE_ROOT})
set(SQLITE_INCLUDE_DIR ${SQLITE_INSTALL_DIR}/include)
set(SQLITE_LIB_DIR ${SQLITE_INSTALL_DIR}/lib)
if (NOT IOS)
option(SQLITE_ENABLE_FTS5 "enables full text searches version 5" ON)
if (MSVC OR (UNIX AND NOT IOS))
option(SQLITE_ENABLE_FTS5 "enables full text searches version 5" ON)
option(BUILD_SHELL "build SQLite3 shell application" ON)
add_subdirectory(contrib/sqlite3)
endif()
Expand Down
16 changes: 16 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
"CMAKE_INSTALL_PREFIX": {
"type": "PATH",
"value": "${sourceDir}/../../_temp/macos/install"
},
"BUILD_SHELL": {
"type": "BOOL",
"value": "OFF"
}
}
},
Expand All @@ -81,9 +85,21 @@
"type": "FILEPATH",
"value": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
},
"BUILD_SHELL": {
"type": "BOOL",
"value": "OFF"
},
"BUILD_TESTING": {
"type": "BOOL",
"value": "OFF"
},
"BUILD_SQLITE3": {
"type": "BOOL",
"value": "ON"
},
"SQLITE_ENABLE_FTS5": {
"type": "BOOL",
"value": "ON"
}
},
"condition": {
Expand Down
2 changes: 1 addition & 1 deletion contrib/CMakeRC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ endif()

set(_version 2.0.0)

cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.19)
include(CMakeParseArguments)

if(COMMAND cmrc_add_resource_library)
Expand Down
2 changes: 1 addition & 1 deletion contrib/ios.toolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
# command.
#

cmake_minimum_required(VERSION 3.8.0)
cmake_minimum_required(VERSION 3.19)

# CMake invokes the toolchain file twice during the first build, but only once during subsequent rebuilds.
if(IOS_TOOLCHAIN_HAS_RUN)
Expand Down
2 changes: 1 addition & 1 deletion contrib/sqlite3/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.19)
project(SQLite3
VERSION 3.31.1
LANGUAGES C
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.19)
project(simple_cpp_example)

include_directories(${SQLITE3_HEADERS_DIR})
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.19)
project(simple CXX)

if(SIMPLE_WITH_JIEBA)
Expand Down
18 changes: 9 additions & 9 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.19)
project(simple_tests)

# https://github.com/maps-gpu/MAPS/issues/7#issuecomment-418200278
Expand All @@ -8,13 +8,20 @@ cmake_policy(SET CMP0057 NEW)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/src)

# Download and unpack googletest at configure time
set(GTEST_CMAKE_ARGS
"-DCMAKE_POLICY_DEFAULT_CMP0048=NEW"
)
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" ${GTEST_CMAKE_ARGS} .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
if(result)
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
endif()

# Set policy version minimum before adding googletest
set(CMAKE_POLICY_VERSION_MINIMUM "3.5" CACHE STRING "Minimum CMake policy version" FORCE)

execute_process(COMMAND ${CMAKE_COMMAND} --build .
RESULT_VARIABLE result
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download )
Expand All @@ -32,13 +39,6 @@ add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
EXCLUDE_FROM_ALL)

# The gtest/gtest_main targets carry header search path
# dependencies automatically when using CMake 2.8.11 or
# later. Otherwise we have to add them here ourselves.
if (CMAKE_VERSION VERSION_LESS 2.8.11)
include_directories("${gtest_SOURCE_DIR}/include")
endif()

include_directories(${SIMPLE_HEADERS_DIR})
include_directories(${SQLITE3_HEADERS_DIR})
set(SOURCE_FILES main.cpp pinyin_test.cc tokenizer_test.cc)
Expand Down
2 changes: 1 addition & 1 deletion test/CMakeLists.txt.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.19)
cmake_policy(SET CMP0057 NEW)

project(googletest-download NONE)
Expand Down
Loading