diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59411b73..38cdcae4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,60 +48,37 @@ jobs: Echo ("version_minor=" + $VersionMinor) >> $Env:GITHUB_OUTPUT; Echo ("version_patch=" + $VersionPatch) >> $Env:GITHUB_OUTPUT; - - name: Set up MSBuild - uses: microsoft/setup-msbuild@v1 - - name: Build Algorithms run: | cd ${{ github.workspace }} .\build_algorithms.ps1 -# - name: Build Solution (Win32) -# run: | -# msbuild "-property:Configuration=Release;Platform=x86;CI_VERSION=${{ steps.checktag.outputs.version }};CI_VERSION_MAJOR=${{ steps.checktag.outputs.version_major }};CI_VERSION_MINOR=${{ steps.checktag.outputs.version_minor }};CI_VERSION_PATCH=${{ steps.checktag.outputs.version_patch }}" OpenHashTab.sln -# -# - name: Build Solution (x64) -# run: | -# msbuild "-property:Configuration=Release;Platform=x64;CI_VERSION=${{ steps.checktag.outputs.version }};CI_VERSION_MAJOR=${{ steps.checktag.outputs.version_major }};CI_VERSION_MINOR=${{ steps.checktag.outputs.version_minor }};CI_VERSION_PATCH=${{ steps.checktag.outputs.version_patch }}" OpenHashTab.sln -# -# - name: Build Solution (ARM64) -# run: | -# msbuild "-property:Configuration=Release;Platform=ARM64;CI_VERSION=${{ steps.checktag.outputs.version }};CI_VERSION_MAJOR=${{ steps.checktag.outputs.version_major }};CI_VERSION_MINOR=${{ steps.checktag.outputs.version_minor }};CI_VERSION_PATCH=${{ steps.checktag.outputs.version_patch }}" OpenHashTab.sln -# -# - name: Build Installer -# run: | -# iscc .\installer.iss -DCI_VERSION="${{ steps.checktag.outputs.version }}" -DCI_VERSION_NUMERIC="${{ steps.checktag.outputs.version_major }}.${{ steps.checktag.outputs.version_minor }}.${{ steps.checktag.outputs.version_patch }}" -# -# - name: Pack artifacts -# run: | -# 7z a artifacts.7z .\bin\Release\ -# -# - name: Upload setup -# uses: actions/upload-artifact@v3 -# with: -# name: setup -# path: | -# .\OpenHashTab_setup.exe -# -# - name: Upload artifacts -# uses: actions/upload-artifact@v3 -# with: -# name: artifacts -# path: | -# .\artifacts.7z -# -# - name: Pack release symbols -# if: ${{ steps.checktag.outputs.is_release == 'yes' }} -# run: | -# cd ${{ github.workspace }} -# 7z a symbols.7z .\bin\Release\*\*.pdb -# -# - name: Release -# uses: softprops/action-gh-release@v1 -# if: ${{ steps.checktag.outputs.is_release == 'yes' }} -# with: -# files: | -# .\OpenHashTab_setup.exe -# asset_path: .\symbols.7z -# name: Release ${{ steps.checktag.outputs.version }} -# prerelease: true + - name: Build OpenHashTab + run: | + cd ${{ github.workspace }} + $Env:CI_VERSION = ${{ steps.checktag.outputs.version }}; + $Env:CI_VERSION_MAJOR = ${{ steps.checktag.outputs.version_major }}; + $Env:CI_VERSION_MINOR = ${{ steps.checktag.outputs.version_minor }}; + $Env:CI_VERSION_PATCH = ${{ steps.checktag.outputs.version_patch }}; + .\build_openhashtab.ps1 + + - name: Build Installer + run: | + iscc .\installer.iss -DCI_VERSION="${{ steps.checktag.outputs.version }}" -DCI_VERSION_NUMERIC="${{ steps.checktag.outputs.version_major }}.${{ steps.checktag.outputs.version_minor }}.${{ steps.checktag.outputs.version_patch }}" + + - name: Upload Installer + uses: actions/upload-artifact@v3 + with: + name: setup + path: | + .\OpenHashTab_setup.exe + + - name: Release + uses: softprops/action-gh-release@v1 + if: ${{ steps.checktag.outputs.is_release == 'yes' }} + with: + files: | + .\OpenHashTab_setup.exe + asset_path: .\symbols.7z + name: Release ${{ steps.checktag.outputs.version }} + prerelease: true diff --git a/AlgorithmsDlls/CMakeLists.txt b/AlgorithmsDlls/CMakeLists.txt index 6d8678ca..16845167 100644 --- a/AlgorithmsDlls/CMakeLists.txt +++ b/AlgorithmsDlls/CMakeLists.txt @@ -20,6 +20,8 @@ foreach (FLAVOR ${FLAVORS}) PROPERTY IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/AlgorithmsDll_${FLAVOR}.lib") set_property(TARGET "AlgorithmsDll_${FLAVOR}" PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/AlgorithmsDll_${FLAVOR}.dll") + set_property(TARGET "AlgorithmsDll_${FLAVOR}" + PROPERTY PDB_NAME "${CMAKE_CURRENT_SOURCE_DIR}/AlgorithmsDll_${FLAVOR}.pdb") target_link_options("AlgorithmsDll_${FLAVOR}" INTERFACE "/DELAYLOAD:AlgorithmsDll_${FLAVOR}") target_link_libraries(AlgorithmsDlls INTERFACE "AlgorithmsDll_${FLAVOR}") diff --git a/OpenHashTab/CMakeLists.txt b/OpenHashTab/CMakeLists.txt index f7cd83c6..1fa816cf 100644 --- a/OpenHashTab/CMakeLists.txt +++ b/OpenHashTab/CMakeLists.txt @@ -18,10 +18,10 @@ target_compile_definitions(OpenHashTab PRIVATE UNICODE _UNICODE _WINDLL - CI_VERSION=\"blah\" - CI_VERSION_MAJOR=1 - CI_VERSION_MINOR=1 - CI_VERSION_PATCH=1 + "CI_VERSION=\"${CI_VERSION}\"" + "CI_VERSION_MAJOR=${CI_VERSION_MAJOR}" + "CI_VERSION_MINOR=${CI_VERSION_MINOR}" + "CI_VERSION_PATCH=${CI_VERSION_PATCH}" ) target_compile_options(OpenHashTab PRIVATE @@ -29,3 +29,8 @@ target_compile_options(OpenHashTab PRIVATE ) target_precompile_headers(OpenHashTab PRIVATE stdafx.h) + +add_custom_command(TARGET OpenHashTab POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND_EXPAND_LISTS + ) diff --git a/build_openhashtab.ps1 b/build_openhashtab.ps1 new file mode 100644 index 00000000..0ec2139c --- /dev/null +++ b/build_openhashtab.ps1 @@ -0,0 +1,58 @@ +$VSRoot = (& vswhere -property installationPath); + +function Invoke-CmdScript { + param( + [String] $scriptName + ) + $cmdLine = """$scriptName"" $args & set" + & $Env:SystemRoot\system32\cmd.exe /c $cmdLine | + Select-String '^([^=]*)=(.*)$' | ForEach-Object { + $varName = $_.Matches[0].Groups[1].Value + $varValue = $_.Matches[0].Groups[2].Value + Set-Item Env:$varName $varValue + } +} + +$Env:RC = "llvm-rc"; + +$Environment = (Get-ChildItem Env:); + +Invoke-CmdScript "$VSRoot\VC\Auxiliary\Build\vcvars64.bat" + +cmake ` + -G Ninja ` + -S . ` + -B "cmake-openhashtab-x64" ` + -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -DCMAKE_C_COMPILER=clang-cl ` + -DCMAKE_CXX_COMPILER=clang-cl ` + "-DCI_VERSION=$Env:CI_VERSION" ` + "-DCI_VERSION_MINOR=$Env:CI_VERSION_MINOR" ` + "-DCI_VERSION_MAJOR=$Env:CI_VERSION_MAJOR" ` + "-DCI_VERSION_PATCH=$Env:CI_VERSION_PATCH" +cmake --build "cmake-openhashtab-x64" + +Remove-Item -Path Env:* +$Environment | % { Set-Item "env:$($_.Name)" $_.Value } + +Invoke-CmdScript "$VSRoot\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" +$ExtraFlags = "--target=arm64-pc-windows-msvc"; + +Set-Item Env:CFLAGS $ExtraFlags +Set-Item Env:CXXFLAGS $ExtraFlags + +cmake ` + -G Ninja ` + -S . ` + -B "cmake-openhashtab-ARM64" ` + -DCMAKE_BUILD_TYPE=RelWithDebInfo ` + -DCMAKE_C_COMPILER=clang-cl ` + -DCMAKE_CXX_COMPILER=clang-cl ` + "-DCI_VERSION=$Env:CI_VERSION" ` + "-DCI_VERSION_MINOR=$Env:CI_VERSION_MINOR" ` + "-DCI_VERSION_MAJOR=$Env:CI_VERSION_MAJOR" ` + "-DCI_VERSION_PATCH=$Env:CI_VERSION_PATCH" +cmake --build "cmake-openhashtab-ARM64" + +Remove-Item -Path Env:* +$Environment | % { Set-Item "env:$($_.Name)" $_.Value } diff --git a/installer.iss b/installer.iss index 3012dd52..d6443206 100644 --- a/installer.iss +++ b/installer.iss @@ -51,6 +51,8 @@ VersionInfoProductTextVersion={#CI_VERSION} VersionInfoVersion={#CI_VERSION_NUMERIC} ChangesAssociations = yes UninstallDisplayIcon={app}\OpenHashTab.dll,0 +ArchitecturesAllowed=x64 arm64 +ArchitecturesInstallIn64BitMode=x64 arm64 [Languages] Name: "en"; MessagesFile: "compiler:Default.isl" @@ -82,9 +84,16 @@ Name: "ChineseSimplified"; MessagesFile: "Localization\isl\ChineseSimplified.isl Name: "ChineseTraditional"; MessagesFile: "Localization\isl\ChineseTraditional.isl" [Files] -Source: "bin\Release\Win32\*.dll"; DestDir: "{app}"; Flags: ignoreversion solidbreak restartreplace 32bit; Check: InstallArch('x86') -Source: "bin\Release\x64\*.dll"; DestDir: "{app}"; Flags: ignoreversion solidbreak restartreplace 64bit; Check: InstallArch('x64') -Source: "bin\Release\ARM64\*.dll"; DestDir: "{app}"; Flags: ignoreversion solidbreak restartreplace 64bit; Check: InstallArch('arm64') +Source: "AlgorithmsDlls\*.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace; +Source: "AlgorithmsDlls\*.pdb"; DestDir: "{app}"; Flags: ignoreversion restartreplace; + +Source: "cmake-openhashtab-x64\OpenHashTab.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace 64bit; Check: InstallArch('x64') +Source: "cmake-openhashtab-x64\StandaloneStub.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace 64bit; Check: InstallArch('x64') +Source: "cmake-openhashtab-x64\*.pdb"; DestDir: "{app}"; Flags: ignoreversion restartreplace 64bit; Check: InstallArch('x64') + +Source: "cmake-openhashtab-ARM64\OpenHashTab.dll"; DestDir: "{app}"; Flags: ignoreversion restartreplace 64bit; Check: InstallArch('ARM64') +Source: "cmake-openhashtab-ARM64\StandaloneStub.exe"; DestDir: "{app}"; Flags: ignoreversion restartreplace 64bit; Check: InstallArch('ARM64') +Source: "cmake-openhashtab-ARM64\*.pdb"; DestDir: "{app}"; Flags: ignoreversion restartreplace 64bit; Check: InstallArch('ARM64') [CustomMessages] GroupDescription=Optional features: