From 85cb8c27f27b0f3dab72ab181ba1bed5400e13e5 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Feb 2022 14:22:09 +0000 Subject: See [https://github.com/tcltk/tcl/pull/11], but (hopefully) slightly better --- .github/workflows/win-build.yml | 4 ++-- win/rules.vc | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/win-build.yml b/.github/workflows/win-build.yml index 370f2de..a470f50 100644 --- a/.github/workflows/win-build.yml +++ b/.github/workflows/win-build.yml @@ -4,7 +4,7 @@ env: ERROR_ON_FAILURES: 1 jobs: msvc: - runs-on: windows-latest + runs-on: windows-2022 defaults: run: shell: powershell @@ -41,7 +41,7 @@ jobs: throw "nmake exit code: $lastexitcode" } gcc: - runs-on: windows-latest + runs-on: windows-2022 defaults: run: shell: msys2 {0} diff --git a/win/rules.vc b/win/rules.vc index 2f01de0..4f103d0 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -548,10 +548,15 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c !endif # NMAKEHLPC +nmakehlp: + $(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console + # We always build nmakehlp even if it exists since we do not know # what source it was built from. +!if "$(MACHINE)" == "$(NATIVE_ARCH)" !if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul] !endif +!endif ################################################################ # 5. Test for compiler features -- cgit v0.12 From 21db6889635b43cef6b659b974ec0883a551d4e1 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Feb 2022 16:21:35 +0000 Subject: more tweaks for windows-arm64 --- libtommath/tommath.h | 2 +- win/rules.vc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libtommath/tommath.h b/libtommath/tommath.h index 22951c9..8ccbb89 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -37,7 +37,7 @@ extern "C" { #endif /* detect 64-bit mode if possible */ -#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || \ +#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || defined(_M_ARM64) || \ defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || \ defined(__s390x__) || defined(__arch64__) || defined(__aarch64__) || \ defined(__sparcv9) || defined(__sparc_v9__) || defined(__sparc64__) || \ diff --git a/win/rules.vc b/win/rules.vc index 4f103d0..b68b6b4 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -1384,7 +1384,7 @@ OPTDEFINES = $(OPTDEFINES) /DUSE_THREAD_ALLOC=1 OPTDEFINES = $(OPTDEFINES) /DSTATIC_BUILD !elseif $(TCL_VERSION) > 86 OPTDEFINES = $(OPTDEFINES) /DTCL_WITH_EXTERNAL_TOMMATH -!if "$(MACHINE)" == "AMD64" +!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" OPTDEFINES = $(OPTDEFINES) /DMP_64BIT !endif !endif @@ -1412,7 +1412,7 @@ OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_OPTIMIZED !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_PROFILED !endif -!if "$(MACHINE)" == "AMD64" +!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" OPTDEFINES = $(OPTDEFINES) /DTCL_CFG_DO64BIT !endif !if $(VCVERSION) < 1300 @@ -1474,7 +1474,7 @@ cdebug = $(cdebug) -Zi # cwarn includes default warning levels. cwarn = $(WARNINGS) -!if "$(MACHINE)" == "AMD64" +!if "$(MACHINE)" == "AMD64" || "$(MACHINE)" == "ARM64" # Disable pointer<->int warnings related to cast between different sizes # There are a gadzillion of these due to use of ClientData and # clutter up compiler -- cgit v0.12 From 18d3a2a589b6273929881e13028b5c87b1bad96f Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Fri, 11 Feb 2022 16:34:26 +0000 Subject: Document how to cross-compile with Visual Studio --- win/README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/win/README b/win/README index d332557..f4cdde4 100644 --- a/win/README +++ b/win/README @@ -56,6 +56,13 @@ using it, are in the comments of "makefile.vc". A quick example would be: There is also a Developer Studio workspace and project file, too, if you would like to use them. +If you want to Cross-compile with Visual Studio (e.g. for X86 or ARM64 +targets, but running on AMD64), first set up the environment for +your host machine and compile nmakehlp.exe: + C:\tcl_source\win\>nmake -f makefile.vc nmakehlp +Then go to your cross-compile environment and run the nmake +command again for whatever you want to build. + If you are building with Linux, Cygwin or Msys, you can use the configure script that lives in the win subdirectory. The Linux/Cygwin/Msys based configure/build process works just like the UNIX one, so you will want -- cgit v0.12