Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.

Commit be22dbb

Browse files
committed
CMakeLists: Introduce AMD64 (to fix x86_64/--native 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 "AMD64" cmake flag, that's set in the `buildme` script only when compiling for x86_64. Signed-off-by: Florian Klink <[email protected]>
1 parent 093b30b commit be22dbb

File tree

5 files changed

+24
-10
lines changed

5 files changed

+24
-10
lines changed

CMakeLists.txt

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ SET(PROJECT_VER_PATCH 0)
88
SET(PROJECT_VER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
99
SET(PROJECT_APIVER "${PROJECT_VER}")
1010

11-
if(ARM64)
12-
set(BUILD_MMAL FALSE)
13-
set(BUILD_MMAL_APPS FALSE)
14-
else()
11+
# This project is traditionally expecting to be compiled on armv6,7.
12+
# Due to CMake limitations, if the platform (in the host/platform/target
13+
# triplet) this is compiled for differs from that, one of the following targets
14+
# need to be set:
15+
# -DARM64=ON (if compiling for aarch64)
16+
# -DAMD64=ON (if compiling for x86_64)
17+
18+
# broken on anything except ARM32 currently
19+
if(NOT ARM64 AND NOT AMD64)
1520
set(BUILD_MMAL TRUE)
1621
set(BUILD_MMAL_APPS TRUE)
22+
else()
23+
set(BUILD_MMAL FALSE)
24+
set(BUILD_MMAL_APPS FALSE)
1725
endif()
26+
1827
set(vmcs_root ${PROJECT_SOURCE_DIR})
1928
get_filename_component(VIDEOCORE_ROOT . ABSOLUTE)
2029

@@ -66,7 +75,9 @@ endif()
6675
add_subdirectory(interface/vcos)
6776
add_subdirectory(interface/vmcs_host)
6877
add_subdirectory(interface/vchiq_arm)
69-
if(NOT ARM64)
78+
79+
# The khronos libraries include arm32 assembly
80+
if(NOT ARM64 AND NOT AMD64)
7081
add_subdirectory(interface/khronos)
7182
endif()
7283

@@ -82,7 +93,8 @@ if(BUILD_MMAL_APPS)
8293
add_subdirectory(host_applications/android/apps/vidtex)
8394
endif(BUILD_MMAL_APPS)
8495

85-
if(NOT ARM64)
96+
# ARM32 only, as it needs the khronos libraries
97+
if(NOT ARM64 AND NOT AMD64)
8698
add_subdirectory(middleware/openmaxil)
8799
endif()
88100

buildme

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
BUILDTYPE=Release
33
ARCH=$(uname -m)
44
ARM64=OFF
5+
AMD64=OFF
56
CMAKE_TOOLCHAIN_FILE=../../../makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake
67

78
if [ "$1" = "--debug" ]; then
@@ -33,10 +34,11 @@ if [ $ARCH = "armv6l" ] || [ $ARCH = "armv7l" ] || [ $ARCH = "aarch64" ]; then
3334
sudo make install
3435
fi
3536
elif [ "$1" = "--native" ]; then
37+
AMD64=ON
3638
# Build natively on the host
3739
mkdir -p build/native/$BUILDSUBDIR
3840
pushd build/native/$BUILDSUBDIR
39-
cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE ../../..
41+
cmake -DCMAKE_BUILD_TYPE=$BUILDTYPE -DAMD64=$AMD64../../..
4042
shift
4143
make -j `nproc` $*
4244
else

host_applications/linux/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ add_subdirectory(libs/bcm_host)
44
add_subdirectory(apps/gencmd)
55
add_subdirectory(apps/tvservice)
66
add_subdirectory(apps/vcmailbox)
7-
if(NOT ARM64)
7+
if(NOT ARM64 AND NOT AMD64)
88
add_subdirectory(apps/raspicam)
99
add_subdirectory(libs/sm)
1010
add_subdirectory(apps/smem)

host_applications/linux/apps/raspicam/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ set (COMMON_SOURCES
4040
RaspiGPS.c
4141
libgps_loader.c)
4242

43-
if(NOT ARM64)
43+
if(NOT ARM64 AND NOT AMD64)
4444
set (EGL_LIBS brcmGLESv2 brcmEGL)
4545
set (EGL_SOURCES RaspiTex.c RaspiTexUtil.c tga.c)
4646
set (GL_SCENE_SOURCES

interface/vmcs_host/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ add_library(vchostif
1717
#add_library(bufman vc_vchi_bufman.c )
1818
set(INSTALL_TARGETS vchostif)
1919

20-
if(NOT ARM64)
20+
if(NOT ARM64 AND NOT AMD64)
2121
# OpenMAX/IL component service
2222
add_library(vcilcs
2323
vcilcs.c vcilcs_in.c vcilcs_out.c vcilcs_common.c)

0 commit comments

Comments
 (0)