Skip to content

Commit

Permalink
Develop (#12)
Browse files Browse the repository at this point in the history
* use openssl for android and wasm that already exports the target (#9)

* use common cmake functions

* use IFW

* used versioned common and install qtdependencies for QVaultcli
  • Loading branch information
EddyTheCo authored Mar 28, 2024
1 parent 6fa29e0 commit 8adcfd8
Show file tree
Hide file tree
Showing 4 changed files with 168 additions and 170 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/build-docs.yml

This file was deleted.

51 changes: 45 additions & 6 deletions .github/workflows/build-test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,30 @@ jobs:
matrix:
os: [ubuntu-latest,macos-latest,windows-latest]

uses: EddyTheCo/Common/.github/workflows/[email protected]
permissions:
contents: write
uses: EddyTheCo/Common/.github/workflows/[email protected]
with:
os: ${{ matrix.os }}
qtVersion: '6.6.0'
qtVersion: '6.6.0'
cmakeArgs: " -DQTDEPLOY=ON [email protected] -DREPO_URL=https://eddytheco.github.io/QVault -DCPACK_PACKAGE_VENDOR=estervtech"
test: false

build_doxygen:
if: startsWith(github.ref, 'refs/tags/v')
uses: EddyTheCo/Common/.github/workflows/[email protected]

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

permissions:
contents: write
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:

Expand All @@ -34,7 +45,35 @@ 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
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;
mv ${{runner.temp}}/platforms/* github-pages/packages/
rm -rf artifacts/*/_CPack_Packages
- name: Package github-page
working-directory: ${{ github.workspace }}/github-pages/
run: |
cmake -E make_directory ${{runner.temp}}/page-packages
cmake -E tar c ${{runner.temp}}/page-packages/github-pages.tar -- .
- name: Releases
uses: softprops/action-gh-release@v1
with:
files: ./artifacts/*/*
files: ./artifacts/*/*

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

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
265 changes: 117 additions & 148 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ 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.1.1
)
ccommon
GIT_REPOSITORY https://github.com/EddyTheCo/Common.git
GIT_TAG v0.3.0
)
FetchContent_MakeAvailable(ccommon)
version_from_git(
LOG OFF
TIMESTAMP "%Y%m%d%H%M%S"
)
project(QtVault VERSION ${VERSION} DESCRIPTION "Store encrypted and plain data on the system" LANGUAGES CXX)
LOG OFF
TIMESTAMP "%Y%m%d%H%M%S"
)
project(QtVault VERSION ${VERSION} DESCRIPTION "Store encrypted data on the local system" LANGUAGES CXX)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CXX_STANDARD 17)
Expand All @@ -23,159 +23,128 @@ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
include(GNUInstallDirs)

if(USE_QML)
find_package(Qt6 COMPONENTS Core Gui Quick Core Network)
find_package(Qt6 COMPONENTS Core Gui Quick Core Network)
else()
find_package(Qt6 COMPONENTS Core Network)
find_package(Qt6 COMPONENTS Core Network)
endif()


find_package(OpenSSL)


if(NOT OPENSSL_FOUND)
if(EMSCRIPTEN OR ANDROID)
if(EMSCRIPTEN)
set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_true-android_none.tar")
endif(EMSCRIPTEN)
if(ANDROID)
set(android_abi_ossl "android-arm")
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(android_abi_ossl "android-arm64")
endif()
set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_false-android_${android_abi_ossl}.tar")
endif(ANDROID)
FetchContent_Declare(
openssl
DOWNLOAD_EXTRACT_TIMESTAMP true
URL ${builturl}
)
FetchContent_GetProperties(openssl)
if(NOT openssl_POPULATED)
message(STATUS "openssl prebuilt will be downloaded from ${builturl} if not found on the system")
FetchContent_Populate(openssl)
message(STATUS "openssl is installed in ${openssl_SOURCE_DIR}")
set(OPENSSL_FOUND ON)
add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
set_target_properties(OpenSSL::Crypto PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${openssl_SOURCE_DIR}/include")

if(EMSCRIPTEN)
set_target_properties(OpenSSL::Crypto PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${openssl_SOURCE_DIR}/libx32/libcrypto.a")
endif(EMSCRIPTEN)
if(ANDROID)
set_target_properties(OpenSSL::Crypto PROPERTIES
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${openssl_SOURCE_DIR}/lib/libcrypto.a")
endif(ANDROID)
endif(NOT openssl_POPULATED)
endif(EMSCRIPTEN)
if(EMSCRIPTEN OR ANDROID)
if(EMSCRIPTEN)
set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_true-android_none.tar")
endif(EMSCRIPTEN)
if(ANDROID)
set(android_abi_ossl "android-arm")
if(ANDROID_ABI STREQUAL "arm64-v8a")
set(android_abi_ossl "android-arm64")
endif()
set(builturl "https://github.com/EddyTheCo/install-openssl-action/releases/latest/download/openssl-wasm_false-android_${android_abi_ossl}.tar")
endif(ANDROID)
FetchContent_Declare(
openssl
DOWNLOAD_EXTRACT_TIMESTAMP true
URL ${builturl}
)
FetchContent_GetProperties(openssl)
if(NOT openssl_POPULATED)
message(STATUS "openssl prebuilt will be downloaded from ${builturl} if not found on the system")
FetchContent_Populate(openssl)
message(STATUS "openssl is installed in ${openssl_SOURCE_DIR}")
set(OPENSSL_FOUND ON)
endif(NOT openssl_POPULATED)
include(${openssl_SOURCE_DIR}/openssl.cmake)
create_targets()
endif(EMSCRIPTEN OR ANDROID )
endif(NOT OPENSSL_FOUND)

if(OPENSSL_FOUND AND TARGET OpenSSL::Crypto AND Qt6_FOUND)
qt_standard_project_setup()
add_library(vault include/vault.hpp src/vault.cpp)
add_library(${PROJECT_NAME}::vault ALIAS vault)
if(USE_QML)
qt6_add_qml_module(vault
URI Esterv.Utils.Vault
VERSION 1.0
RESOURCE_PREFIX
"/esterVtech.com/imports"
OUTPUT_TARGETS out_targets_var
OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/Esterv/Utils/Vault
IMPORT_PATH ${CMAKE_BINARY_DIR}
)
add_library(${PROJECT_NAME}::vaultplugin ALIAS vaultplugin)
target_link_libraries(vault PUBLIC Qt6::Gui Qt6::Quick)
target_compile_definitions(vault PRIVATE USE_QML)

install(TARGETS ${out_targets_var}
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT vault
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/Utils/Vault
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils
COMPONENT vault
)
install(TARGETS vaultplugin
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils/Vault
COMPONENT vault
)
endif(USE_QML)


target_include_directories(vault PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME}>")

target_link_libraries(vault PUBLIC Qt6::Core Qt6::Network OpenSSL::Crypto)
target_compile_definitions(vault PRIVATE WINDOWS_QVAULT)
if(EMSCRIPTEN)
target_compile_definitions(vault PRIVATE USE_EMSCRIPTEN)
endif(EMSCRIPTEN)

if(NOT EMSCRIPTEN AND NOT ANDROID)
add_executable(QVaultCli src/QVaultCli.cpp)
target_link_libraries(QVaultCli PRIVATE vault)
add_executable(${PROJECT_NAME}::QVaultCli ALIAS QVaultCli)
install(TARGETS QVaultCli
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT QVaultCli
)
endif(NOT EMSCRIPTEN AND NOT ANDROID)


install(TARGETS vault
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT vault
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv/${PROJECT_NAME}
COMPONENT vault
)

install(EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
NAMESPACE ${PROJECT_NAME}::
COMPONENT ${PROJECT_NAME}
)
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
VERSION ${VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}
)
export(EXPORT ${PROJECT_NAME}-config
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(examples)
set(CPACK_PACKAGE_CONTACT "estervtech")
include(CTest)
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-v${SEMVER}-${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_VERSION}-${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_CXX_COMPILER_ID}")
include(CPack)
endif()

qt_standard_project_setup()
add_library(qvault include/vault.hpp src/vault.cpp)
add_library(${PROJECT_NAME}::qvault ALIAS qvault)
set_target_properties(qvault PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR})
if(USE_QML)
qt6_add_qml_module(qvault
URI Esterv.Utils.Vault
VERSION 1.0
RESOURCE_PREFIX
"/esterVtech.com/imports"
OUTPUT_TARGETS out_targets_var
OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/Esterv/Utils/Vault
IMPORT_PATH ${CMAKE_BINARY_DIR}
)
add_library(${PROJECT_NAME}::qvaultplugin ALIAS qvaultplugin)
target_link_libraries(qvault PUBLIC Qt6::Gui Qt6::Quick)
target_compile_definitions(qvault PRIVATE USE_QML)

install(TARGETS ${out_targets_var}
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT vault
)
install(DIRECTORY ${CMAKE_BINARY_DIR}/Esterv/Utils/Vault
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils
COMPONENT vault
)
install(TARGETS qvaultplugin
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils/Vault
COMPONENT vault
)
endif(USE_QML)


target_include_directories(qvault PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/Esterv/>")

target_link_libraries(qvault PUBLIC Qt6::Core Qt6::Network OpenSSL::Crypto)
target_compile_definitions(qvault PRIVATE WINDOWS_QVAULT)
if(EMSCRIPTEN)
target_compile_definitions(qvault PRIVATE USE_EMSCRIPTEN)
endif(EMSCRIPTEN)

if(NOT EMSCRIPTEN AND NOT ANDROID)
add_executable(QVaultCli src/QVaultCli.cpp)
target_link_libraries(QVaultCli PRIVATE qvault)
add_executable(${PROJECT_NAME}::QVaultCli ALIAS QVaultCli)
set_target_properties(QVaultCli PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
install(TARGETS QVaultCli COMPONENT vaultCli
BUNDLE DESTINATION . COMPONENT vaultCli
)
if(QTDEPLOY)
qt_generate_deploy_app_script(
TARGET QVaultCli
OUTPUT_SCRIPT deploy_script
)
install(SCRIPT ${deploy_script} COMPONENT vaultCli)
endif(QTDEPLOY)
endif(NOT EMSCRIPTEN AND NOT ANDROID)


install(TARGETS qvault
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT vault
)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
COMPONENT ${PROJECT_NAME}
)
build_exports()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(examples)
build_cpack()
endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)

endif(OPENSSL_FOUND AND TARGET OpenSSL::Crypto AND Qt6_FOUND)


if(BUILD_DOCS)
get_target_property(build_docs cmake_build_docs SOURCES)
include(${build_docs})
build_docs()
endif()
Loading

0 comments on commit 8adcfd8

Please sign in to comment.