ICU-20782 Add support for cross-compiling Windows ARM/ARM64 data DLL from the x64 bits.

This commit is contained in:
Jeff Genovy 2019-08-20 21:52:06 -07:00
parent 408752ec49
commit f7abe8c1c1

View file

@ -71,6 +71,7 @@ ICUSRCDATA_RELATIVE_PATH=..\..\..
# Timestamp files to keep track of current build state
TOOLS_TS=$(ICUTMP)\tools.timestamp
COREDATA_TS=$(ICUTMP)\coredata.timestamp
ARM_CROSSBUILD_TS=
# ICUCOL
# The directory that contains colfiles.mk files along with *.txt collation data files
@ -115,6 +116,7 @@ DLL_OUTPUT=$(ICUP)\bin32$(UWP)
!ELSE
DLL_OUTPUT=$(ICUP)\bin$(UWP)
!ENDIF
!MESSAGE ICU data DLL_OUTPUT path is $(DLL_OUTPUT)
#
# TESTDATA
@ -140,19 +142,37 @@ TESTDATABLD=$(ICUP)\source\test\testdata\out\build
ICUTOOLS=$(ICUP)\source\tools
!MESSAGE ICU tools path is $(ICUTOOLS)
# ARM_CROSS_BUILD
# In order to support cross-compiling for ARM/ARM64 using the x64 tools
# we need to know if we're building the ARM/ARM64 data DLL, otherwise
# the existence of the x64 bits will cause us to think we are already done.
# Note: This is only for the "regular" builds, the UWP builds have a separate project file entirely.
ARM_CROSS_BUILD=
!IF "$(UWP)" == ""
!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug"
ARM_CROSS_BUILD=ARM
ARM_CROSSBUILD_TS=$(ICUTMP)\$(ARM_CROSS_BUILD).timestamp
!ELSE IF "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug"
ARM_CROSS_BUILD=ARM64
ARM_CROSSBUILD_TS=$(ICUTMP)\$(ARM_CROSS_BUILD).timestamp
!ENDIF
!ENDIF
#
# TOOLS CFG PATH
# Generally the tools want to run on the same architechure as is being built.
# Generally the tools want to run on the same architecture as is being built.
# Thus ARM and ARM64 need to use another build of the other tools, so make sure to get an usable cfg path.
# Since tools, particularly pkggen, have architecture built-in, we made x64 on
# Windows be machine-independent and use those tools.
#
!IF "$(ARM_CROSS_BUILD)" == ""
CFGTOOLS=$(CFG)
!IF "$(CFG)" == "ARM\Release" || "$(CFG)" == "ARM\Debug" || "$(CFG)" == "ARM64\Release" || "$(CFG)" == "ARM64\Debug"
!ELSE
CFGTOOLS=x64\Release
!ENDIF
!MESSAGE ICU tools CFG subpath is $(CFGTOOLS)
# The current ICU tools need to be in the path first.
# x86 uses x86; x64, arm, and arm64 use x64
!IF "$(CFG)" == "x86\Release" || "$(CFG)" == "x86\Debug"
@ -210,6 +230,7 @@ COMMON_ICUDATA_ARGUMENTS=$(COMMON_ICUDATA_ARGUMENTS) -a ARM64
# Building the common dll in $(ICUBLD_PKG) unconditionally copies it to $(DLL_OUTPUT) too.
#
#############################################################################
!IF "$(ARM_CROSS_BUILD)" == ""
ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
@echo All targets are up to date
@ -218,6 +239,11 @@ ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
copy "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat" "$(ICUMAKE)\..\..\commondata\"
!ENDIF
!ELSE
ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat" $(ARM_CROSSBUILD_TS)
@echo All targets are up to date
!ENDIF
# Three main targets: tools, core data, and test data.
# Keep track of whether they are built via timestamp files.
@ -385,6 +411,18 @@ icu4j-data-install :
-@erase "$(ICUTMP)\$(ICUPKG).dat"
!ENDIF
"$(ARM_CROSSBUILD_TS)" : $(COMMON_ICUDATA_DEPENDENCIES) "$(ICU_LIB_TARGET)"
@echo Building ICU data for "$(ARM_CROSS_BUILD)" from x64
cd "$(ICUBLD_PKG)"
"$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) $(ICUTMP)\icudata.lst
-@erase "$(ICU_LIB_TARGET)"
@if not exist "$(DLL_OUTPUT)" mkdir "$(DLL_OUTPUT)"
copy "$(U_ICUDATA_NAME).dll" "$(ICU_LIB_TARGET)"
-@erase "$(U_ICUDATA_NAME).dll"
copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
-@erase "$(ICUTMP)\$(ICUPKG).dat"
@echo "timestamp" > $(ARM_CROSSBUILD_TS)
# utility target to create missing directories
# Most directories are made by Python, but still create ICUTMP
# so it works in the source archive