mirror of
https://github.com/capstone-engine/capstone
synced 2026-08-11 16:26:07 -04:00
Add workflow for building on Windows (#2675)
* Add workflow for building on Windows * Fix build
This commit is contained in:
parent
72f7d3055a
commit
ebe3ef2ace
4 changed files with 52 additions and 4 deletions
43
.github/workflows/build_release.yml
vendored
43
.github/workflows/build_release.yml
vendored
|
|
@ -22,10 +22,9 @@ jobs:
|
|||
PKGNAME="capstone-$VERSION"
|
||||
SHASUM=$PKGNAME.tar.xz.sha256
|
||||
mkdir -p /tmp/$PKGNAME
|
||||
mv * /tmp/$PKGNAME
|
||||
mv /tmp/$PKGNAME .
|
||||
rsync -a --exclude=build --exclude='.*' ./ /tmp/$PKGNAME/
|
||||
TARBALL=$PKGNAME.tar.xz
|
||||
tar cJf $TARBALL $PKGNAME
|
||||
tar -C /tmp -cJf $TARBALL $PKGNAME
|
||||
sha256sum $TARBALL > $SHASUM
|
||||
echo "tarball=$TARBALL" >> $GITHUB_OUTPUT
|
||||
echo "shasum=$SHASUM" >> $GITHUB_OUTPUT
|
||||
|
|
@ -64,3 +63,41 @@ jobs:
|
|||
files: |
|
||||
./build/*.deb
|
||||
./build/*.rpm
|
||||
|
||||
build_windows:
|
||||
name: build_windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
|
||||
- name: Win MSVC 64 dev cmd setup
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Configure CMake and build the project
|
||||
run: |
|
||||
cmake -B build `
|
||||
-T "ClangCL,host=x64" `
|
||||
-A x64 `
|
||||
-DPROJECT_VERSION="${{ github.event.release.tag_name }}" `
|
||||
-DCMAKE_BUILD_TYPE=Release `
|
||||
-DCAPSTONE_BUILD_SHARED_LIBS=1
|
||||
cmake --build build --config Release
|
||||
cmake --install build --config Release
|
||||
|
||||
- name: Package NSIS installer
|
||||
run: |
|
||||
cd build
|
||||
cpack -G NSIS
|
||||
|
||||
- name: Upload NSIS installer to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name }}
|
||||
files: |
|
||||
./build/*.exe
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ endif()
|
|||
cmake_policy(SET CMP0042 NEW)
|
||||
|
||||
# Check if VERSION is provided externally, otherwise default to 6.0.0
|
||||
if(NOT DEFINED PROJECT_VERSION)
|
||||
if(NOT DEFINED PROJECT_VERSION OR PROJECT_VERSION STREQUAL "")
|
||||
set(PROJECT_VERSION "6.0.0")
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ foreach(generator ${CPACK_GENERATOR})
|
|||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_DEBIAN_PACKAGE_FILE_NAME})
|
||||
elseif("${generator}" STREQUAL "RPM")
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_RPM_PACKAGE_FILE_NAME})
|
||||
elseif("${generator}" STREQUAL "NSIS")
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_NSIS_PACKAGE_FILE_NAME})
|
||||
elseif("${generator}" STREQUAL "DragNDrop")
|
||||
set(CPACK_PACKAGE_FILE_NAME ${CPACK_DMG_PACKAGE_FILE_NAME})
|
||||
else()
|
||||
|
|
|
|||
|
|
@ -51,9 +51,18 @@ set(CPACK_RPM_CHANGELOG_FILE "${PROJECT_SOURCE_DIR}/ChangeLog")
|
|||
set(CPACK_RPM_PACKAGE_LICENSE "BSD3, LLVM")
|
||||
set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
|
||||
|
||||
# Windows package settings
|
||||
if(WIN32)
|
||||
set(CPACK_PACKAGE_INSTALL_DIRECTORY "capstone")
|
||||
set(CPACK_SYSTEM_NAME "Windows-x64")
|
||||
set(CPACK_NSIS_MODIFY_PATH ON)
|
||||
set(CPACK_NSIS_PACKAGE_NAME "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}")
|
||||
endif()
|
||||
|
||||
# Set package file name based on the generator
|
||||
set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
|
||||
set(CPACK_RPM_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}")
|
||||
set(CPACK_DMG_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
|
||||
set(CPACK_NSIS_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-${CPACK_SYSTEM_NAME}")
|
||||
|
||||
include(CPack)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue