summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRama Krishnan Raghupathy <ramarag@microsoft.com>2016-03-08 18:26:13 -0800
committerRama Krishnan Raghupathy <ramarag@microsoft.com>2016-03-09 14:27:22 -0800
commitb8f570dc3028cab153fb6a007ba8d24abb4e1fd3 (patch)
treeb1dd1ed93d3d512ea0dd902f31da9cd7ee78443e /tests
parentd2ab1fbd40343e01fcb71fb9793ee7c681eeb1de (diff)
downloadcoreclr-b8f570dc3028cab153fb6a007ba8d24abb4e1fd3.tar.gz
coreclr-b8f570dc3028cab153fb6a007ba8d24abb4e1fd3.tar.bz2
coreclr-b8f570dc3028cab153fb6a007ba8d24abb4e1fd3.zip
Enable native test binaries to be built for Arm64
Diffstat (limited to 'tests')
-rw-r--r--tests/CMakeLists.txt17
-rw-r--r--tests/buildtest.cmd21
-rw-r--r--tests/src/Interop/common/xplatform.h5
3 files changed, 39 insertions, 4 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 119266c2f4..813d97342c 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -12,6 +12,23 @@ set(CMAKE_SHARED_LINKER_FLAGS_CHECKED "")
set(INC_PLATFORM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/Common/Platform)
if (WIN32)
add_definitions(-DWINDOWS=1)
+
+ if (DEFINED ENV{__ToolsetDir})
+ # Hack for private Tool Set
+ # CMAKE_CXX_COMPILER will default to the compiler installed with
+ # Visual studio. Overwrite it to the compiler on the path.
+
+ find_program(PATH_CXX_COMPILER cl)
+ set(CMAKE_CXX_COMPILER ${PATH_CXX_COMPILER})
+
+ message("Overwriting the CMAKE_CXX_COMPILER.")
+ message("CMAKE_CXX_COMPILER found:${CMAKE_CXX_COMPILER}")
+
+ # Temporary until cmake has VS generators for hacky toolsets [arm64]
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
+ set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:${CLR_CMAKE_TARGET_ARCH}")
+ endif()
endif()
# Compile options
diff --git a/tests/buildtest.cmd b/tests/buildtest.cmd
index cdb3948f0d..eb92ee6d6d 100644
--- a/tests/buildtest.cmd
+++ b/tests/buildtest.cmd
@@ -96,7 +96,7 @@ set "__TestBinDir=%__TestRootDir%\%__BuildOS%.%__BuildArch%.%__BuildType%"
if not defined __TestIntermediateDir (
set "__TestIntermediateDir=tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
)
-set "__NativeTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDirDir%\Native"
+set "__NativeTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Native"
set "__ManagedTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Managed"
:: Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
@@ -181,6 +181,11 @@ setlocal EnableDelayedExpansion
echo %__MsgPrefix%Commencing build of native test components for %__BuildArch%/%__BuildType%
+if defined __ToolsetDir (
+ echo %__MsgPrefix%ToolsetDir is defined to be :%__ToolsetDir%
+ goto GenVSSolution :: Private ToolSet is Defined
+)
+
:: Set the environment for the native build
echo %__MsgPrefix%Using environment: "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" %__VCBuildArch%
call "%__VSToolsRoot%\..\..\VC\vcvarsall.bat" x86_amd64
@@ -192,7 +197,8 @@ if not defined VSINSTALLDIR (
)
if not exist "%VSINSTALLDIR%DIA SDK" goto NoDIA
-echo %__MsgPrefix%Regenerating the Visual Studio solution
+:GenVSSolution
+echo %__MsgPrefix%Regenerating the Visual Studio solution in %__NativeTestIntermediatesDir%
pushd "%__NativeTestIntermediatesDir%"
call "%__SourceDir%\pal\tools\gen-buildsys-win.bat" "%__ProjectFilesDir%\" %__VSVersion% %__BuildArch%
@@ -204,10 +210,17 @@ if not exist "%__NativeTestIntermediatesDir%\install.vcxproj" (
exit /b 1
)
+set __msbuildNativeArgs=%__msbuildCleanBuildArgs% /p:Configuration=%__BuildType%
+
+if defined __ToolsetDir (
+ set __msbuildNativeArgs=%__msbuildNativeArgs% /p:UseEnv=true
+) else (
+ set __msbuildNativeArgs=%__msbuildNativeArgs% /p:Platform=%__BuildArch%
+)
+
set __BuildLogRootName=Tests_Native
-call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" %__msbuildCleanBuildArgs% /p:Configuration=%__BuildType% /p:Platform=%__BuildArch%
+call :msbuild "%__NativeTestIntermediatesDir%\install.vcxproj" %__msbuildNativeArgs%
if errorlevel 1 exit /b 1
-
REM endlocal to rid us of environment changes from vcvarsall.bat
endlocal
diff --git a/tests/src/Interop/common/xplatform.h b/tests/src/Interop/common/xplatform.h
index 3d30f0b75b..e830327bc9 100644
--- a/tests/src/Interop/common/xplatform.h
+++ b/tests/src/Interop/common/xplatform.h
@@ -30,6 +30,11 @@
// dllexport
#if defined _WIN32
#define DLL_EXPORT __declspec(dllexport)
+
+#ifndef snprintf
+#define snprintf _snprintf
+#endif //snprintf
+
#else //!_Win32
#if __GNUC__ >= 4
#define DLL_EXPORT __attribute__ ((visibility ("default")))