build: link user32.lib when build with QMake and MSVC (#59)

* build(msvc): add test for qmake build with msvc under windows
* fix(msvc): should link user32.lib under windows
* Update README.md
This commit is contained in:
Gary Wang 2022-05-29 01:06:00 +08:00 committed by GitHub
parent a2d8a0cd12
commit b033370d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 0 deletions

30
.github/workflows/windows.yml vendored Normal file
View File

@ -0,0 +1,30 @@
name: Windows CI
on: [push, pull_request]
jobs:
msvc-build:
strategy:
matrix:
vs: ['2019']
msvc_arch: ['x64']
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
arch: 'win64_msvc2019_64'
version: '5.15.2'
- name: Build
shell: cmd
run: |
set VS=${{ matrix.vs }}
set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"
call %VCVARS% ${{ matrix.msvc_arch }}
qmake pineapple-pictures.pro
nmake

View File

@ -48,6 +48,9 @@ The project will try to build with `exiv2` when it's available at build time, if
Image formats supports rely on Qt's imageformats plugins, just get the plugins you need from your distro's package manager will be fine. For Windows user, you may need build and install the imageformats plugin manually, read the content below. Image formats supports rely on Qt's imageformats plugins, just get the plugins you need from your distro's package manager will be fine. For Windows user, you may need build and install the imageformats plugin manually, read the content below.
> **Note**
> Although there is a `pineapple-pictures.pro` file which can be used for QMake build, it's only for testing purpose and it doesn't have `exiv2` support included. Using QMake to build this project is NOT supported, please use CMake if possible.
### Linux ### Linux
Just normal build process as other program will be fine. Nothing special ;) Just normal build process as other program will be fine. Nothing special ;)

View File

@ -48,6 +48,9 @@ $ cmake --build . # 如果你使用 Makefile 作为 CMake 生成器,也可以
此应用的图片格式支持依赖于 Qt 的 imageformats 插件,直接从您所用的发行版获取对应的图像格式插件即可。对于 Windows 用户,您可能需要手动构建和使用图像格式插件。下方给出了进一步的说明。 此应用的图片格式支持依赖于 Qt 的 imageformats 插件,直接从您所用的发行版获取对应的图像格式插件即可。对于 Windows 用户,您可能需要手动构建和使用图像格式插件。下方给出了进一步的说明。
> **Note**
> 尽管存在一个可用于 QMake 构建的 `pineapple-pictures.pro` 文件,但其仅供简单测试所用且其并不包含 `exiv2` 支持。使用 QMake 构建此项目是 **不受支持** 的,请尽可能考虑使用 CMake。
### Linux ### Linux
常规的构建步骤即可完成构建,不需要额外的处理步骤 ;) 常规的构建步骤即可完成构建,不需要额外的处理步骤 ;)

View File

@ -82,3 +82,8 @@ RC_ICONS = assets/icons/app-icon.ico
QMAKE_TARGET_PRODUCT = Pineapple Pictures QMAKE_TARGET_PRODUCT = Pineapple Pictures
QMAKE_TARGET_DESCRIPTION = Pineapple Pictures - Image Viewer QMAKE_TARGET_DESCRIPTION = Pineapple Pictures - Image Viewer
QMAKE_TARGET_COPYRIGHT = MIT/Expat License - Copyright (C) 2020 Gary Wang QMAKE_TARGET_COPYRIGHT = MIT/Expat License - Copyright (C) 2020 Gary Wang
# MSVC only, since QMake doesn't have a CMAKE_CXX_STANDARD_LIBRARIES or cpp_winlibs similar thing
win32-msvc* {
LIBS += -luser32
}