diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 17d57471..962f9928 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -13,96 +13,24 @@ env: BUILD_TYPE: Release jobs: - - cjson: - runs-on: windows-2022 - steps: - - uses: actions/checkout@v4 - with: - repository: DaveGamble/cJSON - ref: v1.7.17 - - - name: Configure CMake cJSON - run: cmake -B ${{github.workspace}}/build64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_CJSON_TEST=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_SHARED_AND_STATIC_LIBS=OFF -DCJSON_BUILD_SHARED_LIBS=OFF -DCJSON_OVERRIDE_BUILD_SHARED_LIBS=OFF -DCMAKE_GENERATOR_PLATFORM=x64 - - - name: Build cJSON - run: cmake --build ${{github.workspace}}/build64 --config ${{env.BUILD_TYPE}} - - - name: Install cJSON - run: cmake --install ${{github.workspace}}/build64 --config ${{env.BUILD_TYPE}} - - - name: Upload cJSON - uses: actions/upload-artifact@v4 - with: - name: cjson-bin - path: C:\Program Files\cJSON - - sqlite3: - runs-on: windows-2022 - steps: - - uses: suisei-cn/actions-download-file@v1.6.0 - id: sqlitesrc - name: Download sqlite source - with: - url: https://sqlite.org/2024/sqlite-amalgamation-3450100.zip - target: download/ - - - uses: suisei-cn/actions-download-file@v1.6.0 - id: sqlitebin - name: Download sqlite dll - with: - url: https://www.sqlite.org/2024/sqlite-dll-win-x64-3450100.zip - target: download/ - - - name: extract src - run: 7z e -o"C:\Program Files\sqlite" download\sqlite-amalgamation-3450100.zip - - - name: extract binary - run: 7z e -o"C:\Program Files\sqlite" download\sqlite-dll-win-x64-3450100.zip - - - name: Set up Visual Studio shell - uses: egor-tensin/vs-shell@v2 - with: - arch: x64 - - - name: create .lib - run: lib.exe /def:"C:\Program Files\sqlite\sqlite3.def" /machine:x64 /out:"C:\Program Files\sqlite\sqlite3.lib" - - - name: Upload sqlite - uses: actions/upload-artifact@v4 - with: - name: sqlite-bin - path: C:\Program Files\sqlite - mosquitto: runs-on: windows-2022 - needs: - - cjson - - sqlite3 - env: - CJSON_DIR: C:\Program Files\cJSON steps: - uses: actions/checkout@v4 - - name: install openssl - run: choco install openssl - - name: Download cJSON - uses: actions/download-artifact@v4 + - name: vcpkg build + uses: johnwason/vcpkg-action@v6 + id: vcpkg with: - name: cjson-bin - path: C:\Program Files\cJSON - - - name: Download sqlite - uses: actions/download-artifact@v4 - with: - name: sqlite-bin - path: C:\Program Files\sqlite + manifest-dir: ${{ github.workspace }} + triplet: x64-windows-release + token: ${{ github.token }} + github-binarycache: true - name: Configure CMake - run: cmake -B ${{github.workspace}}/build64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_TESTS=OFF -DCMAKE_GENERATOR_PLATFORM=x64 -DCJSON_INCLUDE_DIR="C:/Program Files/cJSON/include" -DCJSON_LIBRARY="C:/Program Files/cJSON/lib/cjson.lib" -DSQLite3_INCLUDE_DIR="C:/Program Files/sqlite" -DSQLite3_LIBRARY="C:/Program Files/sqlite/sqlite3.lib" - + run: cmake -B ${{github.workspace}}/build64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DWITH_TESTS=OFF -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-release -DVCPKG_MANIFEST_MODE=ON - name: Build run: cmake --build ${{github.workspace}}/build64 --config ${{env.BUILD_TYPE}} diff --git a/libcommon/CMakeLists.txt b/libcommon/CMakeLists.txt index a45b06c4..09705009 100644 --- a/libcommon/CMakeLists.txt +++ b/libcommon/CMakeLists.txt @@ -21,6 +21,19 @@ target_include_directories(libmosquitto_common "${mosquitto_SOURCE_DIR}/include" ) +target_link_libraries(libmosquitto_common + PUBLIC + config-header +) + +if (WITH_TLS) + target_link_libraries(libmosquitto_common + PUBLIC + OpenSSL::SSL + ) +endif() + + set_target_properties(libmosquitto_common PROPERTIES OUTPUT_NAME mosquitto_common VERSION ${VERSION} diff --git a/plugins/examples/auth-by-env/CMakeLists.txt b/plugins/examples/auth-by-env/CMakeLists.txt index 450db746..dfae1709 100644 --- a/plugins/examples/auth-by-env/CMakeLists.txt +++ b/plugins/examples/auth-by-env/CMakeLists.txt @@ -1,3 +1,3 @@ set (PLUGIN_NAME mosquitto_auth_by_env) -add_mosquitto_plugin_no_install("${PLUGIN_NAME}" "${PLUGIN_NAME}.c" "" "") +add_mosquitto_plugin_no_install("${PLUGIN_NAME}" "${PLUGIN_NAME}.c" "" "libmosquitto_common") diff --git a/plugins/examples/auth-by-ip/CMakeLists.txt b/plugins/examples/auth-by-ip/CMakeLists.txt index b44b59c3..d41e72f1 100644 --- a/plugins/examples/auth-by-ip/CMakeLists.txt +++ b/plugins/examples/auth-by-ip/CMakeLists.txt @@ -1,3 +1,3 @@ set (PLUGIN_NAME mosquitto_auth_by_ip) -add_mosquitto_plugin_no_install("${PLUGIN_NAME}" "${PLUGIN_NAME}.c" "" "") +add_mosquitto_plugin_no_install("${PLUGIN_NAME}" "${PLUGIN_NAME}.c" "" "libmosquitto_common") diff --git a/plugins/examples/delayed-auth/CMakeLists.txt b/plugins/examples/delayed-auth/CMakeLists.txt index d6db3558..7f50f795 100644 --- a/plugins/examples/delayed-auth/CMakeLists.txt +++ b/plugins/examples/delayed-auth/CMakeLists.txt @@ -1,3 +1,3 @@ set (PLUGIN_NAME mosquitto_delayed_auth) -add_mosquitto_plugin_no_install("${PLUGIN_NAME}" "${PLUGIN_NAME}.c" "" "") +add_mosquitto_plugin_no_install("${PLUGIN_NAME}" "${PLUGIN_NAME}.c" "" "libmosquitto_common") diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 00000000..f6be6ab6 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,11 @@ +{ + "name": "mosquitto", + "version-string": "2.1.0", + "dependencies": [ + "argon2", + "cjson", + "openssl", + "pthreads", + "sqlite3" + ] +}