@@ -67,7 +67,7 @@ if(BTOP_LTO)
6767endif ()
6868
6969if (APPLE )
70- target_sources (libbtop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp )
70+ target_sources (libbtop PRIVATE src/osx/btop_collect.cpp src/osx/sensors.cpp src/osx/smc.cpp src/osx/iokit.cpp src/osx/gpu.cpp )
7171elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "MidnightBSD" )
7272 target_sources (libbtop PRIVATE src/freebsd/btop_collect.cpp )
7373elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD" )
@@ -161,35 +161,36 @@ find_package(Threads REQUIRED)
161161target_link_libraries (libbtop Threads::Threads )
162162
163163# Enable GPU support
164- if (LINUX AND BTOP_GPU )
164+ if (BTOP_GPU AND ( LINUX OR APPLE ) )
165165 target_compile_definitions (libbtop PUBLIC GPU_SUPPORT )
166-
167- if (BTOP_RSMI_STATIC)
168- # ROCm doesn't properly add it's folders to the module path if `CMAKE_MODULE_PATH` is already
169- # set
170- # We could also manually append ROCm's path here
171- set (_CMAKE_MODULE_PATH CMAKE_MODULE_PATH )
172- unset (CMAKE_MODULE_PATH )
173-
174- # NOTE: This might be problematic in the future if other sub projects depend on this or if
175- # btop starts producing libraries
176- # Build a static ROCm library
177- set (BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE )
178-
179- add_subdirectory (lib/rocm_smi_lib EXCLUDE_FROM_ALL )
180-
181- add_library (ROCm INTERFACE )
182- # Export ROCm's properties to a target
183- target_compile_definitions (ROCm INTERFACE RSMI_STATIC )
184- target_include_directories (ROCm INTERFACE lib/rocm_smi_lib/include )
185- target_link_libraries (ROCm INTERFACE rocm_smi64 )
186-
187- set (CMAKE_MODULE_PATH _CMAKE_MODULE_PATH)
188-
189- target_link_libraries (libbtop ROCm )
190- endif ()
191- if (NOT BTOP_STATIC)
192- target_link_libraries (libbtop ${CMAKE_DL_LIBS} )
166+ if (LINUX )
167+ if (BTOP_RSMI_STATIC)
168+ # ROCm doesn't properly add it's folders to the module path if `CMAKE_MODULE_PATH` is already
169+ # set
170+ # We could also manually append ROCm's path here
171+ set (_CMAKE_MODULE_PATH CMAKE_MODULE_PATH )
172+ unset (CMAKE_MODULE_PATH )
173+
174+ # NOTE: This might be problematic in the future if other sub projects depend on this or if
175+ # btop starts producing libraries
176+ # Build a static ROCm library
177+ set (BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE )
178+
179+ add_subdirectory (lib/rocm_smi_lib EXCLUDE_FROM_ALL )
180+
181+ add_library (ROCm INTERFACE )
182+ # Export ROCm's properties to a target
183+ target_compile_definitions (ROCm INTERFACE RSMI_STATIC )
184+ target_include_directories (ROCm INTERFACE lib/rocm_smi_lib/include )
185+ target_link_libraries (ROCm INTERFACE rocm_smi64 )
186+
187+ set (CMAKE_MODULE_PATH _CMAKE_MODULE_PATH)
188+
189+ target_link_libraries (libbtop ROCm )
190+ endif ()
191+ if (NOT BTOP_STATIC)
192+ target_link_libraries (libbtop ${CMAKE_DL_LIBS} )
193+ endif ()
193194 endif ()
194195endif ()
195196
0 commit comments