Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
f645865
remove hardcoded makefiles and add workflow testing
sshi-amd Mar 2, 2026
70cfced
Disable MIVisionX OpenCV example
zichguan-amd Feb 3, 2026
4a471ca
Fix Makefile build step: correct GPU arch flag and add cancelled guard
claude Mar 6, 2026
36dc947
Use ROCM_PATH env variable for Makefile ROCm install directory
sshi-amd Mar 10, 2026
8992939
Merge branch 'ROCm:amd-staging' into makefile-testing-v2
sshi-amd Mar 11, 2026
d27b742
fix make command
sshi-amd Mar 17, 2026
4325882
Skip optional libraries in Makefile build when headers are missing
sshi-amd Mar 17, 2026
48b5c3b
Merge branch 'ROCm:amd-staging' into makefile-testing-v2
sshi-amd Mar 17, 2026
ca513dd
Move Makefile build step before CMake in CI workflow
sshi-amd Mar 17, 2026
c74de5c
Fix additional Makefile build failures: RPP and openmp_target
sshi-amd Mar 17, 2026
c66e072
Fix Makefile CI: target correct GPU arch and guard openmp_target
sshi-amd Mar 18, 2026
b1fdafc
Merge branch 'ROCm:amd-staging' into makefile-testing-v2
sshi-amd Mar 18, 2026
eb08d6d
Guard optional Makefile examples behind dependency checks
sshi-amd Mar 18, 2026
0dcca68
Fix Makefile CI: replace pkg-config checks with wildcard header checks
sshi-amd Mar 19, 2026
00f7862
Merge branch 'ROCm:amd-staging' into makefile-testing-v2
sshi-amd Mar 19, 2026
7ca427c
Fix Makefile CI: guard rocDecode behind FFmpeg check, fix pthread link
sshi-amd Mar 19, 2026
ef25293
Add configure phase and Makefile test runner to CI
sshi-amd Mar 19, 2026
b8f2454
Gate code_object_isa_decode behind libdw and amd_comgr checks
sshi-amd Mar 19, 2026
26d6e6d
Improve Makefile test runner output with progress counter
sshi-amd Mar 20, 2026
6c03dc7
Fix Makefile test runner: cd into example dir, add test args support
sshi-amd Mar 20, 2026
94ade5e
Run Makefile tests after ctest, using ctest test list as allow filter
sshi-amd Mar 20, 2026
88c30be
Skip rocdec_decode in Makefile tests (needs CMake test data)
sshi-amd Mar 20, 2026
df9d410
Fix FFmpeg/Vulkan detection: check libraries exist, not just headers
sshi-amd Mar 20, 2026
ca3bc40
Remove header-only fallback for FFmpeg/Vulkan detection
sshi-amd Mar 20, 2026
66e13e6
Fix rocdec_decode build on SLES: use config.mk for FFmpeg detection, …
sshi-amd Mar 20, 2026
3c54d77
Add link-test to configure.sh and require_deps.mk to catch missing -d…
sshi-amd Mar 20, 2026
3baedb6
Improve can_link compiler fallback chain (cc, gcc, clang, ROCm clang)
sshi-amd Mar 20, 2026
82eadf0
Use $(FFMPEG_LIBS) from config.mk instead of hardcoded -lavcodec/-lav…
sshi-amd Mar 20, 2026
1fac6e3
Use ctest JUnit XML results for Makefile test allow list
sshi-amd Mar 23, 2026
d258066
Skip rocprof-systems-basic (too slow) and rocprof-systems-advanced (f…
sshi-amd Mar 23, 2026
f75213c
Fix ctest JUnit XML path: use absolute GITHUB_WORKSPACE path
sshi-amd Mar 23, 2026
2084f9f
Match ctest output format in Makefile test runner
sshi-amd Mar 23, 2026
9638493
Skip hip_calling_global_functions on AlmaLinux 8 (glibc 2.28 too old)
sshi-amd Mar 23, 2026
5344913
Only run Makefile tests for tests that passed in ctest
sshi-amd Mar 23, 2026
c21f235
Update README: document configure.sh and Makefile test runner
sshi-amd Mar 23, 2026
15dd987
Move test summary to end, add Makefile test log uploads
sshi-amd Mar 24, 2026
dabc5d0
Add Makefile build artifact upload
sshi-amd Mar 24, 2026
85b25b3
Add if: !cancelled() guard to Makefile build step
sshi-amd Mar 24, 2026
c88873d
Group build artifact uploads together after both builds complete
sshi-amd Mar 24, 2026
f49e54e
Remove ALWAYS_SKIP_TESTS entries for clean CI validation
sshi-amd Mar 24, 2026
0ca996a
Address review feedback: cleanup, defer Makefile testing
sshi-amd Apr 23, 2026
39bc971
Fix CI: artifact collection crash and AlmaLinux 8 pkg-config
sshi-amd Apr 23, 2026
a7f7a40
Merge upstream/amd-staging into makefile-testing-v2
sshi-amd Apr 23, 2026
1d6fb3a
Fix wrong EXAMPLE name in identifying_host_device_compilation_pass Ma…
sshi-amd Apr 23, 2026
5f24539
update makefile testing documentation
sshi-amd Apr 23, 2026
852d8db
Fix 48 Makefiles using hard ROCM_PATH := /opt/rocm
sshi-amd Apr 23, 2026
d46f741
Fix README.md MD012: collapse double blank line
sshi-amd Apr 23, 2026
199c080
Fix Libraries/rocFFT/multi_gpu/Makefile hard ROCM_PATH
sshi-amd Apr 23, 2026
55fd9f4
Detect -lstdc++fs requirement via Common/find_filesystem.mk
sshi-amd Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions .github/workflows/build-rocm-examples-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:
echo "PATH=${ROCM_PATH}/bin:${ROCM_PATH}/llvm/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/llvm/lib:${ROCM_PATH}/lib/rocprofiler-systems" >> $GITHUB_ENV
echo "ENABLE_OPENMP=OFF" >> $GITHUB_ENV
echo "HIPCC_COMPILE_FLAGS_APPEND=--offload-arch=${{ matrix.gpu_config.gpu_target }}" >> $GITHUB_ENV

- name: Install TheRock tarball
if: ${{ matrix.install_method == 'tarball' }}
Expand Down Expand Up @@ -104,8 +105,15 @@ jobs:
echo "PATH=${ROCM_PATH}/bin:${ROCM_PATH}/llvm/bin:${PATH}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=${ROCM_PATH}/lib:${ROCM_PATH}/llvm/lib:${ROCM_PATH}/lib/rocprofiler-systems" >> $GITHUB_ENV
echo "ENABLE_OPENMP=ON" >> $GITHUB_ENV
echo "HIPCC_COMPILE_FLAGS_APPEND=--offload-arch=${{ matrix.gpu_config.gpu_target }}" >> $GITHUB_ENV

- name: Makefile build
run: |
./Scripts/configure.sh --rocm-path="${ROCM_PATH}"
make -j HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}"

- name: CMake configure
if: ${{ !cancelled() }}
run: |
cmake -S . -B build -DCMAKE_HIP_ARCHITECTURES="${{ matrix.gpu_config.gpu_target }}" -DCMAKE_BUILD_RPATH="${ROCM_PATH}/lib" -DROCM_EXAMPLES_ENABLE_OPENMP="${ENABLE_OPENMP}" 2> >(tee cmake_error.log >&2)

Expand Down Expand Up @@ -141,17 +149,39 @@ jobs:
fi

- name: CMake build
if: ${{ !cancelled() }}
run: |
cmake --build build -j

- name: Upload build artifacts
if: success()
- name: Collect Makefile build artifacts
if: ${{ !cancelled() }}
run: |
mkdir -p /tmp/makefile_build
find . -name Makefile -not -path './build/*' | while IFS= read -r makefile; do
dir=$(dirname "$makefile")
example_name=$(grep '^EXAMPLE := ' "$makefile" 2>/dev/null | head -1 | sed 's/^EXAMPLE := //' || true)
if [ -n "${example_name}" ] && [ -x "${dir}/${example_name}" ]; then
mkdir -p "/tmp/makefile_build/${dir}"
cp "${dir}/${example_name}" "/tmp/makefile_build/${dir}/"
fi
done

- name: Upload CMake build artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: rocm-examples-build-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}-${{ matrix.install_method }}
path: build/

- name: Upload Makefile build artifacts
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: makefile-build-${{ inputs.distro }}-${{ matrix.gpu_config.gpu_target }}-${{ steps.sanity-check.outputs.rocm_version || steps.install-tarball.outputs.rocm_version }}-${{ matrix.install_method }}
path: /tmp/makefile_build/

- name: Run tests
if: ${{ !cancelled() }}
run: |
python3 .github/build_tools/generate_skip_tests.py --target ${{ matrix.gpu_config.gpu_target }} --distro ${{ inputs.distro }}

Expand Down Expand Up @@ -196,7 +226,7 @@ jobs:
echo "<details><summary>Failed tests output</summary>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY

awk '
/^[0-9]+\/[0-9]+ Testing: / { if (inblock && failed) print block; block = $0; inblock = 1; failed = 0; seen_result = 0; next }
inblock { block = block "\n" $0 }
Expand All @@ -205,7 +235,7 @@ jobs:
/^-+$/ { if (inblock && seen_result) { if (failed) print block; inblock = 0 } }
END { if (inblock && failed) print block }
' "${LAST_TEST_LOG}" >> $GITHUB_STEP_SUMMARY

echo '```' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
fi
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
*.pdb
CMakeUserPresets.json
.cline_storage
config.mk
7 changes: 5 additions & 2 deletions Applications/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ EXAMPLES := \
fdtd \
floyd_warshall \
histogram \
prefix_sum \
sobel_filter
prefix_sum

ifneq ($(wildcard /usr/include/GLFW/glfw3.h),)
EXAMPLES += sobel_filter
endif

ifneq ($(GPU_RUNTIME), CUDA)
EXAMPLES += \
Expand Down
16 changes: 14 additions & 2 deletions Applications/sobel_filter/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ COMMON_INCLUDE_DIR := ../../Common
EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# Dependency checking
REQUIRED_DEPS := GLFW3
include $(COMMON_INCLUDE_DIR)/require_deps.mk

ifneq ($(SKIP_BUILD),1)

# HIP variables
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include
Expand All @@ -34,9 +40,9 @@ HIPCXX ?= $(ROCM_PATH)/bin/hipcc
# Common variables and flags
CXX_STD := c++17
ICXXFLAGS := -std=$(CXX_STD)
ICPPFLAGS := -I $(COMMON_INCLUDE_DIR) -I $(EXTERNAL_DIR) $(shell pkg-config --cflags glfw3)
ICPPFLAGS := -I $(COMMON_INCLUDE_DIR) -I $(EXTERNAL_DIR) $(GLFW3_CFLAGS)
ILDFLAGS :=
ILDLIBS := $(shell pkg-config --libs glfw3) -ldl
ILDLIBS := $(GLFW3_LIBS) -ldl

ifeq ($(GPU_RUNTIME), CUDA)
ICXXFLAGS += -x cu
Expand All @@ -63,3 +69,9 @@ clean:
$(RM) $(EXAMPLE)

.PHONY: clean

else
all:
clean:
.PHONY: all clean
endif
43 changes: 43 additions & 0 deletions Common/find_filesystem.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# MIT License
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# Detect whether linking std::experimental::filesystem requires -lstdc++fs.
# Older toolchains (GCC <= 8 / SLES default) ship the implementation in a
# separate static library; GCC >= 9 has it merged into libstdc++ proper.
#
# Mirrors the behavior of Common/FindFilesystem.cmake for the Make build path.
#
# Usage in leaf Makefiles:
# include $(COMMON_INCLUDE_DIR)/find_filesystem.mk
# ...
# ILDLIBS := -lrocdecode ... $(CXX_FS_LIB)
#
# Output variable:
# CXX_FS_LIB - either "-lstdc++fs" or empty.

_FS_OK_BARE := $(shell { echo '#include <experimental/filesystem>'; echo 'int main(){std::experimental::filesystem::path p; return 0;}'; } | $${CXX:-c++} -x c++ -std=c++17 - -o /dev/null 2>/dev/null && echo 1 || echo 0)
ifeq ($(_FS_OK_BARE),0)
_FS_OK_WITH_LIB := $(shell { echo '#include <experimental/filesystem>'; echo 'int main(){std::experimental::filesystem::path p; return 0;}'; } | $${CXX:-c++} -x c++ -std=c++17 - -lstdc++fs -o /dev/null 2>/dev/null && echo 1 || echo 0)
ifeq ($(_FS_OK_WITH_LIB),1)
CXX_FS_LIB := -lstdc++fs
endif
endif
135 changes: 135 additions & 0 deletions Common/require_deps.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# MIT License
#
# Copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

# Dependency checker for rocm-examples Makefile build system
#
# Usage in example Makefiles:
# REQUIRED_DEPS := FFMPEG OPENCV
# include $(COMMON_INCLUDE_DIR)/require_deps.mk
#
# Before including, set COMMON_INCLUDE_DIR (already standard in all examples).
#
# This file works in two modes:
# 1. Fast path: includes config.mk (generated by configure.sh) from the repo root
# 2. Fallback: uses inline pkg-config checks for standalone builds
#
# After including, check SKIP_BUILD. This composes with filter_hip_architectures.mk
# which also sets SKIP_BUILD.
#
# Output variables:
# SKIP_BUILD - set to 1 if any required dependency is missing
# MISSING_DEPS - list of missing dependency names

# Locate the repository root relative to COMMON_INCLUDE_DIR
_REPO_ROOT := $(dir $(COMMON_INCLUDE_DIR))

# Try to include the pre-generated config.mk (silent if absent)
-include $(_REPO_ROOT)/config.mk

# If config.mk was not found, run inline fallback detection.
# We detect this by checking if HAVE_FFMPEG is defined (it's always written by configure.sh).
ifndef HAVE_FFMPEG
# Fallback: detect dependencies via pkg-config / file existence

# FFmpeg (pkg-config + link test to catch missing -dev packages)
_FFMPEG_CHECK := $(shell pkg-config --exists libavcodec libavformat libavutil 2>/dev/null \
&& echo 'int main(){return 0;}' | $${CC:-cc} -x c - $$(pkg-config --libs libavcodec libavformat libavutil) -o /dev/null 2>/dev/null \
&& echo 1 || echo 0)
HAVE_FFMPEG := $(_FFMPEG_CHECK)
ifeq ($(HAVE_FFMPEG),1)
FFMPEG_CFLAGS := $(shell pkg-config --cflags libavcodec libavformat libavutil 2>/dev/null)
FFMPEG_LIBS := $(shell pkg-config --libs libavcodec libavformat libavutil 2>/dev/null || echo "-lavcodec -lavformat -lavutil")
else
FFMPEG_CFLAGS :=
FFMPEG_LIBS :=
endif

# OpenCV (pkg-config + link test)
_OPENCV_CHECK := $(shell (pkg-config --exists opencv4 2>/dev/null && echo 'int main(){return 0;}' | $${CC:-cc} -x c - $$(pkg-config --libs opencv4) -o /dev/null 2>/dev/null && echo 1) \
|| (pkg-config --exists opencv 2>/dev/null && echo 'int main(){return 0;}' | $${CC:-cc} -x c - $$(pkg-config --libs opencv) -o /dev/null 2>/dev/null && echo 1) \
|| echo 0)
HAVE_OPENCV := $(_OPENCV_CHECK)
ifeq ($(HAVE_OPENCV),1)
OPENCV_CFLAGS := $(shell pkg-config --cflags opencv4 2>/dev/null || pkg-config --cflags opencv)
OPENCV_LIBS := $(shell pkg-config --libs opencv4 2>/dev/null || pkg-config --libs opencv)
else
OPENCV_CFLAGS :=
OPENCV_LIBS :=
endif

# GLFW3 (pkg-config + link test)
_GLFW3_CHECK := $(shell pkg-config --exists glfw3 2>/dev/null \
&& echo 'int main(){return 0;}' | $${CC:-cc} -x c - $$(pkg-config --libs glfw3) -o /dev/null 2>/dev/null \
&& echo 1 || echo 0)
HAVE_GLFW3 := $(_GLFW3_CHECK)
ifeq ($(HAVE_GLFW3),1)
GLFW3_CFLAGS := $(shell pkg-config --cflags glfw3 2>/dev/null)
GLFW3_LIBS := $(shell pkg-config --libs glfw3 2>/dev/null)
else
GLFW3_CFLAGS :=
GLFW3_LIBS :=
endif

# Vulkan (pkg-config + link test)
_VULKAN_CHECK := $(shell pkg-config --exists vulkan 2>/dev/null \
&& echo 'int main(){return 0;}' | $${CC:-cc} -x c - $$(pkg-config --libs vulkan) -o /dev/null 2>/dev/null \
&& echo 1 || echo 0)
HAVE_VULKAN := $(_VULKAN_CHECK)
ifeq ($(HAVE_VULKAN),1)
VULKAN_CFLAGS := $(shell pkg-config --cflags vulkan 2>/dev/null)
VULKAN_LIBS := $(shell pkg-config --libs vulkan 2>/dev/null || echo "-lvulkan")
else
VULKAN_CFLAGS :=
VULKAN_LIBS :=
endif

# libdw (elfutils)
_LIBDW_CHECK := $(shell pkg-config --exists libdw 2>/dev/null && echo 1 || echo 0)
ifeq ($(_LIBDW_CHECK),0)
_LIBDW_CHECK := $(if $(or $(wildcard /usr/include/elfutils/libdw.h),$(wildcard /usr/include/dwarf.h)),1,0)
endif
HAVE_LIBDW := $(_LIBDW_CHECK)

# amd_comgr
ROCM_PATH ?= /opt/rocm
_AMD_COMGR_CHECK := $(if $(or $(wildcard $(ROCM_PATH)/include/amd_comgr/amd_comgr.h),$(wildcard $(ROCM_PATH)/lib/libamd_comgr.so)),1,0)
ifeq ($(_AMD_COMGR_CHECK),0)
_AMD_COMGR_CHECK := $(shell pkg-config --exists amd_comgr 2>/dev/null && echo 1 || echo 0)
endif
HAVE_AMD_COMGR := $(_AMD_COMGR_CHECK)

# glslangValidator
_GLSLANG_CHECK := $(shell command -v glslangValidator >/dev/null 2>&1 && echo 1 || echo 0)
HAVE_GLSLANG_VALIDATOR := $(_GLSLANG_CHECK)

endif # ifndef HAVE_FFMPEG

# Check REQUIRED_DEPS against HAVE_<dep> flags
MISSING_DEPS :=
$(foreach dep,$(REQUIRED_DEPS),\
$(if $(filter 1,$(HAVE_$(dep))),,\
$(eval MISSING_DEPS += $(dep))))

ifneq ($(MISSING_DEPS),)
SKIP_BUILD := 1
$(info $(EXAMPLE): Skipping build — missing dependencies: $(MISSING_DEPS))
endif
3 changes: 2 additions & 1 deletion Dockerfiles/almalinux-8.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN dnf install -y dnf-plugins-core && \
git \
curl \
nasm \
pkgconf-pkg-config \
python3.11 \
python3.11-pip \
elfutils-devel \
Expand Down Expand Up @@ -86,7 +87,7 @@ RUN mkdir -p /opt/vulkan-sdk && \
ENV PATH="${VULKAN_SDK}/bin:${PATH}"
ENV LD_LIBRARY_PATH="${VULKAN_SDK}/lib:${LD_LIBRARY_PATH}"
ENV VK_ADD_LAYER_PATH="${VULKAN_SDK}/share/vulkan/explicit_layer.d"
ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig"
ENV PKG_CONFIG_PATH="${VULKAN_SDK}/share/pkgconfig:${VULKAN_SDK}/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/lib64/pkgconfig"

# Build FFmpeg from source (not available in RHEL 8 repos)
WORKDIR /tmp
Expand Down
9 changes: 7 additions & 2 deletions HIP-Basic/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,21 @@ EXAMPLES := \
moving_average \
multi_gpu_data_transfer \
occupancy \
opengl_interop \
runtime_compilation \
saxpy \
shared_memory \
streams \
static_host_library \
texture_management \
vulkan_interop \
warp_shuffle

ifneq ($(wildcard /usr/include/GLFW/glfw3.h),)
EXAMPLES += opengl_interop
ifneq ($(wildcard /usr/include/vulkan/vulkan.h),)
EXAMPLES += vulkan_interop
endif
endif

# Only supported on HIP (not CUDA).
ifneq ($(GPU_RUNTIME), CUDA)
EXAMPLES += \
Expand Down
16 changes: 14 additions & 2 deletions HIP-Basic/opengl_interop/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ COMMON_INCLUDE_DIR := ../../Common
EXTERNAL_DIR := ../../External
GPU_RUNTIME ?= HIP

# Dependency checking
REQUIRED_DEPS := GLFW3
include $(COMMON_INCLUDE_DIR)/require_deps.mk

ifneq ($(SKIP_BUILD),1)

# HIP variables
ROCM_PATH ?= /opt/rocm
HIP_INCLUDE_DIR := $(ROCM_PATH)/include
Expand All @@ -34,9 +40,9 @@ HIPCXX ?= $(ROCM_PATH)/bin/hipcc
# Common variables and flags
CXX_STD := c++17
ICXXFLAGS := -std=$(CXX_STD)
ICPPFLAGS := -I $(COMMON_INCLUDE_DIR) -I $(EXTERNAL_DIR) $(shell pkg-config --cflags glfw3)
ICPPFLAGS := -I $(COMMON_INCLUDE_DIR) -I $(EXTERNAL_DIR) $(GLFW3_CFLAGS)
ILDFLAGS :=
ILDLIBS := $(shell pkg-config --libs glfw3) -ldl
ILDLIBS := $(GLFW3_LIBS) -ldl

ifeq ($(GPU_RUNTIME), CUDA)
ICXXFLAGS += -x cu
Expand Down Expand Up @@ -65,3 +71,9 @@ clean:
$(RM) $(EXAMPLE)

.PHONY: clean

else
all:
clean:
.PHONY: all clean
endif
Loading
Loading