summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2019-01-15 00:36:03 +0100
committerDave Barach <openvpp@barachs.net>2019-01-17 20:43:27 +0000
commitdd3952923a2cfb9fa2276a4f1f6512ff75e1a155 (patch)
tree6065513bac01b665c1925d31cf8b7d982ac9acd5 /src
parent58a93e8ef288b0bae75ec7186ba96bdcaf85d0d4 (diff)
cmake: initial cross-compilation support
Change-Id: Ib9c2aba1eda08a22465441e33553b9b744c79d56 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt11
-rw-r--r--src/cmake/cpu.cmake5
-rw-r--r--src/plugins/dpdk/CMakeLists.txt5
-rw-r--r--src/vpp-api/python/CMakeLists.txt1
4 files changed, 20 insertions, 2 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index fedf931f041..b404b5069b4 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -33,6 +33,16 @@ 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
##############################################################################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@@ -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}")
diff --git a/src/cmake/cpu.cmake b/src/cmake/cpu.cmake
index 20dab7bfce1..b2af1aa0926 100644
--- a/src/cmake/cpu.cmake
+++ b/src/cmake/cpu.cmake
@@ -14,7 +14,10 @@
##############################################################################
# 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})
diff --git a/src/plugins/dpdk/CMakeLists.txt b/src/plugins/dpdk/CMakeLists.txt
index 45605baada0..36a369c0a7b 100644
--- a/src/plugins/dpdk/CMakeLists.txt
+++ b/src/plugins/dpdk/CMakeLists.txt
@@ -11,6 +11,11 @@
# 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
##############################################################################
diff --git a/src/vpp-api/python/CMakeLists.txt b/src/vpp-api/python/CMakeLists.txt
index 52215ccafec..a81a6f66f63 100644
--- a/src/vpp-api/python/CMakeLists.txt
+++ b/src/vpp-api/python/CMakeLists.txt
@@ -12,7 +12,6 @@
# limitations under the License.
find_package(PythonInterp 2.7)
-find_package(PythonLibs 2.7)
if(PYTHONINTERP_FOUND)
install(