Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ifw #11

Merged
merged 6 commits into from
Mar 28, 2024
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
6 changes: 3 additions & 3 deletions .github/workflows/build-test-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ jobs:
matrix:
os: [ubuntu-latest,macos-latest,windows-latest]

uses: EddyTheCo/Common/.github/workflows/build-test-install.yml@use_IFW
uses: EddyTheCo/Common/.github/workflows/build-test-install.yml@v0.3.0
with:
os: ${{ matrix.os }}
qtVersion: '6.6.0'
cmakeArgs: "[email protected] -DREPO_URL=https://eddytheco.github.io/QVault -DCPACK_PACKAGE_VENDOR=estervtech"
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/build-docs.yml@use_IFW
uses: EddyTheCo/Common/.github/workflows/build-docs.yml@v0.3.0

release:
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
88 changes: 27 additions & 61 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ include(FetchContent)
FetchContent_Declare(
ccommon
GIT_REPOSITORY https://github.com/EddyTheCo/Common.git
GIT_TAG use_IFW
GIT_TAG v0.3.0
)
FetchContent_MakeAvailable(ccommon)
version_from_git(
Expand Down Expand Up @@ -63,11 +63,11 @@ 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)
set_target_properties(vault PROPERTIES VERSION ${VERSION} SOVERSION ${VERSION_MAJOR})
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(vault
qt6_add_qml_module(qvault
URI Esterv.Utils.Vault
VERSION 1.0
RESOURCE_PREFIX
Expand All @@ -77,9 +77,9 @@ if(OPENSSL_FOUND AND TARGET OpenSSL::Crypto AND Qt6_FOUND)
${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)
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
Expand All @@ -90,95 +90,61 @@ if(OPENSSL_FOUND AND TARGET OpenSSL::Crypto AND Qt6_FOUND)
DESTINATION ${CMAKE_INSTALL_LIBDIR}/Esterv/Utils
COMPONENT vault
)
install(TARGETS vaultplugin
install(TARGETS qvaultplugin
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>
target_include_directories(qvault PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/Esterv/>")

target_link_libraries(vault PUBLIC Qt6::Core Qt6::Network OpenSSL::Crypto)
target_compile_definitions(vault PRIVATE WINDOWS_QVAULT)
target_link_libraries(qvault PUBLIC Qt6::Core Qt6::Network OpenSSL::Crypto)
target_compile_definitions(qvault PRIVATE WINDOWS_QVAULT)
if(EMSCRIPTEN)
target_compile_definitions(vault PRIVATE USE_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 vault)
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
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT vaultCli
install(TARGETS QVaultCli COMPONENT vaultCli
BUNDLE DESTINATION . COMPONENT vaultCli
)
qt_generate_deploy_app_script(
TARGET QVaultCli
OUTPUT_SCRIPT deploy_script
)
install(SCRIPT ${deploy_script})
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 vault
install(TARGETS qvault
EXPORT ${PROJECT_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT vault
)
install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/include/
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Esterv
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}
COMPONENT vault
)
export(EXPORT ${PROJECT_NAME}-config
FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
)
build_exports()
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
add_subdirectory(examples)
set(cpack_file_name "${PROJECT_NAME}-v${SEMVER}-${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_VERSION}-${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_CXX_COMPILER_ID}")
if(NOT BUILD_SHARED_LIBS)
set(cpack_file_name "${cpack_file_name}-static")
endif(NOT BUILD_SHARED_LIBS)
set(CPACK_PACKAGE_FILE_NAME ${cpack_file_name})
include(CPack)
include(CPackIFW)
cpack_add_component(vault)
cpack_ifw_configure_component(vault LICENSES "License" ${CMAKE_CURRENT_SOURCE_DIR}/LICENSE)
cpack_ifw_add_repository("Repo" URL "${REPO_URL}/packages/${CMAKE_SYSTEM_NAME}/" )
build_cpack()
endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)

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


if(BUILD_DOCS)
build_docs()
endif()
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ include(FetchContent)
FetchContent_Declare(
QtVault
GIT_REPOSITORY https://github.com/EddyTheCo/QVault.git
GIT_TAG v0.1.0
FIND_PACKAGE_ARGS 0.1 CONFIG
GIT_TAG vMAJOR.MINOR.PATCH
FIND_PACKAGE_ARGS MAJOR.MINOR CONFIG
)
FetchContent_MakeAvailable(QtVault)

target_link_libraries(<target> <PRIVATE|PUBLIC|INTERFACE> QtVault::vault)
target_link_libraries(<target> <PRIVATE|PUBLIC|INTERFACE> QtVault::qvault)
```
If you want to use the QML module also add
```
$<$<STREQUAL:$<TARGET_PROPERTY:QtVault::vault,TYPE>,STATIC_LIBRARY>:QtVault::vaultplugin>
$<$<STREQUAL:$<TARGET_PROPERTY:QtVault::qvault,TYPE>,STATIC_LIBRARY>:QtVault::qvaultplugin>
```

## API reference
Expand Down