From 336044a840e91b832e1aa4accd00e1affb988cc8 Mon Sep 17 00:00:00 2001 From: Edgar Date: Sat, 13 Feb 2021 13:07:08 +0100 Subject: [PATCH] :construction_worker: Fixed test CI build --- .github/workflows/test.yml | 17 +++++++++++++---- BUILDING_ON_WINDOWS.md | 2 -- BUILDING_WITH_CMAKE.md | 23 +++++++++++++++++++++++ CMakeLists.txt | 18 ++++++++++-------- conan-pkgs/add_conan_pkgs.cmake | 9 +++++++++ conanfile.txt | 12 ++++++------ 6 files changed, 61 insertions(+), 20 deletions(-) create mode 100644 BUILDING_WITH_CMAKE.md create mode 100644 conan-pkgs/add_conan_pkgs.cmake diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d43c4362f..a8b8a9be7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,6 +27,12 @@ jobs: path: ../Qt key: ${{ runner.os }}-QtCache-20201005 + - name: Cache conan + uses: actions/cache@v2.1.4 + with: + key: ${{ runner.os }}-conan-root-${{ hashFiles('**/conanfile.txt') }} + path: ~/.conan + # LINUX - name: Install p7zip (Ubuntu) if: startsWith(matrix.os, 'ubuntu') @@ -43,6 +49,7 @@ jobs: - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | + curl "https://raw.githubusercontent.com/AnotherFoxGuy/ci-scripts/main/install-conan.sh" | sudo bash sudo apt-get update sudo apt-get -y install \ cmake \ @@ -65,15 +72,17 @@ jobs: - name: Create build directory (Ubuntu) if: startsWith(matrix.os, 'ubuntu') - run: | - mkdir build-test + run: mkdir build-test shell: bash + - name: Add conan pkgs + run: cmake -P conan-pkgs/add_conan_pkgs.cmake + - name: Build (Ubuntu) if: startsWith(matrix.os, 'ubuntu') run: | - cmake -DBUILD_TESTS=On -DCMAKE_BUILD_TYPE=Release .. - cmake --build . --config Release + cmake -DUSE_PACKAGE_MANAGER=ON -DBUILD_TESTS=ON -DBUILD_APP=OFF .. + make -j working-directory: build-test shell: bash diff --git a/BUILDING_ON_WINDOWS.md b/BUILDING_ON_WINDOWS.md index e1bdd37d2..06e836407 100644 --- a/BUILDING_ON_WINDOWS.md +++ b/BUILDING_ON_WINDOWS.md @@ -1,5 +1,3 @@ - -CMAKE_PREFIX_PATH # Building on Windows **Note that installing all the development prerequisites and libraries will require about 30 GB of free disk space. Please ensure this space is available on your `C:` drive before proceeding.** diff --git a/BUILDING_WITH_CMAKE.md b/BUILDING_WITH_CMAKE.md new file mode 100644 index 000000000..682f04a80 --- /dev/null +++ b/BUILDING_WITH_CMAKE.md @@ -0,0 +1,23 @@ +TODO +--------- + +## Build with conan +* Install cmake conan qt +* `cmake -P conan-pkgs/add_conan_pkgs.cmake` +* `mkdir build` + `cd build` + `cmake -DCMAKE_BUILD_TYPE=Release -DUSE_PACKAGE_MANAGER=ON ..` + `make -j` + +## Build with cmake meta-build project +* Install cmake qt +* `cd lib` + `cmake -DCMAKE_BUILD_TYPE=Release ..` + `make -j` + +* `mkdir build` + `cd build` + `cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MODULE_PATH=lib/Dependencies_ ..` + `make -j` + +## Build manually \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 189e90f12..e67dd71a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,6 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - SET(RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/") SET(LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/") SET(ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/") @@ -45,19 +42,24 @@ else (USE_PACKAGE_MANAGER) find_package(Boost REQUIRED) find_package(OpenSSL REQUIRED) - find_package(LibCommuni REQUIRED) - find_package(Qt5keychain REQUIRED) - find_package(Rapidjson REQUIRED) + find_package(Serialize REQUIRED) find_package(Signals REQUIRED) find_package(Settings REQUIRED) - find_package(Serialize REQUIRED) - find_package(Websocketpp REQUIRED) + if (BUILD_APP) + find_package(LibCommuni REQUIRED) + find_package(Qt5keychain REQUIRED) + find_package(Rapidjson REQUIRED) + find_package(Websocketpp REQUIRED) + endif () if (BUILD_TESTS) find_package(GTest REQUIRED) endif () endif (USE_PACKAGE_MANAGER) +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + if (BUILD_APP) add_subdirectory(src) diff --git a/conan-pkgs/add_conan_pkgs.cmake b/conan-pkgs/add_conan_pkgs.cmake new file mode 100644 index 000000000..06f1fdd86 --- /dev/null +++ b/conan-pkgs/add_conan_pkgs.cmake @@ -0,0 +1,9 @@ +macro(add_pkg NAME) + execute_process(COMMAND conan export ${CMAKE_CURRENT_LIST_DIR}/${NAME} chatterino/local) +endmacro() + +add_pkg("QtKeychain") +add_pkg("Serialize") +add_pkg("Settings") +add_pkg("Signals") +add_pkg("WebSocketpp") \ No newline at end of file diff --git a/conanfile.txt b/conanfile.txt index f167380ac..8b7d83b47 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,14 +1,14 @@ [requires] boost/1.75.0 -communi/3.6.0@test/test +communi/3.6.0@chatterino/local gtest/1.10.0 openssl/1.1.1d -QtKeychain/0.12.90@test/test +QtKeychain/0.12.90@chatterino/local rapidjson/cci.20200410 -serialize/0.1@test/test -settings/0.1@test/test -signals/0.1@test/test -WebSocketpp/0.8.1@test/test +serialize/0.1@chatterino/local +settings/0.1@chatterino/local +signals/0.1@chatterino/local +WebSocketpp/0.8.1@chatterino/local [generators] cmake