[Linux] Fix cross-architecture component build configuration for ARM32-target (#8687)
authorHyeongseok Oh <hseok82.oh@samsung.com>
Fri, 23 Dec 2016 13:18:32 +0000 (22:18 +0900)
committerJan Vorlicek <janvorli@microsoft.com>
Fri, 23 Dec 2016 13:18:32 +0000 (14:18 +0100)
* fix CMakeLists.txt for palrt

* Modify CMakeLists.txt for cross-architecture component configuaration

Add coreclrpal project to fix a dependency issue when CMake configuration

* Allow only x64-host/arm-target for linux

allow x64-host/arm-target only, because pal is not stable for x86 now

* Update build.sh

delete NumProc=1 (inserted for debugging)

* Change x64-host to x86-host for arm-target

JIT correctness problem,
and fix CMake configuration for x86 in pal

* Fix type

* Update CMakeLists.txt

* fix style

* Set x86 when arm-target/x64-host

* fix typo

CMakeLists.txt
functions.cmake
src/pal/CMakeLists.txt
src/pal/src/CMakeLists.txt
src/palrt/CMakeLists.txt

index 61c689b..2c39780 100644 (file)
@@ -129,7 +129,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Linux)
     set(CLR_CMAKE_PLATFORM_UNIX 1)
     if(CLR_CROSS_COMPONENTS_BUILD)
         # CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
-        if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
+        if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
             if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm")
                 set(CLR_CMAKE_PLATFORM_UNIX_X86 1)
             else()
@@ -549,12 +549,10 @@ if(CLR_CMAKE_PLATFORM_UNIX)
 endif(CLR_CMAKE_PLATFORM_UNIX)
 
 if(CLR_CMAKE_PLATFORM_UNIX)
-  add_subdirectory(src/ToolBox/SOS/lldbplugin)
-  if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
+    add_subdirectory(src/ToolBox/SOS/lldbplugin)
     add_subdirectory(src/pal)
-  endif(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
-  add_subdirectory(src/coreclr/hosts)
-  add_subdirectory(src/ildasm/unixcoreclrloader)
+    add_subdirectory(src/coreclr/hosts)
+    add_subdirectory(src/ildasm/unixcoreclrloader)
 endif(CLR_CMAKE_PLATFORM_UNIX)
 
 # Add this subdir. We install the headers for the jit.
index e1a9abb..f2c52da 100644 (file)
@@ -2,7 +2,7 @@ function(clr_unknown_arch)
     if (WIN32)
         message(FATAL_ERROR "Only AMD64, ARM64, ARM and I386 are supported")
     elseif(CLR_CROSS_COMPONENTS_BUILD)
-        message(FATAL_ERROR "Only AMD64, I386 are supported for cross-architecture component")
+        message(FATAL_ERROR "Only AMD64, I386 host are supported for linux cross-architecture component")
     else()
         message(FATAL_ERROR "Only AMD64, ARM64 and ARM are supported")
     endif()
index cb8b055..8e3228b 100644 (file)
@@ -5,7 +5,7 @@ project(COREPAL)
 if (WIN32)
   set(FEATURE_EVENT_TRACE 1)
 endif()
-if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_PLATFORM_ARCH_AMD64)
+if(CLR_CMAKE_PLATFORM_LINUX AND CLR_CMAKE_TARGET_ARCH_AMD64)
   set(FEATURE_EVENT_TRACE 1)
 endif()
 
index 28ee83a..f5f3d40 100644 (file)
@@ -23,20 +23,37 @@ include_directories(include)
 
 # Compile options
 
-if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
-  set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
-  add_definitions(-D_AMD64_)
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
-  set(PAL_CMAKE_PLATFORM_ARCH_ARM 1)
-  add_definitions(-D_ARM_)
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
-  set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
-  add_definitions(-D_ARM64_)
-elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
-  set(CLR_CMAKE_PLATFORM_ARCH_I386 1)
-  add_definitions(-D_X86_)
+if(CLR_CROSS_COMPONENTS_BUILD)
+    if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
+        if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm")
+            set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
+            add_definitions(-D_X86_)
+        else()
+            set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
+            add_definitions(-D_AMD64_)
+        endif()
+    elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
+        set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
+        add_definitions(-D_X86_)
+    else()
+        message(FATAL_ERROR "Only AMD64, I386 host for cross-architecture component is supported")
+    endif()
 else()
-  message(FATAL_ERROR "Only ARM and AMD64 is supported")
+    if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL AMD64)
+        set(PAL_CMAKE_PLATFORM_ARCH_AMD64 1)
+        add_definitions(-D_AMD64_)
+    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
+        set(PAL_CMAKE_PLATFORM_ARCH_ARM 1)
+        add_definitions(-D_ARM_)
+    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
+        set(PAL_CMAKE_PLATFORM_ARCH_ARM64 1)
+        add_definitions(-D_ARM64_)
+    elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
+        set(PAL_CMAKE_PLATFORM_ARCH_I386 1)
+        add_definitions(-D_X86_)
+    else()
+        message(FATAL_ERROR "Only ARM, AMD64, ARM64 and I386 is supported")
+    endif()
 endif()
 
 if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
@@ -65,7 +82,7 @@ elseif(PAL_CMAKE_PLATFORM_ARCH_ARM)
 elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
   add_definitions(-DBIT64=1)
   add_definitions(-D_WIN64=1)
-elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+elseif(PAL_CMAKE_PLATFORM_ARCH_I386)
   add_definitions(-DBIT32=1)
 endif()
 
@@ -105,7 +122,7 @@ elseif(PAL_CMAKE_PLATFORM_ARCH_ARM64)
     arch/arm64/exceptionhelper.S
     arch/arm64/processor.cpp
   )
-elseif(CLR_CMAKE_PLATFORM_ARCH_I386)
+elseif(PAL_CMAKE_PLATFORM_ARCH_I386)
   set(ARCH_SOURCES
     arch/i386/context2.S
     arch/i386/debugbreak.S
index 0b3397a..e19b55d 100644 (file)
@@ -23,4 +23,4 @@ add_library_clr(palrt
 )
 
 # Install the static PAL library for VS
-install (TARGETS palrt DESTINATION lib)
+_install (TARGETS palrt DESTINATION lib)