Skip to content

Commit

Permalink
Use latest (#80)
Browse files Browse the repository at this point in the history
* Align names and use cmake presets

* use action with cmake presets
  • Loading branch information
EddyTheCo authored Sep 22, 2024
1 parent be98358 commit 8a18bc6
Show file tree
Hide file tree
Showing 31 changed files with 432 additions and 172 deletions.
27 changes: 9 additions & 18 deletions .github/workflows/build-test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,15 @@ jobs:
matrix:
os: [ubuntu-latest,macos-latest,windows-latest]

uses: EddyTheCo/Common/.github/workflows/build-test-install.yml@v0.3.0
uses: EddyTheCo/Common/.github/workflows/build-test-install.yml@ndk26
with:
os: ${{ matrix.os }}
qtVersion: '6.6.0'
cmakeArgs: "-DQTDEPLOY=ON -DBUILD_EXAMPLES=ON -DCPACK_PACKAGE_CONTACT=estervtech@gmail.com -DREPO_URL=https://eddytheco.github.io/qrCode -DCPACK_PACKAGE_VENDOR=estervtech"
qtVersion: '6.7.0'
qtModules: 'qtshadertools qtmultimedia'
test: false

build_doxygen:
if: startsWith(github.ref, 'refs/tags/v')
uses: EddyTheCo/Common/.github/workflows/build-docs.yml@v0.3.0
with:
cmakeArgs: "-DBUILD_QRDEC=OFF -DBUILD_QRGEN=OFF"

release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build_test_package, build_doxygen]
needs: build_test_package
runs-on: ubuntu-latest

permissions:
Expand All @@ -48,13 +40,11 @@ jobs:
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure of downloaded files
run: ls -R

- name: Move repositories to webpage
run: |
mv artifacts/docs/html github-pages
rm -rf artifacts/docs
mv artifacts/common/html github-pages
mv artifacts/common .
mkdir github-pages/packages/ ${{runner.temp}}/platforms/
mv artifacts/*/_CPack_Packages/* ${{runner.temp}}/platforms/
for i in ${{runner.temp}}/platforms/*; do mv $i/IFW/*/repository/* $i/; rm -rf $i/IFW $i/TGZ; done;
Expand All @@ -68,13 +58,14 @@ jobs:
cmake -E tar c ${{runner.temp}}/page-packages/github-pages.tar -- .
- name: Releases
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
with:
files: ./artifacts/*/*
files: ./artifacts/*/*
body_path: ./common/CHANGELOG.md

- uses: actions/upload-artifact@v4
with:
name: 'github-pages'
name: 'github-pages'
path: ${{runner.temp}}/page-packages/*

- name: Deploy to GitHub Pages
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/codeFormat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: codeFormat
run-name: Format code and do PR
on:
pull_request_target:
types: [closed]
branches: [develop]
jobs:
checkout-format-pr:
runs-on: ubuntu-latest
if: ${{ (github.event.pull_request.merged == true) && (startsWith(github.base_ref, 'develop')) }}
permissions:
contents: write
pull-requests: write

uses: EddyTheCo/Common/.github/workflows/codeFormat.yml@ndk26

35 changes: 35 additions & 0 deletions .github/workflows/qmllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: qmllintbot
run-name: Linting QML for PR
on:

workflow_run:
workflows: [push-build-release]
types:
- completed
jobs:
download-comment:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
permissions:
actions: read
pull-requests: write
steps:
- name: 'Download artifact'
uses: actions/download-artifact@v4
with:
name: common
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}

- name: Read pr number
id: getprn
run: |
cat pr_number
echo "prn=$(cat pr_number)" >> $GITHUB_OUTPUT
- name: 'Run reviewer'
uses: EddyTheCo/qmllint-action/@v0.1.0
with:
jsondir: ${{ github.workspace }}
pr_number: ${{ steps.getprn.outputs.prn }}

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
doc/html/
doc/*.tag
*.swp
CMakeLists.txt.user
build*
tags
CMakeUserPresets.json
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
cmake_minimum_required(VERSION 3.24)

option(BUILD_QRDEC "Build Decoding part" ON)
option(BUILD_QRENC "Build Encoding part" ON)
option(OpenCV_DOWNLOAD "Download prebuilts if find_package fails" ON)

include(${CMAKE_CURRENT_BINARY_DIR}/local_conf.cmake OPTIONAL)

include(FetchContent)
FetchContent_Declare(
ccommon
GIT_REPOSITORY https://github.com/EddyTheCo/Common.git
GIT_TAG v0.3.0
GIT_TAG ndk26
)
FetchContent_MakeAvailable(ccommon)
version_from_git(
LOG OFF
TIMESTAMP "%Y%m%d%H%M%S"
)
project(qrCode VERSION ${VERSION} DESCRIPTION "library for qr code manipulation" LANGUAGES CXX)
project(EstervQrCode VERSION ${VERSION} DESCRIPTION "Library for qr code manipulation" LANGUAGES CXX)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -30,6 +33,7 @@ endif(BUILD_QRDEC)
if(BUILD_QRENC)
add_subdirectory(QrGen)
endif(BUILD_QRENC)

add_subdirectory(QtQrDec)
add_subdirectory(QtQrGen)

Expand All @@ -41,4 +45,4 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
if(BUILD_DOCS)
build_docs()
endif()
endif(BUILD_DOCS)
154 changes: 154 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
{
"version": 6,
"configurePresets": [
{
"name": "default-release",
"displayName": "Default Release",
"description": "Release Static library using Ninja generator",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"REPO_URL":"https://eddytheco.github.io/Esterv.Utils.QrCode"
}
},
{
"name": "default-develop",
"displayName": "Default Config for development(Release)",
"description": "Release build type using Ninja generator, add tests and docs",
"inherits": "default-release",
"cacheVariables": {
"BUILD_DOCS":"ON",
"BUILD_EXAMPLES": "ON",
"QTDEPLOY":"ON"
}
},
{
"name": "default-develop-debug",
"displayName": "Default Config for development(Debug)",
"description": "Debug build type using Ninja generator",
"inherits": "default-develop",
"binaryDir": "${sourceDir}/build/debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
}
],
"buildPresets": [
{
"name": "default-release",
"configurePreset": "default-release"
},
{
"name": "default-develop",
"configurePreset": "default-develop"
},
{
"name": "default-develop-debug",
"configurePreset": "default-develop-debug"
},
{
"name": "default-documentation",
"configurePreset": "default-develop",
"targets":"doxygen_docs"
},
{
"name": "default-qmllint",
"configurePreset": "default-develop",
"targets":"all_qmllint_json"
}
],
"workflowPresets": [
{
"name": "default-release",
"steps": [
{
"type": "configure",
"name": "default-release"
},
{
"type": "build",
"name": "default-release"
}
]
},
{
"name": "default-develop",
"steps": [
{
"type": "configure",
"name": "default-develop"
},
{
"type": "build",
"name": "default-develop"
}
]
},
{
"name": "default-documentation",
"steps": [
{
"type": "configure",
"name": "default-develop"
},
{
"type": "build",
"name": "default-documentation"
}
]
},
{
"name": "default-qmllint",
"steps": [
{
"type": "configure",
"name": "default-develop"
},
{
"type": "build",
"name": "default-qmllint"
}
]
},
{
"name": "default-develop-debug",
"steps": [
{
"type": "configure",
"name": "default-develop-debug"
},
{
"type": "build",
"name": "default-develop-debug"
}
]
}
],
"packagePresets": [
{
"name": "default-release",
"description": "Release runtime components",
"configurePreset": "default-release",
"generators": [
"IFW","TGZ"
],
"variables": {
"CPACK_COMPONENTS_ALL": "EstervQrGen;EstervQtQrGen;EstervQrDec;EstervQtQrDec;EstervQtQrGen-qml;EstervQtQrDec-qml",
"CPACK_PACKAGE_CONTACT":"estervtech@gmail.com",
"CPACK_PACKAGE_VENDOR":"estervtech"
},
"packageDirectory": "packages"
},
{
"name": "default-develop",
"description": "Release development components",
"inherits":"default-release",
"configurePreset": "default-develop",
"variables": {
"CPACK_COMPONENTS_ALL": "EstervQrGen;EstervQrGen-dev;EstervQrDec;EstervQrDec-dev;EstervQtQrGen;EstervQtQrGen-dev;EstervQtQrDec;EstervQtQrDec-dev;EstervQtQrGen-qml;EstervQtQrDec-qml; EstervQrCode-examples"
}
}
]

}
4 changes: 2 additions & 2 deletions Config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@PACKAGE_INIT@
include(CMakeFindDependencyMacro)
find_dependency(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick Svg OPTIONAL_COMPONENTS Multimedia )
find_dependency(Qt6 COMPONENTS Core Gui Qml Quick Svg OPTIONAL_COMPONENTS Multimedia )
find_dependency(OpenCV COMPONENTS core objdetect imgproc flann features2d calib3d )
find_dependency(EstervDesigns 1.2 COMPONENTS SimpleStyle CustomControls CONFIG)
include ( "${CMAKE_CURRENT_LIST_DIR}/qrCode-config.cmake" )
include ( "${CMAKE_CURRENT_LIST_DIR}/EstervQrCode-config.cmake" )
26 changes: 12 additions & 14 deletions QrDec/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
find_package(OpenCV COMPONENTS core objdetect imgproc flann features2d calib3d )
find_package(OpenCV COMPONENTS core objdetect imgproc flann features2d calib3d)

option(OpenCV_DOWNLOAD "On or off" ON)
if(NOT OpenCV_FOUND AND OpenCV_DOWNLOAD)
set(builturl "https://github.com/EddyTheCo/install-OpenCV-action/releases/latest/download/OpenCV-ubuntu-latest-wasm_false-android_none.tar")
if(WIN32)
Expand Down Expand Up @@ -37,34 +36,33 @@ if(NOT OpenCV_FOUND AND OpenCV_DOWNLOAD)
if(OpenCV_FOUND AND NOT ANDROID AND NOT EMSCRIPTEN)
install(IMPORTED_RUNTIME_ARTIFACTS ${OpenCV_LIBS}
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT OpenCVDep
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT OpenCVDep
COMPONENT OpenCV-dep
RUNTIME COMPONENT OpenCV-dep
)
endif()
endif()



if(OpenCV_FOUND)
add_library(QrDec qrcodedec.cpp)
add_library(QrDec src/qrcode_dec.cpp)

add_library(${PROJECT_NAME}::QrDec ALIAS QrDec)
add_library(Esterv::QrDec ALIAS QrDec)
set_target_properties(QrDec PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR})
target_include_directories(QrDec PUBLIC $<BUILD_INTERFACE:${OpenCV_INCLUDE_DIRS}>)
target_link_libraries(QrDec PUBLIC ${OpenCV_LIBS})

target_include_directories(QrDec PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/Esterv/>")
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>")
install(TARGETS QrDec
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT QrDec
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT QrDec
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
COMPONENT ${PROJECT_NAME}
COMPONENT EstervQrDec
ARCHIVE COMPONENT ${PROJECT_NAME}-dev
)
install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
COMPONENT ${PROJECT_NAME}-dev)
else()
message(STATUS "The QRCODE decoding library will not be built")
endif(OpenCV_FOUND)
Loading

0 comments on commit 8a18bc6

Please sign in to comment.