Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add windows build #6

Merged
merged 11 commits into from
Jan 10, 2025
46 changes: 46 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,49 @@ jobs:
-DCMAKE_OSX_ARCHITECTURES='${{ matrix.architectures }}'
cmake --build build --config Release
sudo cmake --install build --config Release

windows:
name: Windows (${{ matrix.arch }}-bit, Qt ${{ matrix.qt_version_major }})
runs-on: windows-latest

strategy:
matrix:
include:
- qt_version: 5.15.2
qt_version_major: 5
qt_arch: win64_msvc2019_64
arch: 32
- qt_version: 6.8.1
qt_version_major: 6
qt_arch: win64_msvc2022_64
arch: 64

defaults:
run:
shell: bash

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: ${{ matrix.qt_version }}
arch: ${{ matrix.qt_arch }}
cache: true

- name: Build
run: |
pushd aseprite
patch -p1 < ../aseprite-fix-zlib-include.patch
patch -p1 < ../aseprite-msvc-dynamic-runtime.patch
pushd laf
patch -p1 < ../../laf-msvc-dynamic-runtime.patch
popd
popd
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
cmake --install build --config Release
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.16)

project(qaseprite LANGUAGES CXX)

Expand All @@ -18,7 +18,7 @@ set(ENABLE_WEBP off)

add_subdirectory(aseprite EXCLUDE_FROM_ALL)

add_library(qaseprite SHARED
add_library(qaseprite MODULE
qaseprite.cpp
qaseprite.json
)
Expand Down Expand Up @@ -49,4 +49,5 @@ endif()

install(
TARGETS qaseprite
RUNTIME DESTINATION "${QT_INSTALL_PREFIX}/${QT_INSTALL_PLUGINS}/imageformats"
LIBRARY DESTINATION "${QT_INSTALL_PREFIX}/${QT_INSTALL_PLUGINS}/imageformats")
13 changes: 13 additions & 0 deletions aseprite-fix-zlib-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index af09ed229..b1bd0189b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,7 +234,7 @@ else()
set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
set(ZLIB_INCLUDE_DIRS
${ZLIB_DIR}
- ${CMAKE_BINARY_DIR}/third_party/zlib) # Zlib generated zconf.h file
+ ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib) # Zlib generated zconf.h file
set(ZLIB_INCLUDE_DIR ${ZLIB_INCLUDE_DIRS} CACHE PATH "")
endif()
include_directories(${ZLIB_INCLUDE_DIRS})
13 changes: 13 additions & 0 deletions aseprite-msvc-dynamic-runtime.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b1bd0189b..c4b6ed0c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) # We use -std=c++17 instead of -std=gnu++17 in macOS
-set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
43 changes: 43 additions & 0 deletions laf-msvc-dynamic-runtime.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b846431..2c2646a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.16)
# the static version of the libc runtime
set(CMAKE_USER_MAKE_RULES_OVERRIDE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX ${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_flag_overrides.cmake)
-set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
+set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")

project(laf C CXX)

diff --git a/cmake/c_flag_overrides.cmake b/cmake/c_flag_overrides.cmake
index 4096532..7cf2a28 100644
--- a/cmake/c_flag_overrides.cmake
+++ b/cmake/c_flag_overrides.cmake
@@ -1,6 +1,6 @@
if(MSVC)
- set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
- set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
- set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
+ set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+ set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ set(CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
+ set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
endif()
diff --git a/cmake/cxx_flag_overrides.cmake b/cmake/cxx_flag_overrides.cmake
index a73eb94..f0ee19b 100644
--- a/cmake/cxx_flag_overrides.cmake
+++ b/cmake/cxx_flag_overrides.cmake
@@ -1,6 +1,6 @@
if(MSVC)
- set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
- set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
- set(CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
+ set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1")
+ set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+ set(CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
endif()