Skip to content

Commit

Permalink
lib: enable non ARM build for libs
Browse files Browse the repository at this point in the history
Enable non ARM builds for libs and apps. When the platform is not ARM,
the build is treated as host build and only the libs & apps required to
be run on host would be build. If the platform is ARM but the build is
for host, then the new option ('enable_host_build') can be used.

Signed-off-by: Anoob Joseph <[email protected]>
Change-Id: I49c9f46e4aac1c4f5e418dc559e46fab6550b43b
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/142460
Tested-by: sa_ip-toolkits-Jenkins <[email protected]>
(cherry picked from commit 17176230fabdce37503f6c62e35e29c50707e182)
Reviewed-on: https://sj1git1.cavium.com/c/IP/SW/dataplane/dpu-offload/+/143762
Reviewed-by: Jerin Jacob <[email protected]>
  • Loading branch information
anoobj authored and jerinjacobk committed Jan 22, 2025
1 parent 747e81c commit 841e427
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 16 deletions.
4 changes: 4 additions & 0 deletions app/ovs-offload/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# Application Sources
sources = []

if host_build
skip_app = true
endif

# Include directories
includes += include_directories(['include'])

Expand Down
4 changes: 4 additions & 0 deletions app/smart-nic/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# Application Sources
sources = []

if host_build
skip_app = true
endif

# Include directories
includes += include_directories(['include'])

Expand Down
8 changes: 5 additions & 3 deletions doc/guides/gsg/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ documentation will be built by default.

Meson Options
-------------
- kernel_dir: Path to the kernel for building kernel modules (octep_vdpa).
- **kernel_dir**: Path to the kernel for building kernel modules (octep_vdpa).
Headers must be in $kernel_dir.
- dma_stats: Enable DMA statistics for DAO library
- virtio_debug: Enable virtio debug that perform descriptor validation, etc.
- **dma_stats**: Enable DMA statistics for DAO library
- **virtio_debug**: Enable virtio debug that perform descriptor validation, etc.
- **enable_host_build**: Enable the host build for the DAO library. This option
compiles only the components necessary for the host environment.
20 changes: 13 additions & 7 deletions lib/common/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,19 @@ configure_file(
install_dir: '.'
)

sources = files(
'dma.c',
'dao_bitmap.c',
'dao_log.c',
'dao_util.c',
'dao_dynamic_string.c'
)
if host_build
sources = files(
'dao_log.c',
)
else
sources = files(
'dma.c',
'dao_bitmap.c',
'dao_log.c',
'dao_util.c',
'dao_dynamic_string.c'
)
endif

headers = files(
'dao_bitmap.h',
Expand Down
4 changes: 4 additions & 0 deletions lib/featurearc/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

deps += ['common']

if host_build
skip_lib = true
endif

sources = files(
'feature_arc.c'
)
Expand Down
4 changes: 4 additions & 0 deletions lib/flow/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2024 Marvell.

if host_build
skip_lib = true
endif

sources = files(
'dao_flow.c',
'flow_acl.c',
Expand Down
4 changes: 4 additions & 0 deletions lib/netlink/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ if not DAO_BUILD_CONF.has('DAO_LIBNL_DEP')
subdir_done()
endif

if host_build
skip_lib = true
endif

deps += ['common']

sources = files(
Expand Down
4 changes: 4 additions & 0 deletions lib/pal/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2024 Marvell.

if host_build
skip_lib = true
endif

sources = files(
'dao_pal.c',
)
Expand Down
4 changes: 4 additions & 0 deletions lib/pem/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2023 Marvell.

if host_build
skip_lib = true
endif

sources = files(
'pem.c',
'sdp.c'
Expand Down
4 changes: 4 additions & 0 deletions lib/portgroup/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2023 Marvell.

if host_build
skip_lib = true
endif

deps += ['common']

sources = files(
Expand Down
4 changes: 4 additions & 0 deletions lib/vfio/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2024 Marvell.

if host_build
skip_lib = true
endif

sources = files(
'dao_vfio_platform.c'
)
Expand Down
4 changes: 4 additions & 0 deletions lib/virtio/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-Proprietary
# Copyright (c) 2023 Marvell.

if host_build
skip_lib = true
endif

sources = files(
'virtio_dev.c',
'virtio_mbox.c',
Expand Down
4 changes: 4 additions & 0 deletions lib/virtio_net/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-Proprietary
# Copyright (c) 2023 Marvell.

if host_build
skip_lib = true
endif

sources = files(
'virtio_net_deq.c',
'virtio_net_enq.c',
Expand Down
4 changes: 4 additions & 0 deletions lib/workers/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# SPDX-License-Identifier: Marvell-MIT
# Copyright (c) 2023 Marvell.

if host_build
skip_lib = true
endif

deps += ['common']

sources = files(
Expand Down
19 changes: 13 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ DAO_STATIC_LIBS = []
DAO_MODULES_ENABLED = []
DAO_MODULES_DISABLED = []

host_build = false
if (get_option('enable_host_build'))
host_build = true
endif

# If CPU is not ARM, treat as host build
if host_machine.cpu_family() != 'aarch64'
host_build = true
endif

dpdk_version = run_command(find_program('cat', 'more'),
files('DPDK_VERSION'), check: true).stdout().strip()
Expand All @@ -33,12 +42,10 @@ subdir('dep')
subdir('config')

# Mandatory dependency
if host_machine.cpu_family() == 'aarch64'
if DAO_BUILD_CONF.has('DAO_LIBDPDK_DEP')
subdir('lib')
subdir('app')
subdir('tests')
endif
if DAO_BUILD_CONF.has('DAO_LIBDPDK_DEP')
subdir('lib')
subdir('app')
subdir('tests')
endif

doxygen = find_program('doxygen', required: false)
Expand Down
2 changes: 2 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ option('platform', type: 'string', value: 'native', description:
'Platform to build.')
option('enable_kmods', type: 'boolean', value: true, description:
'build kernel modules')
option('enable_host_build', type: 'boolean', value: false, description:
'Build DAO packages required for host only.')

0 comments on commit 841e427

Please sign in to comment.