Files
opencv_gst_samples/opencv-sample-apps/Rules.mk
svcmobrel-release d90bed3829 Updating prebuilts and/or headers
f033de710a45790f16c7a2c1b693a1950187d084 - opencv-sample-apps/README
78f8540a5b70d8f6f33af45dce451967e058c457 - opencv-sample-apps/opencv_camera/Makefile
db64c69a108016f4caa0562a86a9316933453ae6 - opencv-sample-apps/opencv_camera/opencv_gst_camera.cpp
b04f70bbeeeb21aaedc10c2c3560b643bc005ea9 - opencv-sample-apps/opencv_encoder/Makefile
afd48b88d80c0e8dd65329a0a0192ef0a3c83e7f - opencv-sample-apps/opencv_encoder/opencv_gst_encoder.cpp
c15cb929e1a9a8fb03830c5ece6b68ea773ce687 - opencv-sample-apps/opencv_decoder/Makefile
ebb52673c89af5c951ca7e62d7fa49f1700b18a6 - opencv-sample-apps/opencv_decoder/opencv_gst_decoder.cpp

Change-Id: I1d5ac78c1f3e83ac7d7292075ffd777660ec1056
2025-08-25 10:24:20 -07:00

94 lines
3.4 KiB
Makefile

###############################################################################
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of NVIDIA CORPORATION nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
###############################################################################
# Clear the flags from env
CPPFLAGS :=
LDFLAGS :=
# Verbose flag
ifeq ($(VERBOSE), 1)
AT =
else
AT = @
endif
# ARM ABI of the target platform
ifeq ($(TEGRA_ARMABI),)
TEGRA_ARMABI ?= aarch64-linux-gnu
endif
# Location of the target rootfs
ifeq ($(shell uname -m), aarch64)
TARGET_ROOTFS :=
else
ifeq ($(TARGET_ROOTFS),)
$(error Please specify the target rootfs path if you are cross-compiling)
endif
endif
# Use absolute path for better access from everywhere
TOP_DIR := $(shell pwd | awk '{split($$0, f, "/opencv\-sample\-apps"); print f[1]}')
ifeq ($(shell uname -m), aarch64)
CROSS_COMPILE :=
else
CROSS_COMPILE ?= aarch64-unknown-linux-gnu-
endif
AS = $(AT) $(CROSS_COMPILE)as
LD = $(AT) $(CROSS_COMPILE)ld
CC = $(AT) $(CROSS_COMPILE)gcc
CPP = $(AT) $(CROSS_COMPILE)g++
AR = $(AT) $(CROSS_COMPILE)ar
NM = $(AT) $(CROSS_COMPILE)nm
STRIP = $(AT) $(CROSS_COMPILE)strip
OBJCOPY = $(AT) $(CROSS_COMPILE)objcopy
OBJDUMP = $(AT) $(CROSS_COMPILE)objdump
# Specify the logical root directory for headers and libraries.
ifneq ($(TARGET_ROOTFS),)
CPPFLAGS += --sysroot=$(TARGET_ROOTFS)
LDFLAGS += \
-Wl,-rpath-link=$(TARGET_ROOTFS)/usr/lib \
-Wl,-rpath-link=$(TARGET_ROOTFS)/lib/$(TEGRA_ARMABI) \
-Wl,-rpath-link=$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)/gstreamer-1.0
endif
# All common header files
CPPFLAGS += -std=c++11 \
-I"$(TARGET_ROOTFS)/usr/include/$(TEGRA_ARMABI)" \
-I"$(TARGET_ROOTFS)/usr/include/opencv4"
# All common dependent libraries
LDFLAGS += \
-lpthread -lopencv_core -lopencv_highgui -lopencv_videoio -lopencv_imgproc \
-L"$(TARGET_ROOTFS)/usr/lib" \
-L"$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)" \
-L"$(TARGET_ROOTFS)/usr/lib/$(TEGRA_ARMABI)/gstreamer-1.0"