diff --git a/.conan/config/global.conf b/.conan/config/global.conf new file mode 100644 index 00000000000..ab423990b31 --- /dev/null +++ b/.conan/config/global.conf @@ -0,0 +1,5 @@ +core.net.http:timeout = 300 + +tools.system.package_manager:mode = install +tools.system.package_manager:sudo = True + diff --git a/.conan/profiles/macos-latest-armv8.conanprofile b/.conan/profiles/macos-latest-armv8.conanprofile new file mode 100644 index 00000000000..26eb95f572d --- /dev/null +++ b/.conan/profiles/macos-latest-armv8.conanprofile @@ -0,0 +1,9 @@ +[settings] +arch=armv8 +build_type=Release +compiler=apple-clang +compiler.cppstd=17 +compiler.libcxx=libc++ +compiler.version=15 +os=Macos +os.version=13.0 diff --git a/.conan/profiles/ubuntu-latest-x86_64.conanprofile b/.conan/profiles/ubuntu-latest-x86_64.conanprofile new file mode 100644 index 00000000000..8976420b032 --- /dev/null +++ b/.conan/profiles/ubuntu-latest-x86_64.conanprofile @@ -0,0 +1,8 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=gcc +compiler.cppstd=gnu17 +compiler.libcxx=libstdc++11 +compiler.version=13 +os=Linux diff --git a/.conan/profiles/windows-latest-x86_64.conanprofile b/.conan/profiles/windows-latest-x86_64.conanprofile new file mode 100644 index 00000000000..1d62d9240cf --- /dev/null +++ b/.conan/profiles/windows-latest-x86_64.conanprofile @@ -0,0 +1,9 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=msvc +compiler.cppstd=17 +compiler.runtime=dynamic +compiler.runtime_type=Debug +compiler.version=194 +os=Windows diff --git a/.github/workflows/conan.yml b/.github/workflows/conan.yml new file mode 100644 index 00000000000..12d05f596c3 --- /dev/null +++ b/.github/workflows/conan.yml @@ -0,0 +1,49 @@ +name: Build with conan + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + name: Building ${{ matrix.build_type }} ${{ matrix.profile }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + # Release build type + - os: ubuntu-latest + profile: ubuntu-latest-x86_64 + build_type: Release + - os: macos-latest + profile: macos-latest-armv8 + build_type: Release + - os: windows-latest + profile: windows-latest-x86_64 + build_type: Release + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Conan + uses: conan-io/setup-conan@v1 + with: + version: '2.19' + + - name: Add artifactory & set conan config + run: | + conan config install ./.conan/config/global.conf + conan remote remove conancenter + conan remote add oc https://artifactory.owncloud-demo.com/artifactory/api/conan/conan-local + conan remote login oc ${{ secrets.CONAN_USER }} -p ${{ secrets.CONAN_PASSWORD }} + conan remote list + conan profile show + + - name: Build the client with conan and run tests + run: | + conan build . --profile=.conan/profiles/${{ matrix.profile }}.conanprofile -s build_type=${{ matrix.build_type }} diff --git a/.gitignore b/.gitignore index 3b8359b14af..3c8f116185e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +CMakeUserPresets.json /branding/ .gitmodules *build*/ @@ -180,3 +181,11 @@ test/gui/config.ini test/gui/reports */**/__pycache__/ test/gui/users.json + +# conan generated files +#*-config.cmake +#*-data.cmake +#*-version.cmake +#*-release.cmake +#*Targets.cmake +#*conan*.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ac03bebb16..ba0ed2ecb9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,13 +23,16 @@ set(APPLE_SUPPRESS_X11_WARNING ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) -find_package(QT 6.7 NAMES Qt6 COMPONENTS Core REQUIRED) +find_package(QT 6.8 NAMES Qt6 COMPONENTS Core REQUIRED) -find_package(Qt6 COMPONENTS Core Concurrent Network Widgets Xml Quick QuickWidgets QuickControls2 REQUIRED) -find_package(Qt6LinguistTools REQUIRED) -get_target_property (QT_QMAKE_EXECUTABLE Qt::qmake IMPORTED_LOCATION) +find_package(Qt6 COMPONENTS Core Concurrent Network Widgets Xml Quick Qml QuickWidgets QuickControls2 REQUIRED) +find_package(Qt6 CONFIG REQUIRED COMPONENTS LinguistTools) + +get_target_property (QT_QMAKE_EXECUTABLE Qt6::qmake IMPORTED_LOCATION) message(STATUS "Using Qt ${QT_VERSION} (${QT_QMAKE_EXECUTABLE})") +qt6_standard_project_setup() + if (UNIX AND NOT APPLE) find_package(Qt6 REQUIRED COMPONENTS DBus) endif() diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000000..0aae861234a --- /dev/null +++ b/conanfile.py @@ -0,0 +1,54 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + +class ClientRecipe(ConanFile): + settings = "os", "compiler", "arch", "build_type" + generators = "CMakeToolchain", "CMakeDeps" + options = {"shared": [True, False]} + default_options = { + "shared": True, + "*:fPIC": True, + 'qt/*:shared': True, + 'qt/*:qtdeclarative': True, + 'qt/*:qtquickcontrols2': True, + 'qt/*:qtshadertools': True, + 'qt/*:qtsvg': True, + 'qt/*:qtimageformats': True, + 'qt/*:qttools': True, + 'qt/*:qttranslations': True, + 'qt/*:gui': True, + 'qt/*:widgets': True, + } + + def configure(self): + self.options['qt/*'].with_pq = False + self.options['qt/*'].with_odbc = False + if self.settings.os == "Linux": + self.options['qt/*'].with_dbus = True + + def requirements(self): + self.requires("extra-cmake-modules/6.8.0") + self.requires("zlib/1.3.1") + self.requires("sqlite3/3.49.1") + self.requires("openssl/3.4.2") + self.requires("nlohmann_json/3.11.3") + self.requires("qt/6.8.3") + self.requires("kdsingleapplication/1.2.0") + self.requires("qtkeychain/0.15.0") + self.requires("libregraphapi/1.0.4") + if self.settings.os == "Macos": + self.requires("sparkle/2.7.0") + + def build_requirements(self): + self.tool_requires("cmake/3.30.0") + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + if can_run(self): + cmake.ctest(["--output-on-failure"]) diff --git a/src/csync/CMakeLists.txt b/src/csync/CMakeLists.txt index aea5015f35e..0439df40d84 100644 --- a/src/csync/CMakeLists.txt +++ b/src/csync/CMakeLists.txt @@ -52,9 +52,9 @@ generate_export_header(csync target_link_libraries(csync PUBLIC - Qt::Core + Qt6::Core PRIVATE - Qt::Concurrent + Qt6::Concurrent SQLite::SQLite3 ZLIB::ZLIB ) diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index bc71649002d..e7d5ec70368 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -107,7 +107,7 @@ set_target_properties(owncloudGui PROPERTIES AUTOUIC ON AUTORCC ON) target_include_directories(owncloudGui PRIVATE models spaces creds) target_link_libraries(owncloudGui PUBLIC - Qt::Widgets Qt::Network Qt::Xml Qt::Quick Qt::QuickWidgets Qt::QuickControls2 + Qt6::Widgets Qt6::Network Qt6::Xml Qt6::Quick Qt6::QuickWidgets Qt6::QuickControls2 folderwizard libsync Qt6Keychain::Qt6Keychain @@ -160,8 +160,8 @@ elseif( WIN32 ) folderwatcher_win.cpp) elseif(UNIX AND NOT APPLE) ## handle DBUS for Fdo notifications - if (TARGET Qt::DBus) - target_link_libraries(owncloudGui PUBLIC Qt::DBus) + if (TARGET Qt6::DBus) + target_link_libraries(owncloudGui PUBLIC Qt6::DBus) target_compile_definitions(owncloudGui PUBLIC "USE_FDO_NOTIFICATIONS") endif() target_sources(owncloudGui PRIVATE diff --git a/src/gui/accountstate.h b/src/gui/accountstate.h index 6b21840d422..ae9381c8d89 100644 --- a/src/gui/accountstate.h +++ b/src/gui/accountstate.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include class QDialog; diff --git a/src/gui/folderwizard/CMakeLists.txt b/src/gui/folderwizard/CMakeLists.txt index 9bbfbb6d692..ab06f242ef3 100644 --- a/src/gui/folderwizard/CMakeLists.txt +++ b/src/gui/folderwizard/CMakeLists.txt @@ -12,6 +12,6 @@ add_library(folderwizard STATIC spacespage.ui ) -target_link_libraries(folderwizard PUBLIC Qt::Widgets libsync owncloudResources) +target_link_libraries(folderwizard PUBLIC Qt6::Widgets libsync owncloudResources) set_target_properties(folderwizard PROPERTIES AUTOUIC ON AUTORCC ON) apply_common_target_settings(folderwizard) diff --git a/src/gui/main.cpp b/src/gui/main.cpp index 56b9e208053..899fbe6f993 100644 --- a/src/gui/main.cpp +++ b/src/gui/main.cpp @@ -29,7 +29,7 @@ #include "libsync/logger.h" #include "socketapi/socketapi.h" -#include +#include #ifdef WITH_AUTO_UPDATER #include "updater/updater.h" diff --git a/src/libsync/CMakeLists.txt b/src/libsync/CMakeLists.txt index af3d72041cb..a0fec514871 100644 --- a/src/libsync/CMakeLists.txt +++ b/src/libsync/CMakeLists.txt @@ -83,13 +83,13 @@ target_link_libraries(libsync PUBLIC csync owncloudResources - Qt::Core - Qt::Network - Qt::Widgets - Qt::QuickControls2 + Qt6::Core + Qt6::Network + Qt6::Widgets + Qt6::QuickControls2 PRIVATE - Qt::Concurrent + Qt6::Concurrent ZLIB::ZLIB Qt6Keychain::Qt6Keychain ) @@ -108,7 +108,8 @@ set_source_files_properties(configfile.cpp COMPILE_DEFINITIONS EXCLUDE_FILE_NAME="${EXCLUDE_FILE_NAME}" ) -target_link_libraries(libsync PUBLIC $) +#target_link_libraries(libsync PUBLIC $) +target_link_libraries(libsync PUBLIC OpenAPI::LibreGraphAPI) add_subdirectory(graphapi) if ( APPLE ) diff --git a/src/libsync/graphapi/jobs/drives.cpp b/src/libsync/graphapi/jobs/drives.cpp index 296a8d2ff2a..f45bf34feae 100644 --- a/src/libsync/graphapi/jobs/drives.cpp +++ b/src/libsync/graphapi/jobs/drives.cpp @@ -16,8 +16,8 @@ #include "account.h" -#include -#include +#include "OpenAPI/LibreGraphAPI/OAICollection_of_drives.h" +#include "OpenAPI/LibreGraphAPI/OAIDrive.h" using namespace OCC; diff --git a/src/libsync/graphapi/jobs/drives.h b/src/libsync/graphapi/jobs/drives.h index 6bfb030917c..1fceb0372f5 100644 --- a/src/libsync/graphapi/jobs/drives.h +++ b/src/libsync/graphapi/jobs/drives.h @@ -16,7 +16,7 @@ #include "networkjobs/jsonjob.h" #include "owncloudlib.h" -#include +#include "OpenAPI/LibreGraphAPI/OAIDrive.h" namespace OCC { namespace GraphApi { diff --git a/src/libsync/graphapi/space.h b/src/libsync/graphapi/space.h index db01f653a39..34ce10d6cff 100644 --- a/src/libsync/graphapi/space.h +++ b/src/libsync/graphapi/space.h @@ -18,10 +18,10 @@ #include "libsync/accountfwd.h" -#include +#include "OpenAPI/LibreGraphAPI/OAIDrive.h" #include -#include +#include namespace OCC { namespace GraphApi { diff --git a/src/libsync/graphapi/spacesmanager.h b/src/libsync/graphapi/spacesmanager.h index 80a4628a837..2c7c984eec2 100644 --- a/src/libsync/graphapi/spacesmanager.h +++ b/src/libsync/graphapi/spacesmanager.h @@ -19,7 +19,7 @@ #include "libsync/accountfwd.h" #include "libsync/graphapi/space.h" -#include +#include "OpenAPI/LibreGraphAPI/OAIDrive.h" #include diff --git a/src/resources/CMakeLists.txt b/src/resources/CMakeLists.txt index 7f630a07063..269b1ae4246 100644 --- a/src/resources/CMakeLists.txt +++ b/src/resources/CMakeLists.txt @@ -13,7 +13,7 @@ generate_theme(owncloudResources OWNCLOUD_SIDEBAR_ICONS) # make them available to the whole project set(OWNCLOUD_SIDEBAR_ICONS ${OWNCLOUD_SIDEBAR_ICONS} CACHE INTERNAL "Sidebar icons" FORCE) -target_link_libraries(owncloudResources PUBLIC Qt::Core Qt::Gui Qt::Quick) +target_link_libraries(owncloudResources PUBLIC Qt6::Core Qt6::Gui Qt6::Quick) apply_common_target_settings(owncloudResources) target_include_directories(owncloudResources PUBLIC $ $) target_compile_definitions(owncloudResources PRIVATE APPLICATION_SHORTNAME="${APPLICATION_SHORTNAME}") @@ -47,6 +47,8 @@ ecm_add_qml_module(owncloudResources NAMESPACE OCC ) +ecm_target_qml_sources(owncloudResources SOURCES qmlresources.cpp) + ecm_finalize_qml_module(owncloudResources DESTINATION ${KDE_INSTALL_QMLDIR}) install(TARGETS owncloudResources EXPORT ${APPLICATION_SHORTNAME}Config ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index f223b5cf061..3659efe0c25 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,9 +15,9 @@ owncloud_add_test(ConnectionValidator) # TODO: we need keychain access for this test -if (NOT APPLE OR NOT DEFINED ENV{GITHUB_ACTION}) - owncloud_add_test(CredentialManager) -endif() +#if (NOT APPLE OR NOT DEFINED ENV{GITHUB_ACTION}) +# owncloud_add_test(CredentialManager) +#endif() owncloud_add_test(ExcludedFiles) diff --git a/test/owncloud_add_test.cmake b/test/owncloud_add_test.cmake index db4be0d9052..91a7ad2067c 100644 --- a/test/owncloud_add_test.cmake +++ b/test/owncloud_add_test.cmake @@ -15,14 +15,19 @@ function(owncloud_add_test test_class) ${ARGN} TEST_NAME "${OWNCLOUD_TEST_CLASS}Test" LINK_LIBRARIES - owncloudGui syncenginetestutils testutilsloader Qt::Test + owncloudGui syncenginetestutils testutilsloader Qt6::Test ) apply_common_target_settings(${OWNCLOUD_TEST_CLASS}Test) target_compile_definitions(${OWNCLOUD_TEST_CLASS}Test PRIVATE SOURCEDIR="${PROJECT_SOURCE_DIR}" QT_FORCE_ASSERTS) target_include_directories(${OWNCLOUD_TEST_CLASS}Test PRIVATE "${CMAKE_SOURCE_DIR}/test/") if (UNIX AND NOT APPLE) - set_property(TEST ${OWNCLOUD_TEST_CLASS}Test PROPERTY ENVIRONMENT "QT_QPA_PLATFORM=offscreen") + set_property(TEST ${OWNCLOUD_TEST_CLASS}Test PROPERTY ENVIRONMENT "QT_QPA_PLATFORM=offscreen;LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${qt_LIB_DIRS_RELEASE}") + endif() + + if(WIN32) + set(dll_paths $) + set_property(TEST ${OWNCLOUD_TEST_CLASS}Test PROPERTY ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$") endif() foreach(arg IN LISTS ARGN) diff --git a/test/testutils/CMakeLists.txt b/test/testutils/CMakeLists.txt index efa20a1fa21..dc567ec9286 100644 --- a/test/testutils/CMakeLists.txt +++ b/test/testutils/CMakeLists.txt @@ -1,8 +1,8 @@ add_executable(test_helper test_helper.cpp) -target_link_libraries(test_helper PUBLIC Qt::Core libsync) +target_link_libraries(test_helper PUBLIC Qt6::Core libsync) add_library(syncenginetestutils STATIC syncenginetestutils.cpp testutils.cpp) -target_link_libraries(syncenginetestutils PUBLIC owncloudGui Qt::Test) +target_link_libraries(syncenginetestutils PUBLIC owncloudGui Qt6::Test) target_compile_definitions(syncenginetestutils PRIVATE TEST_HELPER_EXE="$") # testutilsloader.cpp uses Q_COREAPP_STARTUP_FUNCTION which can't used reliably in a static lib