From a1483da680e6f18c9a716cd8367b9d5d27c028e6 Mon Sep 17 00:00:00 2001 From: Cyril Jacquet Date: Tue, 5 Mar 2024 14:20:44 +0100 Subject: [PATCH 1/2] rename Qleany target to qleany --- CMakeLists.txt | 157 +++++++++--------- .../src/core/contracts/CMakeLists.txt | 2 +- .../src/core/entities/CMakeLists.txt | 2 +- .../src/core/interactor/CMakeLists.txt | 4 +- .../src/core/persistence/CMakeLists.txt | 2 +- .../src/gui/presenter/CMakeLists.txt | 2 +- .../gui/qt_widgets_application/CMakeLists.txt | 25 +-- .../simple/src/core/contracts/CMakeLists.txt | 2 +- .../simple/src/core/entities/CMakeLists.txt | 2 +- .../simple/src/core/interactor/CMakeLists.txt | 2 +- .../src/core/persistence/CMakeLists.txt | 2 +- .../gui/desktop_application/CMakeLists.txt | 26 +-- .../simple/src/gui/presenter/CMakeLists.txt | 2 +- .../src/gui/qml_application/CMakeLists.txt | 54 +++--- tests/database/CMakeLists.txt | 80 ++++----- .../qleany/generator/temp/manifest_temp.yaml | 151 ++++++----------- 16 files changed, 239 insertions(+), 276 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f03d2e74..74ef5e99 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.21) - list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # get version from git include(VersionFromGit) -version_from_git( -LOG ON -) +version_from_git(LOG ON) add_compile_definitions(QLEANY_VERSION_SEMANTIC="${SEMVER}") set(QLEANY_VERSION_SEMANTIC ${SEMVER}) add_compile_definitions(QLEANY_VERSION="${VERSION}") @@ -20,9 +17,11 @@ set(QLEANY_VERSION_MINOR ${VERSION_MINOR}) add_compile_definitions(QLEANY_VERSION_PATCH=${VERSION_PATCH}) set(QLEANY_VERSION_PATCH ${VERSION_PATCH}) - - -project(Qleany VERSION ${QLEANY_VERSION} LANGUAGES CXX DESCRIPTION "Qleany is a light framework for Clean Architecture with Qt6") +project( + Qleany + VERSION ${QLEANY_VERSION} + LANGUAGES CXX + DESCRIPTION "Qleany is a light framework for Clean Architecture with Qt6") string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) # Compiler settings @@ -41,25 +40,34 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(QLEANY_BUILD_WITH_QT_GUI "Build with Qt GUI" ON) if(QLEANY_BUILD_WITH_QT_GUI) - add_compile_definitions(QLEANY_BUILD_WITH_QT_GUI=true) + add_compile_definitions(QLEANY_BUILD_WITH_QT_GUI=true) endif() if(BUILD_SHARED_LIBS) - set(LIB_TYPE SHARED) + set(LIB_TYPE SHARED) else() - set(LIB_TYPE STATIC) + set(LIB_TYPE STATIC) endif() # Add Qt components -find_package(Qt6 COMPONENTS Core Sql Concurrent REQUIRED) +find_package( + Qt6 + COMPONENTS Core Sql Concurrent + REQUIRED) qt_standard_project_setup() if(QLEANY_BUILD_WITH_QT_GUI) - find_package(Qt6 COMPONENTS Gui REQUIRED) + find_package( + Qt6 + COMPONENTS Gui + REQUIRED) endif() if(QLEANY_BUILD_EXAMPLES) - find_package(Qt6 COMPONENTS Widgets REQUIRED) + find_package( + Qt6 + COMPONENTS Widgets + REQUIRED) endif() find_package(QCoro6 REQUIRED COMPONENTS Core) @@ -69,114 +77,107 @@ qcoro_enable_coroutines() # configure the library file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") -file(GLOB_RECURSE PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/${PROJECT_NAME_LOWER}/*.h") +file(GLOB_RECURSE PUBLIC_HEADERS + "${CMAKE_CURRENT_SOURCE_DIR}/include/qleany/*.h") message(STATUS "PUBLIC_HEADERS: ${PUBLIC_HEADERS}") # Create the library target -add_library(Qleany ${LIB_TYPE} - ${SOURCES} - ${PUBLIC_HEADERS} -) +add_library(qleany ${LIB_TYPE} ${SOURCES} ${PUBLIC_HEADERS}) # Generate export header message(STATUS "Generating export header") include(GenerateExportHeader) -generate_export_header(Qleany - EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h -) - -target_include_directories(${PROJECT_NAME} PRIVATE - ${CMAKE_CURRENT_BINARY_DIR}/include -) - -target_include_directories(${PROJECT_NAME} PUBLIC - $ - $ - $ +generate_export_header( + qleany EXPORT_FILE_NAME + ${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h) + +target_include_directories(qleany PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include) + +target_include_directories( + qleany + PUBLIC $ + $ + $) + +set_target_properties(qleany PROPERTIES CXX_STANDARD 20) + +set_target_properties(qleany PROPERTIES OUTPUT_NAME qleany) +set_target_properties( + qleany + PROPERTIES + PUBLIC_HEADER + "${PUBLIC_HEADERS};${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h" ) +set_target_properties(qleany PROPERTIES POSITION_INDEPENDENT_CODE + ${BUILD_SHARED_LIBS}) -set_target_properties(Qleany PROPERTIES CXX_STANDARD 20) - -set_target_properties(Qleany PROPERTIES OUTPUT_NAME ${PROJECT_NAME_LOWER}) -set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS};${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h") -set_target_properties(${PROJECT_NAME} PROPERTIES - POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} - ) - -target_link_libraries(Qleany PUBLIC Qt6::Core Qt6::Concurrent Qt6::Sql) +target_link_libraries(qleany PUBLIC Qt6::Core Qt6::Concurrent Qt6::Sql) if(QLEANY_BUILD_WITH_QT_GUI) - target_link_libraries(Qleany PRIVATE Qt::Gui) + target_link_libraries(qleany PRIVATE Qt::Gui) endif() # state that Qleany need PIC when the default is shared libraries -set_target_properties(Qleany PROPERTIES - POSITION_INDEPENDENT_CODE ${BUILD_SHARED_LIBS} - ) - +set_target_properties(qleany PROPERTIES POSITION_INDEPENDENT_CODE + ${BUILD_SHARED_LIBS}) # configure the install location message(STATUS "Configuring install location") include(GNUInstallDirs) # Install library -install(TARGETS ${PROJECT_NAME} - EXPORT ${PROJECT_NAME}Targets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include/qleany -) +install( + TARGETS qleany + EXPORT qleanyTargets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include/qleany) # Install public headers -install(DIRECTORY include/${PROJECT_NAME_LOWER} DESTINATION include) - +install(DIRECTORY include/qleany DESTINATION include) # install license -install(FILES LICENSE DESTINATION share/${PROJECT_NAME_LOWER}) - +install(FILES LICENSE DESTINATION share/qleany) # Install the export set for use with the install-tree -install(EXPORT ${PROJECT_NAME}Targets - FILE ${PROJECT_NAME_LOWER}Targets.cmake - DESTINATION lib/cmake/${PROJECT_NAME_LOWER} -) +install( + EXPORT qleanyTargets + FILE qleanyTargets.cmake + DESTINATION lib/cmake/qleany) # Create and install qleanyConfig.cmake message(STATUS "Creating and installing qleanyConfig.cmake") include(CMakePackageConfigHelpers) write_basic_package_version_file( - ${PROJECT_NAME_LOWER}ConfigVersion.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion) + qleanyConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion) configure_package_config_file( - ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME_LOWER}Config.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}Config.cmake - INSTALL_DESTINATION lib/cmake/${PROJECT_NAME_LOWER}) + ${CMAKE_CURRENT_SOURCE_DIR}/qleanyConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfig.cmake + INSTALL_DESTINATION lib/cmake/qleany) -install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}Config.cmake - ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}ConfigVersion.cmake - DESTINATION lib/cmake/${PROJECT_NAME_LOWER}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfig.cmake + ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfigVersion.cmake + DESTINATION lib/cmake/qleany) # Export the targets to a script - # message(STATUS "Exporting targets to a script") - # export(EXPORT ${PROJECT_NAME}Targets - # FILE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME_LOWER}Targets.cmake) - +# message(STATUS "Exporting targets to a script") export(EXPORT +# ${PROJECT_NAME}Targets FILE ${CMAKE_CURRENT_BINARY_DIR}/qleanyTargets.cmake) # Subdirectories that contain CMakeLists.txt for the framework tests and example if(QLEANY_BUILD_TESTS) - add_subdirectory(tests) + add_subdirectory(tests) endif() if(QLEANY_BUILD_EXAMPLES) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - include_directories(${CMAKE_BINARY_DIR}/include) - set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH}) - set(CMAKE_LIBRARY_PATH ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_PATH}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + include_directories(${CMAKE_BINARY_DIR}/include) + set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH}) + set(CMAKE_LIBRARY_PATH ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_PATH}) - add_subdirectory(examples) + add_subdirectory(examples) endif() diff --git a/examples/front_ends/src/core/contracts/CMakeLists.txt b/examples/front_ends/src/core/contracts/CMakeLists.txt index c172b080..b68f702f 100644 --- a/examples/front_ends/src/core/contracts/CMakeLists.txt +++ b/examples/front_ends/src/core/contracts/CMakeLists.txt @@ -29,4 +29,4 @@ target_link_libraries(${LIBRARY_NAME} PRIVATE front-ends-example-entities) target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Sql ) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) \ No newline at end of file +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) \ No newline at end of file diff --git a/examples/front_ends/src/core/entities/CMakeLists.txt b/examples/front_ends/src/core/entities/CMakeLists.txt index 627f60a8..ac0b6662 100644 --- a/examples/front_ends/src/core/entities/CMakeLists.txt +++ b/examples/front_ends/src/core/entities/CMakeLists.txt @@ -24,4 +24,4 @@ target_include_directories(${LIBRARY_NAME} PUBLIC ) target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core ) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) \ No newline at end of file +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) \ No newline at end of file diff --git a/examples/front_ends/src/core/interactor/CMakeLists.txt b/examples/front_ends/src/core/interactor/CMakeLists.txt index f1bd6855..ba528387 100644 --- a/examples/front_ends/src/core/interactor/CMakeLists.txt +++ b/examples/front_ends/src/core/interactor/CMakeLists.txt @@ -49,7 +49,7 @@ target_link_libraries(${LIBRARY_NAME} PUBLIC front-ends-example-application-feat target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Gui) target_link_libraries(${LIBRARY_NAME} PRIVATE QCoro::Core) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) if(IOS) install(TARGETS ${LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) @@ -63,4 +63,4 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows") install(TARGETS ${LIBRARY_NAME} RUNTIME DESTINATION ${BINDIR} LIBRARY DESTINATION ${LIBDIR}) -endif(CMAKE_SYSTEM_NAME STREQUAL "Windows") \ No newline at end of file +endif(CMAKE_SYSTEM_NAME STREQUAL "Windows") diff --git a/examples/front_ends/src/core/persistence/CMakeLists.txt b/examples/front_ends/src/core/persistence/CMakeLists.txt index d309cc6a..8e8d0344 100644 --- a/examples/front_ends/src/core/persistence/CMakeLists.txt +++ b/examples/front_ends/src/core/persistence/CMakeLists.txt @@ -39,7 +39,7 @@ target_link_libraries(${LIBRARY_NAME} PRIVATE front-ends-example-entities) target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Sql ) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) if(IOS) install(TARGETS ${LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/examples/front_ends/src/gui/presenter/CMakeLists.txt b/examples/front_ends/src/gui/presenter/CMakeLists.txt index 6eb20b92..a3117414 100644 --- a/examples/front_ends/src/gui/presenter/CMakeLists.txt +++ b/examples/front_ends/src/gui/presenter/CMakeLists.txt @@ -31,7 +31,7 @@ target_include_directories(${LIBRARY_NAME} PUBLIC target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Gui) target_link_libraries(${LIBRARY_NAME} PRIVATE QCoro::Core) -target_link_libraries(${LIBRARY_NAME} PUBLIC Qleany) +target_link_libraries(${LIBRARY_NAME} PUBLIC qleany) target_link_libraries(${LIBRARY_NAME} PUBLIC front-ends-example-interactor) if(IOS) diff --git a/examples/front_ends/src/gui/qt_widgets_application/CMakeLists.txt b/examples/front_ends/src/gui/qt_widgets_application/CMakeLists.txt index 25664306..1119af61 100644 --- a/examples/front_ends/src/gui/qt_widgets_application/CMakeLists.txt +++ b/examples/front_ends/src/gui/qt_widgets_application/CMakeLists.txt @@ -2,27 +2,30 @@ project(FrontEndsExampleDesktopApp LANGUAGES CXX) set(APP_NAME front-ends-example-desktop-application) -find_package(Qt6 COMPONENTS Core Gui Widgets Concurrent Sql REQUIRED) +find_package( + Qt6 + COMPONENTS Core Gui Widgets Concurrent Sql + REQUIRED) find_package(QCoro6 REQUIRED COMPONENTS Core) -# find_package(qleany REQUIRED) -# Set necessary compiler flags to enable coroutine support +# find_package(qleany REQUIRED) Set necessary compiler flags to enable coroutine +# support qcoro_enable_coroutines() -if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) - qt_standard_project_setup() +if(Qt6_VERSION VERSION_GREATER_EQUAL 6.3) + qt_standard_project_setup() endif() # Create an executable target for the example project -add_executable(${APP_NAME} - main.cpp - mainwindow.h mainwindow.cpp mainwindow.ui - # add other source files +add_executable( + ${APP_NAME} main.cpp mainwindow.h mainwindow.cpp mainwindow.ui # add other + # source files ) -target_link_libraries(${APP_NAME} PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent Qt6::Sql) +target_link_libraries(${APP_NAME} PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent + Qt6::Sql) # Link the example against the Qleany library -target_link_libraries(${APP_NAME} PUBLIC Qleany) +target_link_libraries(${APP_NAME} PUBLIC qleany) target_link_libraries(${APP_NAME} PUBLIC front-ends-example-entities) target_link_libraries(${APP_NAME} PUBLIC front-ends-example-persistence) target_link_libraries(${APP_NAME} PUBLIC front-ends-example-interactor) diff --git a/examples/simple/src/core/contracts/CMakeLists.txt b/examples/simple/src/core/contracts/CMakeLists.txt index 5d5c5d1c..3de7a2b6 100755 --- a/examples/simple/src/core/contracts/CMakeLists.txt +++ b/examples/simple/src/core/contracts/CMakeLists.txt @@ -29,4 +29,4 @@ target_link_libraries(${LIBRARY_NAME} PRIVATE simple-example-entities) target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Sql ) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) \ No newline at end of file +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) \ No newline at end of file diff --git a/examples/simple/src/core/entities/CMakeLists.txt b/examples/simple/src/core/entities/CMakeLists.txt index a29179fc..c04f1884 100644 --- a/examples/simple/src/core/entities/CMakeLists.txt +++ b/examples/simple/src/core/entities/CMakeLists.txt @@ -25,4 +25,4 @@ target_include_directories(${LIBRARY_NAME} PUBLIC ) target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core ) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) diff --git a/examples/simple/src/core/interactor/CMakeLists.txt b/examples/simple/src/core/interactor/CMakeLists.txt index bed252d1..0259287a 100755 --- a/examples/simple/src/core/interactor/CMakeLists.txt +++ b/examples/simple/src/core/interactor/CMakeLists.txt @@ -48,7 +48,7 @@ target_link_libraries(${LIBRARY_NAME} PUBLIC simple-example-application-feature- target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Gui) target_link_libraries(${LIBRARY_NAME} PRIVATE QCoro::Core) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) if(IOS) install(TARGETS ${LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/examples/simple/src/core/persistence/CMakeLists.txt b/examples/simple/src/core/persistence/CMakeLists.txt index 42b4a4cd..8f29fbf0 100755 --- a/examples/simple/src/core/persistence/CMakeLists.txt +++ b/examples/simple/src/core/persistence/CMakeLists.txt @@ -39,7 +39,7 @@ target_link_libraries(${LIBRARY_NAME} PRIVATE simple-example-entities) target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Sql ) -target_link_libraries(${LIBRARY_NAME} PRIVATE Qleany) +target_link_libraries(${LIBRARY_NAME} PRIVATE qleany) if(IOS) install(TARGETS ${LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/examples/simple/src/gui/desktop_application/CMakeLists.txt b/examples/simple/src/gui/desktop_application/CMakeLists.txt index db3c55c8..16af4106 100755 --- a/examples/simple/src/gui/desktop_application/CMakeLists.txt +++ b/examples/simple/src/gui/desktop_application/CMakeLists.txt @@ -2,28 +2,30 @@ project(SimpleExampleDesktopApp LANGUAGES CXX) set(APP_NAME simple-example-desktop-application) -find_package(Qt6 COMPONENTS Core Gui Widgets Concurrent Sql REQUIRED) +find_package( + Qt6 + COMPONENTS Core Gui Widgets Concurrent Sql + REQUIRED) find_package(QCoro6 REQUIRED COMPONENTS Core) -# find_package(qleany REQUIRED) -# Set necessary compiler flags to enable coroutine support +# find_package(qleany REQUIRED) Set necessary compiler flags to enable coroutine +# support qcoro_enable_coroutines() -if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) - qt_standard_project_setup() +if(Qt6_VERSION VERSION_GREATER_EQUAL 6.3) + qt_standard_project_setup() endif() # Create an executable target for the example project -add_executable(${APP_NAME} - main.cpp - mainwindow.h mainwindow.cpp mainwindow.ui - # add other source files for the example +add_executable( + ${APP_NAME} main.cpp mainwindow.h mainwindow.cpp mainwindow.ui + # add other source files for the example ) -add_dependencies(${APP_NAME} Qleany) -target_link_libraries(${APP_NAME} PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent Qt6::Sql) +target_link_libraries(${APP_NAME} PUBLIC Qt6::Core Qt6::Widgets Qt6::Concurrent + Qt6::Sql) # Link the example against the Qleany library -target_link_libraries(${APP_NAME} PUBLIC Qleany) +target_link_libraries(${APP_NAME} PUBLIC qleany) target_link_libraries(${APP_NAME} PUBLIC simple-example-entities) target_link_libraries(${APP_NAME} PUBLIC simple-example-persistence) target_link_libraries(${APP_NAME} PUBLIC simple-example-interactor) diff --git a/examples/simple/src/gui/presenter/CMakeLists.txt b/examples/simple/src/gui/presenter/CMakeLists.txt index 7a546482..9ea3024e 100755 --- a/examples/simple/src/gui/presenter/CMakeLists.txt +++ b/examples/simple/src/gui/presenter/CMakeLists.txt @@ -38,7 +38,7 @@ target_include_directories(${LIBRARY_NAME} PUBLIC target_link_libraries(${LIBRARY_NAME} PRIVATE Qt6::Core Qt6::Gui) target_link_libraries(${LIBRARY_NAME} PRIVATE QCoro::Core) -target_link_libraries(${LIBRARY_NAME} PUBLIC Qleany) +target_link_libraries(${LIBRARY_NAME} PUBLIC qleany) target_link_libraries(${LIBRARY_NAME} PUBLIC simple-example-interactor) if(IOS) diff --git a/examples/simple/src/gui/qml_application/CMakeLists.txt b/examples/simple/src/gui/qml_application/CMakeLists.txt index 3c2a11e2..537e6404 100755 --- a/examples/simple/src/gui/qml_application/CMakeLists.txt +++ b/examples/simple/src/gui/qml_application/CMakeLists.txt @@ -8,9 +8,8 @@ project(SimpleExampleQMLApp LANGUAGES CXX) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) - -# To make the mocks appear in Qt Designer, you need to restart Qt Designer after running cmake file generation - +# To make the mocks appear in Qt Designer, you need to restart Qt Designer after +# running cmake file generation find_package(Qt6 COMPONENTS Core Gui Qml Quick Concurrent) find_package(QCoro6 REQUIRED COMPONENTS Core Qml) @@ -19,51 +18,46 @@ find_package(QCoro6 REQUIRED COMPONENTS Core Qml) # Set necessary compiler flags to enable coroutine support qcoro_enable_coroutines() -if (Qt6_VERSION VERSION_GREATER_EQUAL 6.3) - qt_standard_project_setup() +if(Qt6_VERSION VERSION_GREATER_EQUAL 6.3) + qt_standard_project_setup() endif() set(APP_NAME SimpleExampleQMLApp) -qt_add_executable(${APP_NAME} src/main.cpp) +qt_add_executable(${APP_NAME} src/main.cpp) -qt_add_resources(${APP_NAME} "configuration" - PREFIX "/" - FILES - qtquickcontrols2.conf -) - -add_dependencies(${APP_NAME} Qleany) +qt_add_resources(${APP_NAME} "configuration" PREFIX "/" FILES + qtquickcontrols2.conf) # Link the example against the Qleany library -target_link_libraries(${APP_NAME} PUBLIC Qleany) +target_link_libraries(${APP_NAME} PUBLIC qleany) target_link_libraries(${APP_NAME} PUBLIC simple-example-entities) target_link_libraries(${APP_NAME} PUBLIC simple-example-persistence) target_link_libraries(${APP_NAME} PUBLIC simple-example-interactor) target_link_libraries(${APP_NAME} PUBLIC simple-example-presenter) target_link_libraries(${APP_NAME} PRIVATE QCoro::Core QCoro::Qml) -target_link_libraries(${APP_NAME} PRIVATE - Qt${QT_VERSION_MAJOR}::Core - Qt${QT_VERSION_MAJOR}::Gui - Qt${QT_VERSION_MAJOR}::Quick - Qt${QT_VERSION_MAJOR}::Qml - Qt${QT_VERSION_MAJOR}::Concurrent -) +target_link_libraries( + ${APP_NAME} + PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui + Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::Qml + Qt${QT_VERSION_MAJOR}::Concurrent) -if (BUILD_QDS_COMPONENTS) - include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) +if(BUILD_QDS_COMPONENTS) + include(${CMAKE_CURRENT_SOURCE_DIR}/qmlcomponents) endif() -include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules) # do not rename this file, it is generated and used by Qt Designer +include(${CMAKE_CURRENT_SOURCE_DIR}/qmlmodules) # do not rename this file, it is + # generated and used by Qt + # Designer include(${CMAKE_CURRENT_SOURCE_DIR}/realqmlmodules.cmake) -if (LINK_INSIGHT) - include(${CMAKE_CURRENT_SOURCE_DIR}/insight) -endif () +if(LINK_INSIGHT) + include(${CMAKE_CURRENT_SOURCE_DIR}/insight) +endif() include(GNUInstallDirs) -install(TARGETS ${APP_NAME} +install( + TARGETS ${APP_NAME} BUNDLE DESTINATION . LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/tests/database/CMakeLists.txt b/tests/database/CMakeLists.txt index 59f39543..ddef0230 100755 --- a/tests/database/CMakeLists.txt +++ b/tests/database/CMakeLists.txt @@ -1,4 +1,4 @@ -#----------------------------------------------------------------------------------- +# ----------------------------------------------------------------------------------- set(TEST_NAME "tst_database_table") @@ -9,27 +9,29 @@ enable_testing() # Tell CMake to run moc when necessary: set(CMAKE_AUTOMOC ON) -# As moc files are generated in the binary dir, tell CMake -# to always look for includes there: +# As moc files are generated in the binary dir, tell CMake to always look for +# includes there: set(CMAKE_INCLUDE_CURRENT_DIR ON) -find_package(Qt6 COMPONENTS Test Core Sql REQUIRED) +find_package( + Qt6 + COMPONENTS Test Core Sql + REQUIRED) # set(QRC ${CMAKE_SOURCE_DIR}/resources/test/testfiles.qrc) # qt_add_resources(RESOURCES ${QRC}) -add_executable(${TEST_NAME} ${TEST_NAME}.cpp ${RESOURCES} - dummy_database_context.h - dummy_entity.h - dummy_basic_entity.h - entities.h -) +add_executable( + ${TEST_NAME} ${TEST_NAME}.cpp ${RESOURCES} dummy_database_context.h + dummy_entity.h dummy_basic_entity.h entities.h) add_test(${TEST_NAME} ${TEST_NAME}) -target_link_libraries(${TEST_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Test Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql ) +target_link_libraries( + ${TEST_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Test Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Sql) -target_link_libraries(${TEST_NAME} PUBLIC Qleany) +target_link_libraries(${TEST_NAME} PUBLIC qleany) -#----------------------------------------------------------------------------------- +# ----------------------------------------------------------------------------------- set(TEST_NAME "tst_foreign_entity") @@ -40,29 +42,32 @@ enable_testing() # Tell CMake to run moc when necessary: set(CMAKE_AUTOMOC ON) -# As moc files are generated in the binary dir, tell CMake -# to always look for includes there: +# As moc files are generated in the binary dir, tell CMake to always look for +# includes there: set(CMAKE_INCLUDE_CURRENT_DIR ON) # set(QRC ${CMAKE_SOURCE_DIR}/resources/test/testfiles.qrc) # qt_add_resources(RESOURCES ${QRC}) -add_executable(${TEST_NAME} ${TEST_NAME}.cpp ${RESOURCES} - dummy_database_context.h - dummy_entity.h - dummy_entity_with_foreign.h - dummy_other_entity.h - otm_ordered_wrapper.h - entities.h - qleany.yaml -) +add_executable( + ${TEST_NAME} + ${TEST_NAME}.cpp + ${RESOURCES} + dummy_database_context.h + dummy_entity.h + dummy_entity_with_foreign.h + dummy_other_entity.h + otm_ordered_wrapper.h + entities.h + qleany.yaml) add_test(${TEST_NAME} ${TEST_NAME}) -target_link_libraries(${TEST_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Test Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql ) +target_link_libraries( + ${TEST_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Test Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Sql) -target_link_libraries(${TEST_NAME} PUBLIC Qleany) +target_link_libraries(${TEST_NAME} PUBLIC qleany) - -#----------------------------------------------------------------------------------- +# ----------------------------------------------------------------------------------- set(TEST_NAME "tst_database_tools") @@ -73,20 +78,19 @@ enable_testing() # Tell CMake to run moc when necessary: set(CMAKE_AUTOMOC ON) -# As moc files are generated in the binary dir, tell CMake -# to always look for includes there: +# As moc files are generated in the binary dir, tell CMake to always look for +# includes there: set(CMAKE_INCLUDE_CURRENT_DIR ON) # set(QRC ${CMAKE_SOURCE_DIR}/resources/test/testfiles.qrc) # qt_add_resources(RESOURCES ${QRC}) -add_executable(${TEST_NAME} ${TEST_NAME}.cpp ${RESOURCES} - dummy_entity.h - dummy_database_context.h - dummy_basic_entity.h - entities.h -) +add_executable( + ${TEST_NAME} ${TEST_NAME}.cpp ${RESOURCES} dummy_entity.h + dummy_database_context.h dummy_basic_entity.h entities.h) add_test(${TEST_NAME} ${TEST_NAME}) -target_link_libraries(${TEST_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Test Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Sql ) +target_link_libraries( + ${TEST_NAME} PRIVATE Qt${QT_VERSION_MAJOR}::Test Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Sql) -target_link_libraries(${TEST_NAME} PUBLIC Qleany) +target_link_libraries(${TEST_NAME} PUBLIC qleany) diff --git a/tools/qleany/generator/temp/manifest_temp.yaml b/tools/qleany/generator/temp/manifest_temp.yaml index 49c2acc7..d453801a 100755 --- a/tools/qleany/generator/temp/manifest_temp.yaml +++ b/tools/qleany/generator/temp/manifest_temp.yaml @@ -1,15 +1,15 @@ CQRS: - common_cmake_folder_path: src/core/contracts.cqrs + common_cmake_folder_path: src/contracts.cqrs DTOs: - common_cmake_folder_path: src/core/contracts.dto + common_cmake_folder_path: src/contracts.dto application: - common_cmake_folder_path: src/core/application + common_cmake_folder_path: src/application features: - CRUD: create: enabled: true enabled: true - entity_mappable_with: Car + entity_mappable_with: FirstEntity get: enabled: true get_all: @@ -25,15 +25,15 @@ application: DTO: dto_identical_to_entity: enabled: true - entity_mappable_with: Car - name: Car + entity_mappable_with: FirstEntity + name: FirstEntity - CRUD: change_active_status: enabled: true create: enabled: true enabled: true - entity_mappable_with: Brand + entity_mappable_with: SecondEntity get: enabled: true get_all: @@ -47,15 +47,15 @@ application: DTO: dto_identical_to_entity: enabled: true - entity_mappable_with: Brand - name: Brand + entity_mappable_with: SecondEntity + name: SecondEntity - CRUD: change_active_status: enabled: true create: enabled: true enabled: true - entity_mappable_with: Passenger + entity_mappable_with: ThirdEntity get: enabled: true get_all: @@ -69,30 +69,8 @@ application: DTO: dto_identical_to_entity: enabled: true - entity_mappable_with: Passenger - name: Passenger - - CRUD: - create: - enabled: true - enabled: true - entity_mappable_with: Client - get: - enabled: true - get_all: - enabled: true - get_with_details: - enabled: true - insert_relation: - enabled: true - remove: - enabled: true - update: - enabled: true - DTO: - dto_identical_to_entity: - enabled: true - entity_mappable_with: Client - name: Client + entity_mappable_with: ThirdEntity + name: ThirdEntity - CRUD: enabled: false DTO: @@ -108,10 +86,9 @@ application: out: enabled: false entities: - - Car - - Passenger - - Brand - - Client + - FirstEntity + - SecondEntity + - ThirdEntity name: WriteRandomThings undo: false validator: @@ -132,10 +109,9 @@ application: out: enabled: false entities: - - Car - - Passenger - - Brand - - Client + - FirstEntity + - SecondEntity + - ThirdEntity name: CloseSystem undo: false validator: @@ -155,10 +131,10 @@ application: validator: enabled: false contracts: - folder_path: src/core/contracts - inverted_app_domain: eu.qleany + folder_path: src/contracts + inverted_app_domain: com.example entities: - folder_path: src/core/entities/ + folder_path: src/entities/ list: - fields: - name: uuid @@ -173,86 +149,69 @@ entities: - fields: - name: content type: QString - - name: brand + - name: secondEntity strong: true - type: Brand - - name: passengers + type: SecondEntity + - name: bucketOfThirdEntities ordered: true strong: true - type: QList - name: Car + type: QList + name: FirstEntity parent: Entity - fields: - name: name type: QString - name: Brand + name: SecondEntity parent: Entity - fields: - name: name type: QString - name: Passenger - parent: Entity - - fields: - - name: client - ordered: false - strong: false - type: Passenger - - name: clientFriends - type: QList - name: Client + - name: age + type: int + name: ThirdEntity parent: Entity front_ends: - kf6_kirigami: - folder_path: src/gui/kf6_kirigami_application/ - kf6_widgets: - folder_path: src/gui/kf6_widgets_application/ - qt_quick: - folder_path: src/gui/qt_quick_application/ qt_widgets: - folder_path: src/gui/qt_widgets_application/ + folder_path: src/qt_widgets_application/ global: - application_cpp_domain_name: FrontEnds - application_name: FrontEndsExample + application_cpp_domain_name: example + application_name: example organisation: - domain: qleany.eu - name: frontendsexample + domain: example.com + name: example interactor: - create_undo_redo_interactor: true - folder_path: src/core/interactor/ + create_undo_redo_interactor: false + folder_path: src/interactor/ presenter: - create_undo_and_redo_singles: true - folder_path: src/gui/presenter + create_undo_and_redo_singles: false + folder_path: src/presenters list_models: - displayed_field: name - entity: Passenger - in_relation_of: Car - name: PassengerListModelFromCarPassengers - relation_field_name: passengers + entity: ThirdEntity + in_relation_of: FirstEntity + name: ThirdEntityListModelFromFirstEntityBucketOfThirdEntities + relation_field_name: bucketOfThirdEntities - displayed_field: content - entity: Car - name: CarListModel + entity: FirstEntity + name: FirstEntityListModel singles: - - entity: Car - name: SingleCar - - entity: Brand + - entity: FirstEntity + name: SingleFirstEntity + - entity: SecondEntity name: auto - - entity: Passenger - name: auto - - entity: Client + - entity: ThirdEntity name: auto qml: - folder_path: src/gui/qml_application/ + folder_path: src/qt_design_studio_application/ repositories: - base_folder_path: src/core/persistence/ + base_folder_path: src/persistence/ list: - - entity_name: Car - lazy_loaders: true - - entity_name: Brand + - entity_name: FirstEntity lazy_loaders: true - - entity_name: Passenger + - entity_name: SecondEntity lazy_loaders: true - - entity_name: Client + - entity_name: ThirdEntity lazy_loaders: true - repository_folder_path: src/core/persistence/repository/ + repository_folder_path: src/persistence/repository/ schema: version: 1 From cc8608848ca8c2d813dafdc6c4db2d465113f7c9 Mon Sep 17 00:00:00 2001 From: Cyril Jacquet Date: Tue, 5 Mar 2024 14:30:37 +0100 Subject: [PATCH 2/2] format CMakeLists.txt --- CMakeLists.txt | 105 ++++++++++++++++++++++++------------------------- 1 file changed, 52 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74ef5e99..4f2fd46c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.21) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # get version from git - include(VersionFromGit) version_from_git(LOG ON) add_compile_definitions(QLEANY_VERSION_SEMANTIC="${SEMVER}") @@ -18,10 +17,10 @@ add_compile_definitions(QLEANY_VERSION_PATCH=${VERSION_PATCH}) set(QLEANY_VERSION_PATCH ${VERSION_PATCH}) project( - Qleany - VERSION ${QLEANY_VERSION} - LANGUAGES CXX - DESCRIPTION "Qleany is a light framework for Clean Architecture with Qt6") + Qleany + VERSION ${QLEANY_VERSION} + LANGUAGES CXX + DESCRIPTION "Qleany is a light framework for Clean Architecture with Qt6") string(TOLOWER ${PROJECT_NAME} PROJECT_NAME_LOWER) # Compiler settings @@ -40,34 +39,34 @@ option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(QLEANY_BUILD_WITH_QT_GUI "Build with Qt GUI" ON) if(QLEANY_BUILD_WITH_QT_GUI) - add_compile_definitions(QLEANY_BUILD_WITH_QT_GUI=true) + add_compile_definitions(QLEANY_BUILD_WITH_QT_GUI=true) endif() if(BUILD_SHARED_LIBS) - set(LIB_TYPE SHARED) + set(LIB_TYPE SHARED) else() - set(LIB_TYPE STATIC) + set(LIB_TYPE STATIC) endif() # Add Qt components find_package( - Qt6 - COMPONENTS Core Sql Concurrent - REQUIRED) + Qt6 + COMPONENTS Core Sql Concurrent + REQUIRED) qt_standard_project_setup() if(QLEANY_BUILD_WITH_QT_GUI) - find_package( - Qt6 - COMPONENTS Gui - REQUIRED) + find_package( + Qt6 + COMPONENTS Gui + REQUIRED) endif() if(QLEANY_BUILD_EXAMPLES) - find_package( - Qt6 - COMPONENTS Widgets - REQUIRED) + find_package( + Qt6 + COMPONENTS Widgets + REQUIRED) endif() find_package(QCoro6 REQUIRED COMPONENTS Core) @@ -78,7 +77,7 @@ qcoro_enable_coroutines() # configure the library file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") file(GLOB_RECURSE PUBLIC_HEADERS - "${CMAKE_CURRENT_SOURCE_DIR}/include/qleany/*.h") + "${CMAKE_CURRENT_SOURCE_DIR}/include/qleany/*.h") message(STATUS "PUBLIC_HEADERS: ${PUBLIC_HEADERS}") @@ -90,38 +89,38 @@ message(STATUS "Generating export header") include(GenerateExportHeader) generate_export_header( - qleany EXPORT_FILE_NAME - ${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h) + qleany EXPORT_FILE_NAME + ${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h) target_include_directories(qleany PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/include) target_include_directories( - qleany - PUBLIC $ - $ - $) + qleany + PUBLIC $ + $ + $) set_target_properties(qleany PROPERTIES CXX_STANDARD 20) set_target_properties(qleany PROPERTIES OUTPUT_NAME qleany) set_target_properties( - qleany - PROPERTIES + qleany + PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS};${CMAKE_CURRENT_BINARY_DIR}/include/qleany/qleany_export.h" ) set_target_properties(qleany PROPERTIES POSITION_INDEPENDENT_CODE - ${BUILD_SHARED_LIBS}) + ${BUILD_SHARED_LIBS}) target_link_libraries(qleany PUBLIC Qt6::Core Qt6::Concurrent Qt6::Sql) if(QLEANY_BUILD_WITH_QT_GUI) - target_link_libraries(qleany PRIVATE Qt::Gui) + target_link_libraries(qleany PRIVATE Qt::Gui) endif() # state that Qleany need PIC when the default is shared libraries set_target_properties(qleany PROPERTIES POSITION_INDEPENDENT_CODE - ${BUILD_SHARED_LIBS}) + ${BUILD_SHARED_LIBS}) # configure the install location message(STATUS "Configuring install location") @@ -129,11 +128,11 @@ include(GNUInstallDirs) # Install library install( - TARGETS qleany - EXPORT qleanyTargets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include/qleany) + TARGETS qleany + EXPORT qleanyTargets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + PUBLIC_HEADER DESTINATION include/qleany) # Install public headers install(DIRECTORY include/qleany DESTINATION include) @@ -143,26 +142,26 @@ install(FILES LICENSE DESTINATION share/qleany) # Install the export set for use with the install-tree install( - EXPORT qleanyTargets - FILE qleanyTargets.cmake - DESTINATION lib/cmake/qleany) + EXPORT qleanyTargets + FILE qleanyTargets.cmake + DESTINATION lib/cmake/qleany) # Create and install qleanyConfig.cmake message(STATUS "Creating and installing qleanyConfig.cmake") include(CMakePackageConfigHelpers) write_basic_package_version_file( - qleanyConfigVersion.cmake - VERSION ${PROJECT_VERSION} - COMPATIBILITY SameMajorVersion) + qleanyConfigVersion.cmake + VERSION ${PROJECT_VERSION} + COMPATIBILITY SameMajorVersion) configure_package_config_file( - ${CMAKE_CURRENT_SOURCE_DIR}/qleanyConfig.cmake.in - ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfig.cmake - INSTALL_DESTINATION lib/cmake/qleany) + ${CMAKE_CURRENT_SOURCE_DIR}/qleanyConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfig.cmake + INSTALL_DESTINATION lib/cmake/qleany) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfig.cmake - ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfigVersion.cmake - DESTINATION lib/cmake/qleany) + ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfigVersion.cmake + DESTINATION lib/cmake/qleany) # Export the targets to a script # message(STATUS "Exporting targets to a script") export(EXPORT @@ -170,14 +169,14 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qleanyConfig.cmake # Subdirectories that contain CMakeLists.txt for the framework tests and example if(QLEANY_BUILD_TESTS) - add_subdirectory(tests) + add_subdirectory(tests) endif() if(QLEANY_BUILD_EXAMPLES) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) - include_directories(${CMAKE_BINARY_DIR}/include) - set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH}) - set(CMAKE_LIBRARY_PATH ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_PATH}) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) + include_directories(${CMAKE_BINARY_DIR}/include) + set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} ${CMAKE_PREFIX_PATH}) + set(CMAKE_LIBRARY_PATH ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_PATH}) - add_subdirectory(examples) + add_subdirectory(examples) endif()