Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix static build #360

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion clients/samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ########################################################################
# Copyright (C) 2016-2024 Advanced Micro Devices, Inc. All rights reserved.
# Copyright (C) 2016-2025 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
Expand All @@ -26,6 +26,7 @@ add_executable(example-cpp-basic example_basic.cpp)
# We test for C99 compatibility in the example-c.c test
set_source_files_properties(example_basic.c PROPERTIES LANGUAGE CXX)
set_source_files_properties(example_basic.c PROPERTIES COMPILE_FLAGS "-xc -std=c99")
target_compile_options(example-c-basic PRIVATE -I${HIP_INCLUDE_DIRS})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder perhaps this option -I${HIP_INCLUDE_DIRS} is safe and harmless for other examples as well. Just a thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is that, unfortunately, this change should not have been necessary. The include directory pointed by ${HIP_INCLUDE_DIRS} is being directly, and properly, set on target example-c-basic by the target_include_directories in line 36; as well as being also indirectly set by the nearby target_link_libraries in some code paths.

The problem lies in the fact that current static libraries builds are purposefully ignoring the hip runtime include dirs set in the proper way.


# Test for C++11 compatibility in one of the samples
set_property(TARGET example-cpp-basic PROPERTY CXX_STANDARD 11)
Expand Down