From b70ab41422dc309a6d89e9263282da79931f79a7 Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 16:29:47 +0200 Subject: [PATCH 1/9] Update CI for static builds --- .github/workflows/build-uc2.yml | 45 ++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-uc2.yml b/.github/workflows/build-uc2.yml index 345c01b0..ce5b7508 100644 --- a/.github/workflows/build-uc2.yml +++ b/.github/workflows/build-uc2.yml @@ -31,7 +31,8 @@ jobs: arch: x64, python-arch: x64, python-ver: '3.8', - name: 'windows-x64 MINGW64', + name: 'windows-x64 MINGW64 shared', + shared: 'yes', mingw: MINGW64, mingw-arch: x86_64, artifact: 'windows_mingw64.7z', @@ -44,7 +45,36 @@ jobs: arch: x64, python-arch: x64, python-ver: '3.8', - name: 'windows-x64 MINGW32', + name: 'windows-x64 MINGW64 static', + shared: 'no', + mingw: MINGW64, + mingw-arch: x86_64, + artifact: 'windows_mingw64.7z', + build_type: 'Debug', + archiver: '7z a', + generators: 'Ninja' + } + - { + os: windows-2019, + arch: x64, + python-arch: x64, + python-ver: '3.8', + name: 'windows-x64 MINGW32 shared', + shared: "yes", + mingw: MINGW32, + mingw-arch: i686, + artifact: 'windows_mingw32.7z', + build_type: 'Debug', + archiver: '7z a', + generators: 'Ninja' + } + - { + os: windows-2019, + arch: x64, + python-arch: x64, + python-ver: '3.8', + name: 'windows-x64 MINGW32 static', + shared: "no", mingw: MINGW32, mingw-arch: i686, artifact: 'windows_mingw32.7z', @@ -138,7 +168,8 @@ jobs: -B . \ -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -G "${{ matrix.config.generators }}" \ - -DCMAKE_INSTALL_PREFIX:PATH=instdir + -DCMAKE_INSTALL_PREFIX:PATH=instdir \ + -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} cmake --build . --config ${{ matrix.config.build_type }} cmake --install . --strip --config ${{ matrix.config.build_type }} ctest -VV -C ${{ matrix.config.build_type }} @@ -164,7 +195,8 @@ jobs: -A "win32" \ -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -G "${{ matrix.config.generators }}" \ - -DCMAKE_INSTALL_PREFIX:PATH=instdir + -DCMAKE_INSTALL_PREFIX:PATH=instdir \ + -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} cmake --build . --config ${{ matrix.config.build_type }} cmake --install . --strip --config ${{ matrix.config.build_type }} ctest -VV -C ${{ matrix.config.build_type }} @@ -191,7 +223,8 @@ jobs: -B . \ -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -G "${{ matrix.config.generators }}" \ - -DCMAKE_INSTALL_PREFIX:PATH=instdir + -DCMAKE_INSTALL_PREFIX:PATH=instdir \ + -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} cmake --build . --config ${{ matrix.config.build_type }} cmake --install . --strip ctest -VV -C ${{ matrix.config.build_type }} @@ -277,7 +310,7 @@ jobs: -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \ -G "${{ matrix.config.generators }}" \ -DCMAKE_INSTALL_PREFIX:PATH=instdir \ - -DBUILD_SHARED_LIB= ${{ matrix.config.shared }} + -DBUILD_SHARED_LIBS=${{ matrix.config.shared }} cmake --build . --config ${{ matrix.config.build_type }} cmake --install . --strip ctest -VV -C ${{ matrix.config.build_type }} From 7dfecbcb4ae4dd9a23efcfb7c2401632b76c8769 Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 17:40:57 +0200 Subject: [PATCH 2/9] Fix mingw archiver --- bundle_static.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle_static.cmake b/bundle_static.cmake index 4bae6cf6..d3002533 100644 --- a/bundle_static.cmake +++ b/bundle_static.cmake @@ -55,7 +55,7 @@ function(bundle_static_library tgt_name bundled_tgt_name library_name) OUTPUT ${bundled_tgt_full_name} COMMENT "Bundling ${bundled_tgt_name}" VERBATIM) - elseif(UNIX) + elseif(UNIX OR MINGW) file(WRITE ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in "CREATE ${bundled_tgt_full_name}\n" ) From bc056727af1df41ffd24d1609eb0722595d17c51 Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 17:51:03 +0200 Subject: [PATCH 3/9] Fix MSVC build --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c2835bd8..42f7fe80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1360,7 +1360,12 @@ endif() # Black magic for generating static archives... if (BUILD_SHARED_LIBS) - bundle_static_library(unicorn_static unicorn_archive unicorn) + if (MSVC) + # Avoid the import lib built by MVSC clash with our archive. + set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-import") + endif() + bundle_static_library(unicorn_static unicorn_archive unicorn) + endif() else() # Rename the "static" lib to avoid filename clash. set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-static") From 7bc6e9a26555d5f7ee5b1223eeca446a7da1a9ae Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 17:53:35 +0200 Subject: [PATCH 4/9] Fix syntax error --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42f7fe80..3d3a88de 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1364,8 +1364,7 @@ if (BUILD_SHARED_LIBS) # Avoid the import lib built by MVSC clash with our archive. set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-import") endif() - bundle_static_library(unicorn_static unicorn_archive unicorn) - endif() + bundle_static_library(unicorn_static unicorn_archive unicorn) else() # Rename the "static" lib to avoid filename clash. set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-static") From e3dc67e1ea86eec10da57bc6043af8d5615a2e9d Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 18:12:25 +0200 Subject: [PATCH 5/9] Setup x64 msvc dev cmd --- .github/workflows/build-uc2.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-uc2.yml b/.github/workflows/build-uc2.yml index ce5b7508..a71cab49 100644 --- a/.github/workflows/build-uc2.yml +++ b/.github/workflows/build-uc2.yml @@ -180,6 +180,12 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 with: arch: x86 + + - name: '🛠️ Win MSVC 64 setup' + if: contains(matrix.config.name, 'MSVC 32') + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 - name: '🚧 Win MSVC 32 build' if: contains(matrix.config.name, 'MSVC 32') From 7c5e9e70f437cb1fe6c5a33334ee72aadec0fffa Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 18:30:57 +0200 Subject: [PATCH 6/9] Fix typo --- .github/workflows/build-uc2.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-uc2.yml b/.github/workflows/build-uc2.yml index a71cab49..b0667949 100644 --- a/.github/workflows/build-uc2.yml +++ b/.github/workflows/build-uc2.yml @@ -182,7 +182,7 @@ jobs: arch: x86 - name: '🛠️ Win MSVC 64 setup' - if: contains(matrix.config.name, 'MSVC 32') + if: contains(matrix.config.name, 'MSVC 64') uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 From 9691059c5bf728bd7bc2349178cabf840debe5d7 Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 19:04:24 +0200 Subject: [PATCH 7/9] Move forwards dev cmd setup --- .github/workflows/build-uc2.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-uc2.yml b/.github/workflows/build-uc2.yml index b0667949..7e6b7839 100644 --- a/.github/workflows/build-uc2.yml +++ b/.github/workflows/build-uc2.yml @@ -154,6 +154,12 @@ jobs: - name: '🛠️ Win MSVC 64 setup' if: contains(matrix.config.name, 'MSVC 64') uses: microsoft/setup-msbuild@v1 + + - name: '🛠️ Win MSVC 64 dev cmd setup' + if: contains(matrix.config.name, 'MSVC 64') + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 - name: '🚧 Win MSVC 64 build' if: contains(matrix.config.name, 'MSVC 64') @@ -180,12 +186,6 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 with: arch: x86 - - - name: '🛠️ Win MSVC 64 setup' - if: contains(matrix.config.name, 'MSVC 64') - uses: ilammy/msvc-dev-cmd@v1 - with: - arch: x64 - name: '🚧 Win MSVC 32 build' if: contains(matrix.config.name, 'MSVC 32') From fc2683c973c754a2f482a87b867ff0d9770fa7bf Mon Sep 17 00:00:00 2001 From: lazymio Date: Mon, 2 May 2022 23:34:08 +0200 Subject: [PATCH 8/9] Fix cmake typo to correctly only set archive output name --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d3a88de..25fe2658 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1362,7 +1362,7 @@ endif() if (BUILD_SHARED_LIBS) if (MSVC) # Avoid the import lib built by MVSC clash with our archive. - set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-import") + set_target_properties(unicorn PROPERTIES ARCHIVE_OUTPUT_NAME "unicorn-import") endif() bundle_static_library(unicorn_static unicorn_archive unicorn) else() From 95ecfead484d22e6c706d535fad748d6adbadeeb Mon Sep 17 00:00:00 2001 From: lazymio Date: Tue, 3 May 2022 00:03:48 +0200 Subject: [PATCH 9/9] Update PyPI CI --- .github/workflows/PyPI-publishing.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/PyPI-publishing.yml b/.github/workflows/PyPI-publishing.yml index f2411c70..143db4e7 100644 --- a/.github/workflows/PyPI-publishing.yml +++ b/.github/workflows/PyPI-publishing.yml @@ -71,6 +71,18 @@ jobs: uses: microsoft/setup-msbuild@v1.0.3 with: vs-version: '16.5' + + - name: '🛠️ Win MSVC 32 dev cmd setup' + if: contains(matrix.config.name, 'win32') + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x86 + + - name: '🛠️ Win MSVC 64 dev cmd setup' + if: contains(matrix.config.name, 'win_amd64') + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 - name: '🛠️ Win build dependencies' if: contains(matrix.config.name, 'win')