From 3ebe07bdba37d3ff84755793e1c00cc7f0737b83 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 27 Dec 2020 02:49:30 +0100 Subject: [PATCH] CMakeLists: Introduce ARM32 (to fix x86_64 builds) CMakeLists.txt currently assumes everything not ARM64 to be ARM32. When compiling on x86_64-linux, this tries to build some binaries that are arm(32) only. Some tools make some sense to use even on non-ARM workstations. For example, `dtmerge` can be used to merge .dtb files with overlays on a x86_64 machine (while mounting an sdcard for example). This introduces a "ARM32" variable, that's set in the `buildme` script only when compiling for ARM32. Signed-off-by: Florian Klink --- CMakeLists.txt | 17 +++++++++++------ buildme | 6 ++++-- host_applications/linux/CMakeLists.txt | 2 +- .../linux/apps/raspicam/CMakeLists.txt | 2 +- interface/vmcs_host/CMakeLists.txt | 16 ++++++++-------- 5 files changed, 25 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe67fc874..3e6ee7a42 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,13 +8,15 @@ SET(PROJECT_VER_PATCH 0) SET(PROJECT_VER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}") SET(PROJECT_APIVER "${PROJECT_VER}") -if(ARM64) - set(BUILD_MMAL FALSE) - set(BUILD_MMAL_APPS FALSE) -else() +# broken on non-ARM(64) currently +if(ARM32) set(BUILD_MMAL TRUE) set(BUILD_MMAL_APPS TRUE) +else() + set(BUILD_MMAL FALSE) + set(BUILD_MMAL_APPS FALSE) endif() + set(vmcs_root ${PROJECT_SOURCE_DIR}) get_filename_component(VIDEOCORE_ROOT . ABSOLUTE) @@ -66,7 +68,9 @@ endif() add_subdirectory(interface/vcos) add_subdirectory(interface/vmcs_host) add_subdirectory(interface/vchiq_arm) -if(NOT ARM64) + +# The khronos libraries include arm32 assembly +if(ARM32) add_subdirectory(interface/khronos) endif() @@ -82,7 +86,8 @@ if(BUILD_MMAL_APPS) add_subdirectory(host_applications/android/apps/vidtex) endif(BUILD_MMAL_APPS) -if(NOT ARM64) +# ARM32 only, as it needs the khronos libraries +if(ARM32) add_subdirectory(middleware/openmaxil) endif() diff --git a/buildme b/buildme index 9e2d405e1..4197b1579 100755 --- a/buildme +++ b/buildme @@ -1,6 +1,7 @@ #!/bin/bash BUILDTYPE=Release ARCH=$(uname -m) +ARM32=ON ARM64=OFF CMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake @@ -10,6 +11,7 @@ if [ "$1" = "--debug" ]; then fi if [ "$1" = "--aarch64" ]; then + ARM32=OFF ARM64=ON CMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/aarch64-linux-gnu.cmake shift @@ -21,7 +23,7 @@ if [ $ARCH = "armv6l" ] || [ $ARCH = "armv7l" ] || [ $ARCH = "aarch64" ]; then # Native compile on the Raspberry Pi mkdir -p build/raspberry/$BUILDSUBDIR pushd build/raspberry/$BUILDSUBDIR - cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE -DARM64=$ARM64 ../../.. + cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE -DARM32=$ARM32 -DARM64=$ARM64 ../../.. if [ $ARCH = "armv6l" ]; then make else @@ -43,7 +45,7 @@ else # Cross compile on a more capable machine mkdir -p build/arm-linux/$BUILDSUBDIR pushd build/arm-linux/$BUILDSUBDIR - cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=$BUILDTYPE -DARM64=$ARM64 ../../.. + cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOLCHAIN_FILE -DCMAKE_BUILD_TYPE=$BUILDTYPE -DARM32=$ARM32 -DARM64=$ARM64 ../../.. make -j `nproc` if [ "$1" != "" ]; then diff --git a/host_applications/linux/CMakeLists.txt b/host_applications/linux/CMakeLists.txt index 928b63750..5cefee58d 100644 --- a/host_applications/linux/CMakeLists.txt +++ b/host_applications/linux/CMakeLists.txt @@ -4,7 +4,7 @@ add_subdirectory(libs/bcm_host) add_subdirectory(apps/gencmd) add_subdirectory(apps/tvservice) add_subdirectory(apps/vcmailbox) -if(NOT ARM64) +if(ARM32) add_subdirectory(apps/raspicam) add_subdirectory(libs/sm) add_subdirectory(apps/smem) diff --git a/host_applications/linux/apps/raspicam/CMakeLists.txt b/host_applications/linux/apps/raspicam/CMakeLists.txt index eb1ef7c89..e46804e4e 100644 --- a/host_applications/linux/apps/raspicam/CMakeLists.txt +++ b/host_applications/linux/apps/raspicam/CMakeLists.txt @@ -40,7 +40,7 @@ set (COMMON_SOURCES RaspiGPS.c libgps_loader.c) -if(NOT ARM64) +if(ARM32) set (EGL_LIBS brcmGLESv2 brcmEGL) set (EGL_SOURCES RaspiTex.c RaspiTexUtil.c tga.c) set (GL_SCENE_SOURCES diff --git a/interface/vmcs_host/CMakeLists.txt b/interface/vmcs_host/CMakeLists.txt index cbef80c57..bfa03c7ce 100755 --- a/interface/vmcs_host/CMakeLists.txt +++ b/interface/vmcs_host/CMakeLists.txt @@ -17,14 +17,14 @@ add_library(vchostif #add_library(bufman vc_vchi_bufman.c ) set(INSTALL_TARGETS vchostif) -if(NOT ARM64) - # OpenMAX/IL component service - add_library(vcilcs - vcilcs.c vcilcs_in.c vcilcs_out.c vcilcs_common.c) - - # ILCS pulls in EGL for the ILCS/EGL surface API support - target_link_libraries(vcilcs brcmEGL brcmGLESv2 khrn_client vchiq_arm vcos) - set(INSTALL_TARGETS ${INSTALL_TARGETS} vcilcs) +if(ARM32 OR ARM64) + # OpenMAX/IL component service + add_library(vcilcs + vcilcs.c vcilcs_in.c vcilcs_out.c vcilcs_common.c) + + # ILCS pulls in EGL for the ILCS/EGL surface API support + target_link_libraries(vcilcs brcmEGL brcmGLESv2 khrn_client vchiq_arm vcos) + set(INSTALL_TARGETS ${INSTALL_TARGETS} vcilcs) endif() # vchostif needs ilcore as well (vmcs_main pulls it in)