cmake: initial cross-compilation support 15/16815/7
authorDamjan Marion <damarion@cisco.com>
Mon, 14 Jan 2019 23:36:03 +0000 (00:36 +0100)
committerDave Barach <openvpp@barachs.net>
Thu, 17 Jan 2019 20:43:27 +0000 (20:43 +0000)
Change-Id: Ib9c2aba1eda08a22465441e33553b9b744c79d56
Signed-off-by: Damjan Marion <damarion@cisco.com>
src/CMakeLists.txt
src/cmake/cpu.cmake
src/plugins/dpdk/CMakeLists.txt
src/vpp-api/python/CMakeLists.txt

index fedf931..b404b50 100644 (file)
@@ -32,6 +32,16 @@ execute_process(
 string(REPLACE "-" ";" VPP_LIB_VERSION ${VPP_VERSION})
 list(GET VPP_LIB_VERSION 0 VPP_LIB_VERSION)
 
+##############################################################################
+# cross compiling
+##############################################################################
+if(CMAKE_CROSSCOMPILING)
+  set(CMAKE_IGNORE_PATH
+    /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/
+    /usr/lib/${CMAKE_HOST_SYSTEM_PROCESSOR}-linux-gnu/lib/
+  )
+endif()
+
 ##############################################################################
 # build config
 ##############################################################################
@@ -123,6 +133,7 @@ pr("VPP library version" "${VPP_LIB_VERSION}")
 pr("GIT toplevel dir" "${VPP_GIT_TOPLEVEL_DIR}")
 pr("C flags" "${CMAKE_C_FLAGS}")
 pr("Linker flags" "${CMAKE_LINKER_FLAGS}")
+pr("Host processor" "${CMAKE_HOST_SYSTEM_PROCESSOR}")
 pr("Target processor" "${CMAKE_SYSTEM_PROCESSOR}")
 pr("Build type" "${CMAKE_BUILD_TYPE}")
 pr("Prefix path" "${CMAKE_PREFIX_PATH}")
index 20dab7b..b2af1aa 100644 (file)
 ##############################################################################
 # Cache line size detection
 ##############################################################################
-if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
+if(CMAKE_CROSSCOMPILING)
+  message(STATUS "Cross-compiling - cache line size detection disabled")
+  set(VPP_LOG2_CACHE_LINE_SIZE 6)
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*)")
   file(READ "/proc/cpuinfo" cpuinfo)
   string(REPLACE "\n" ";" cpuinfo ${cpuinfo})
   foreach(l ${cpuinfo})
index 45605ba..36a369c 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+if (CMAKE_CROSSCOMPILING)
+  # not supported yet
+  return()
+endif()
+
 ##############################################################################
 # Find lib and include files
 ##############################################################################
index 52215cc..a81a6f6 100644 (file)
@@ -12,7 +12,6 @@
 # limitations under the License.
 
 find_package(PythonInterp 2.7)
-find_package(PythonLibs 2.7)
 
 if(PYTHONINTERP_FOUND)
   install(