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 scripts for arm64 building #193

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ bin
bin_32
bin_64
build
build_arm64
build_cov
choco
cmake_modules
Expand Down
8 changes: 8 additions & 0 deletions tools/arm64-build-win-vind.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@REM from https://github.com/pit-ray/win-vind/issues/191#issuecomment-1671656805

call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the environment is automatically selected within cmake, there is no need to call VsDevCmd.bat here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cmake isn't in my path until I make that call. As noted above, I'm using VSCode.

Should I try this from VS-Studio (community version)? Will this call cause problems?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you call VsDevCmd.cmd, the paths of installed extensions into the Visual Studio are loaded.
We assume that the cmake is installed independently from Visual Studio, so you do not need to call the VsDevCmd.bat and need to install cmake independently.

You can install cmake in various ways, such as winget, Chocolatey, installer, and so on.
Please see also https://github.com/pit-ray/win-vind/blob/master/CONTRIBUTING.md#softwares .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay - this is getting a bit complex to just try out the app. 😭 Let me spend some time on the x86 machine to see if win-vind will work for me, before I try to turn my machine into a dev box.

That'll take a while (probably a month with everything else going on). Thanks for your help.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Please feel free to message me.

if %errorlevel% neq 0 exit /b %errorlevel%
cmake -B build_arm64 -DCMAKE_BUILD_TYPE=Release -DwxWidgets_LIB_DIR=libs/wxWidgets/lib/vc_arm64_lib -G "Visual Studio 16 2019" -A Arm64 .
if %errorlevel% neq 0 exit /b %errorlevel%
cmake --build build_arm64 --config Release
if %errorlevel% neq 0 exit /b %errorlevel%
20 changes: 20 additions & 0 deletions tools/arm64-build-wxwidgets.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# taken from https://github.com/pit-ray/win-vind/issues/191#issuecomment-1671656805
hwine marked this conversation as resolved.
Show resolved Hide resolved

# Assume wxwidgets source already available. For fresh copy use
# .\tools\arm65-clean-checkout-wxwidgets.bat

cd libs
if %errorlevel% neq 0 exit /b %errorlevel%

cd wxWidgets
if %errorlevel% neq 0 exit /b %errorlevel%
cd build/msw
if %errorlevel% neq 0 exit /b %errorlevel%
rem call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
rem if %errorlevel% neq 0 exit /b %errorlevel%
call "c:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
Copy link
Owner

@pit-ray pit-ray Aug 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VsDevCmd.bat builds 32bit x86-native by default, so you should use vsvarsamd64_arm64.bat to build arm64 code.

https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-160

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's what those docs say, but it's not what is on my machine.

Listing
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools> ls


    Directory: C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----        2023-04-21     13:27                1033
d-----        2023-04-21     13:26                devinit
d-----        2023-04-21     11:07                en
d-----        2023-04-21     11:07                vsdevcmd
-a----        2023-04-21     17:49          50592 errlook.exe
-a----        2023-04-21     17:49           7427 errlook.hlp
-a----        2023-04-21     17:49          36272 guidgen.exe
-a----        2023-04-21     17:48          20486 Launch-VsDevShell.ps1
-a----        2023-04-21     17:48            103 LaunchDevCmd.bat
-a----        2023-04-21     17:49          31152 makehm.exe
-a----        2023-04-21     17:48          35728 Microsoft.VisualStudio.DevShell.dll
-a----        2023-04-21     17:52         115559 spyxx.chm
-a----        2023-04-21     17:52         695208 spyxx.exe
-a----        2023-04-21     17:52         163200 spyxxhk.dll
-a----        2023-04-21     17:52         181136 spyxxhk_amd64.dll
-a----        2023-04-21     17:52         115559 spyxx_amd64.chm
-a----        2023-04-21     17:52         945080 spyxx_amd64.exe
-a----        2023-04-21     17:51         319384 vcconvertengine.dll
-a----        2023-04-21     17:51         369600 VCProjectConversion.dll
-a----        2023-04-21     17:48          11073 VsDevCmd.bat
-a----        2023-04-21     17:48            611 VsMSBuildCmd.bat


C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools>

FWIW since I'm no longer comfortable at a windows command line, I am doing this all from VS-Code. I'm running the batch files from a powershell-opened-in-vscode.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried BuildTools edition of Visual Studio, not Community.
There are these various command line tools in the C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build, but the arm64 tool does not exist.
Even worse, I cannot find the arm64 option for the BuildTools edition in the Visual Studio Installer.

However, if you install Visual Studio 2019 Comminy rather than BuildTools, these command files are available in the C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build.
The arm compiler is not install as default, you should enable MSVC v 142 - VS 2019 C++ ARM64 Build tool of Desktop development with C++ in Visual Studio Installer.

if %errorlevel% neq 0 exit /b %errorlevel%
nmake /f makefile.vc BUILD=release SHARED=0 UNICODE=1 TARGET_CPU=ARM64 RUNTIME_LIBS=static
if %errorlevel% neq 0 exit /b %errorlevel%
cd ../../../
if %errorlevel% neq 0 exit /b %errorlevel%
16 changes: 16 additions & 0 deletions tools/arm64-clean-checkout-wxwidgets.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# clean the wxWidgets

cd libs
if %errorlevel% neq 0 exit /b %errorlevel%

rmdir /s wxWidgets
if %errorlevel% neq 0 exit /b %errorlevel%

# get fresh copies
git clone https://github.com/wxWidgets/wxWidgets.git -b v3.1.5 -j %NUMBER_OF_PROCESSORS% --depth=1
if %errorlevel% neq 0 exit /b %errorlevel%

cd wxWidgets
if %errorlevel% neq 0 exit /b %errorlevel%
git submodule update --init -j %NUMBER_OF_PROCESSORS%
if %errorlevel% neq 0 exit /b %errorlevel%