Skip to content

Commit

Permalink
use alternative cmake flag
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 committed Jan 23, 2025
1 parent 5c4d5f3 commit bbd7633
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
run: |
export CC="${{ github.workspace }}/zigshim/zig cc -target ${{ matrix.arch }}-linux-musl"
export CXX="${{ github.workspace }}/zigshim/zig c++ -target ${{ matrix.arch }}-linux-musl"
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }}
cmake -B build -DTARGET=plugin ${{ inputs.version && '-DRELEASE=1' || '' }} ${{ matrix.arch == 'x86_64' && '-DRSMI_STATIC=ON' || '' }}
cmake --build build --parallel 4
cp build/cosmotop-plugin.exe ./cosmotop-linux-${{ matrix.arch }}.exe
Expand Down
7 changes: 2 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ elseif(${TARGET} STREQUAL "plugin")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(BUILD_EXE ON)

if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(RSMI_STATIC)
# ROCm doesn't properly add it's folders to the module path if `CMAKE_MODULE_PATH` is already
# set
# We could also manually append ROCm's path here
Expand Down Expand Up @@ -193,9 +193,6 @@ elseif(${TARGET} STREQUAL "plugin")
target_compile_definitions(${BINARY_NAME} PRIVATE COSMO_PLUGIN_WANT_MAIN)
if(CMAKE_SYSTEM MATCHES "Linux")
target_compile_options(${BINARY_NAME} PRIVATE -static)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
target_compile_definitions(${BINARY_NAME} PRIVATE RSMI_STATIC)
endif()
endif()
else()
set(BINARY_NAME "cosmotop-plugin")
Expand All @@ -213,7 +210,7 @@ elseif(${TARGET} STREQUAL "plugin")
find_package(Threads REQUIRED)

target_link_libraries(${BINARY_NAME} PRIVATE Threads::Threads)
if(CMAKE_SYSTEM MATCHES "Linux" AND CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
if(CMAKE_SYSTEM MATCHES "Linux" AND RSMI_STATIC)
target_link_libraries(${BINARY_NAME} PRIVATE ROCm)
elseif(CMAKE_SYSTEM MATCHES "Darwin")
target_link_libraries(${BINARY_NAME} PRIVATE $<LINK_LIBRARY:FRAMEWORK,CoreFoundation> $<LINK_LIBRARY:FRAMEWORK,IOKit>)
Expand Down

0 comments on commit bbd7633

Please sign in to comment.