[gtk/gtk-3-24] Visual Studio projects: Support arm64/aarch64 builds better



commit ac7dd63b02c32278b9c4d7e506dea194af82bb45
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Dec 24 16:17:50 2020 +0800

    Visual Studio projects: Support arm64/aarch64 builds better
    
    Update the NMake Makefiles used for generating the various sources be able to
    cope with an ARM64 build environment, and update the project files, in
    particular for Visual Studio 2017 (VisualStudioVersion 15.0) so that we can
    pull in the system .lib's that were somehow excluded from the default list
    on ARM64 builds.
    
    Also, add a custom Directory.Build.props in win32/vs15 so that we do not
    try to build with the Windows 8.1 SDK by defualt, which is not ready for ARM64
    builds, but instead uses the appropriate Windows 10 SDK that supports this.
    
    Update the README.win32 file to give people instructions on how ARM64 builds
    can be carried out.

 README.win32                        | 21 +++++++++++++++++++++
 win32/detectenv-msvc.mak            |  2 ++
 win32/vs10/gtk3-build-defines.props |  6 +++++-
 win32/vs15/Directory.Build.props    |  5 +++++
 win32/vs15/Makefile.am              |  6 ++++--
 5 files changed, 37 insertions(+), 3 deletions(-)
---
diff --git a/README.win32 b/README.win32
index 7a243a147c..3f63458394 100644
--- a/README.win32
+++ b/README.win32
@@ -175,6 +175,27 @@ instance the makefile.msc files might not produce identically named
 DLLs and import libraries as the "autoconfiscated" makefiles and
 libtool do. If this bothers you, you will have to fix the makefiles.
 
+If desiring to build binaries for ARM64 (aarch64), one needs to use the
+Visual Studio 2017 or 2019 solution files, or use Meson with a
+cross-compilation file, with a Windows 10 SDK that supports ARM64
+builds.  At this point, building the introspection files is not supported
+for ARM64 builds, and you will need a Python interpreter and
+glib-compile-resources binaries that run on the build machine.  For Visual Studio
+2017 ARM64 builds, do also check the Directory.Build.props file in $(srcroot)/win32/vs15
+indicates a Windows 10 SDK version that supports ARM64 builds exists on the build machine.
+
+For building ARM64 binaries with the Visual Studio projects, prior to the build,
+you may need to update gtk3-gen-srcs.props to pass in the variables GLIB_MKENUMS,
+GLIB_GENMARSHAL, GDBUS_CODEGEN and/or GLIB_COMPILE_RESOURCES in the nmake command line
+indicated by <GenerateRequiredSourcesBase>  so that they point to the glib-mkenums,
+glib-genmarshal, gdbus-codegen and glib-compile-resources that will run on the build
+machine.  You may also need to update gtk3-version-paths.props to update PythonDir to
+the installation of the Python interpreter that will run on the build machine.  To carry
+out the actual build using the solution files, use the "Configuration Manager" to add the
+ARM64 build configs by copying the settings from the x64 configs, and then build the solution.
+The build instructions for such builds otherwise follow the standard Win32 (x86) and
+x64 builds, but you need to ensure that you have ARM64 builds of the various dependencies.
+
 3) Using Meson (for Visual Studio and MinGW builds)
 ---
 
diff --git a/win32/detectenv-msvc.mak b/win32/detectenv-msvc.mak
index 787a897417..22facfee23 100644
--- a/win32/detectenv-msvc.mak
+++ b/win32/detectenv-msvc.mak
@@ -21,6 +21,8 @@ _HASH=^#
     && ![echo PLAT=Win32 >> vercl.x] \
     && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
     && ![echo PLAT=x64 >> vercl.x] \
+    && ![echo $(_HASH)elif defined(_M_ARM64) >> vercl.x] \
+    && ![echo PLAT=arm64 >> vercl.x] \
     && ![echo $(_HASH)endif >> vercl.x] \
     && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
 !include vercl.i
diff --git a/win32/vs10/gtk3-build-defines.props b/win32/vs10/gtk3-build-defines.props
index 83df528492..0a20f662d9 100644
--- a/win32/vs10/gtk3-build-defines.props
+++ b/win32/vs10/gtk3-build-defines.props
@@ -10,7 +10,8 @@
     <GdkDefines>GDK_COMPILATION;G_LOG_DOMAIN="Gdk"</GdkDefines>
     
<GtkIncludedImmodulesDefines>INCLUDE_IM_am_et;INCLUDE_IM_cedilla;INCLUDE_IM_cyrillic_translit;INCLUDE_IM_ime;INCLUDE_IM_inuktitut;INCLUDE_IM_ipa;INCLUDE_IM_multipress;INCLUDE_IM_thai;INCLUDE_IM_ti_er;INCLUDE_IM_ti_et;INCLUDE_IM_viqr</GtkIncludedImmodulesDefines>
     
<GtkDefines>GTK_COMPILATION;G_LOG_DOMAIN="Gtk";GTK_HOST="i686-pc-vs$(VSVer)";GTK_PRINT_BACKENDS="file";GTK_PRINT_BACKEND_ENABLE_UNSUPPORTED;$(GtkIncludedImmodulesDefines);GTK_LIBDIR="$(GtkDummyPrefix)/lib";GTK_DATADIR="$(GtkDummyPrefix)/share";GTK_DATA_PREFIX="$(GtkDummyPrefix)";GTK_SYSCONFDIR="$(GtkDummyPrefix)/etc";MULTIPRESS_CONFDIR="$(GtkDummyPrefix)/etc/gtk-$(ApiVersion)";MULTIPRESS_LOCALEDIR="$(GtkDummyPrefix)/share/locale";GTK_VERSION="$(GtkVersion)/etc";GTK_BINARY_VERSION="$(GtkBinaryVersion)/etc";GDK_DISABLE_DEPRECATED;ISOLATION_AWARE_ENABLED</GtkDefines>
-    <GtkGdkCommonLibs>pangowin32-1.0.lib;fribidi.lib;imm32.lib</GtkGdkCommonLibs>
+    <CommonARM64SystemLibs Condition="'$(VisualStudioVersion)|$(Platform)' == 
'15.0|arm64'">ole32.lib;advapi32.lib;shell32.lib;gdi32.lib</CommonARM64SystemLibs>
+    <GtkGdkCommonLibs>pangowin32-1.0.lib;fribidi.lib;imm32.lib;$(CommonARM64SystemLibs)</GtkGdkCommonLibs>
     <GdkAdditionalLibs>winmm.lib;dwmapi.lib;setupapi.lib;$(GtkGdkCommonLibs)</GdkAdditionalLibs>
     <GdkBroadwayAdditionalLibs>ws2_32.lib</GdkBroadwayAdditionalLibs>
     <GtkAdditionalLibs>atk-1.0.lib;winspool.lib;comctl32.lib;$(GtkGdkCommonLibs)</GtkAdditionalLibs>
@@ -43,6 +44,9 @@ nmake -f gtk-introspection-msvc.mak CFG=$(Configuration) PREFIX=$(GlibEtcInstall
     </Link>
   </ItemDefinitionGroup>
   <ItemGroup>
+    <BuildMacro Include="CommonARM64SystemLibs">
+      <Value>$(CommonARM64SystemLibs)</Value>
+    </BuildMacro>
     <BuildMacro Include="GtkBinaryVersion">
       <Value>$(GtkBinaryVersion)</Value>
     </BuildMacro>
diff --git a/win32/vs15/Directory.Build.props b/win32/vs15/Directory.Build.props
new file mode 100644
index 0000000000..70e8617358
--- /dev/null
+++ b/win32/vs15/Directory.Build.props
@@ -0,0 +1,5 @@
+<Project>
+  <PropertyGroup Label="Globals">
+    <WindowsTargetPlatformVersion Condition="'$(Platform)' == 
'arm64'">10.0.19041.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+</Project>
diff --git a/win32/vs15/Makefile.am b/win32/vs15/Makefile.am
index c9f0429f13..a921879d3e 100644
--- a/win32/vs15/Makefile.am
+++ b/win32/vs15/Makefile.am
@@ -1,6 +1,6 @@
 include $(top_srcdir)/Makefile.decl
 
-EXTRA_DIST +=  \
+EXTRA_DIST_COPIED =    \
        README.txt      \
        gtk+.sln        \
        gtk3-prebuild.vcxproj   \
@@ -40,7 +40,9 @@ EXTRA_DIST += \
        gtk3-install.props      \
        gtk3-version-paths.props
 
-DISTCLEANFILES = $(EXTRA_DIST)
+EXTRA_DIST += $(EXTRA_DIST_COPIED) Directory.build.props
+
+DISTCLEANFILES = $(EXTRA_DIST_COPIED)
 
 MSVC_VER = 15
 MSVC_VER_LONG = 15


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]