Skip to content

Commit

Permalink
Feature/win32 (#191)
Browse files Browse the repository at this point in the history
win32 CI and docs
  • Loading branch information
cen1 authored Mar 10, 2024
1 parent 3f306dc commit 5afec8f
Show file tree
Hide file tree
Showing 4 changed files with 132 additions and 12 deletions.
89 changes: 82 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,19 +137,20 @@ jobs:
- name: Run tests
run: build/qztest/qztest

windows:
windows-x64:
if: true
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
package_manager: [ conan, vcpkg ]
qt_version: [ 6.6.2 ]
preset: [ conan, vcpkg ]
qt_version: [ 5.12.12, 6.6.2 ]

steps:
- uses: actions/checkout@v4

- name: Install Qt6
if: "startsWith(matrix.qt_version, '6.')"
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
Expand All @@ -158,38 +159,112 @@ jobs:
dir: ${{ github.workspace }}/Qt
modules: 'qt5compat'

- name: Install Qt5
if: "startsWith(matrix.qt_version, '5.')"
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
cache: 'true'
cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ matrix.qt_version }}
dir: ${{ github.workspace }}/Qt

- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x64

- name: Install Conan
if: matrix.package_manager == 'conan'
if: matrix.preset == 'conan'
uses: turtlebrowser/get-conan@main

- name: Init conan
if: matrix.package_manager == 'conan'
if: matrix.preset == 'conan'
run: conan profile detect

- name: Install dependencies with conan
if: matrix.package_manager == 'conan'
if: matrix.preset == 'conan'
shell: cmd
run: conan install . -of build -s build_type=Release -o *:shared=False --build=missing

- name: Configure
shell: cmd
run: cmake --preset ${{ matrix.package_manager }} -DQUAZIP_ENABLE_TESTS=ON
run: cmake --preset ${{ matrix.preset }} -DQUAZIP_ENABLE_TESTS=ON

- name: Build
shell: cmd
working-directory: ./build
run: cmake --build . --config Release

- name: Check PE x64
if: "startsWith(matrix.qt_version, '6.')"
shell: bash
working-directory: ./build/quazip/Release
run: file quazip1-qt6.dll |grep "x86-64"

- name: Check PE x64
if: "startsWith(matrix.qt_version, '5.')"
shell: bash
working-directory: ./build/quazip/Release
run: file quazip1-qt5.dll |grep "x86-64"

- name: Debug
shell: cmd
run: dir build\qztest\Release

# TODO: We need to solve copying dlls to qztest.exe dir
- name: Test
if: false
shell: cmd
working-directory: ./build
run: ctest --verbose -C Release

windows-x86:
if: true
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
preset: [ conan_x86, vcpkg_x86 ]
qt_version: [ 5.12.12 ]

steps:
- uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: ${{ matrix.qt_version }}
cache: 'true'
cache-key-prefix: ${{ runner.os }}-Qt-Cache-${{ matrix.qt_version }}
dir: ${{ github.workspace }}/Qt
arch: 'win32_msvc2017'

- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: x86

- name: Install Conan
if: matrix.preset == 'conan_x86'
uses: turtlebrowser/get-conan@main

- name: Init conan
if: matrix.preset == 'conan_x86'
run: conan profile detect

- name: Install dependencies with conan
if: matrix.preset == 'conan_x86'
shell: cmd
run: conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing

- name: Configure
shell: cmd
run: cmake --preset ${{ matrix.preset }}

- name: Build
shell: cmd
working-directory: ./build
run: cmake --build . --config Release

- name: Check PE x86
shell: bash
working-directory: ./build/quazip/Release
run: file quazip1-qt5.dll |grep 80386
23 changes: 22 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_ARCHITECTURE": "x64",
"VCPKG_TARGET_TRIPLET": "x64-windows",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "vcpkg_x86",
"binaryDir": "${sourceDir}/build",
"architecture": "WIN32",
"cacheVariables": {
"VCPKG_TARGET_TRIPLET ": "x86-windows",
"VCPKG_HOST_TRIPLET": "x86-windows",
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"CMAKE_BUILD_TYPE": "Release"
}
},
Expand All @@ -18,6 +29,16 @@
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"CMAKE_BUILD_TYPE": "Release"
}
},
{
"name": "conan_x86",
"binaryDir": "${sourceDir}/build",
"architecture": "WIN32",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/build/conan_toolchain.cmake",
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"CMAKE_BUILD_TYPE": "Release"
}
}
]
}
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ cmake --build build
```

## Windows

If you don't use a package manager you will have to add library and include directories to your PATH or specify them with `CMAKE_PREFIX_PATH`.
Qt is not installed as a dependency of either vcpkg or conan.

### x64
Using vcpkg
```
cmake --preset vcpkg
Expand All @@ -54,8 +59,21 @@ cmake --preset conan
cmake --build build --config Release
```

If you don't use a package manager you will have to add library and include directories to your PATH or specify them with `CMAKE_PREFIX_PATH`.
Qt is not installed as a dependency of either vcpkg or conan.
### x86
Only Qt5 is tested on x86.

Using vcpkg
```
cmake --preset vcpkg_x86
cmake --build build --config Release
```

Using conan v2
```
conan install . -of build -s build_type=Release -s:h arch=x86 -o *:shared=False --build=missing
cmake --preset conan_x86
cmake --build build --config Release
```

## Additional build options
If you built Qt from source and installed it, you might need to tell CMake where to find it, for example: `-DCMAKE_PREFIX_PATH="/usr/local/Qt-6.6.2"`.
Expand Down
10 changes: 8 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
from conan import ConanFile
from conan.tools.cmake import CMakeToolchain

class Quazip(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeDeps", "CMakeToolchain"
generators = "CMakeDeps"

requires = (
"zlib/1.3.1",
"bzip2/1.0.8"
)
)

def generate(self):
tc = CMakeToolchain(self)
tc.user_presets_path = False
tc.generate()

0 comments on commit 5afec8f

Please sign in to comment.