Make samples support cmake
Only cmake can support static lib of hip rt. Thus samples will support static lib of hip rt when this is done. Change-Id: I70e8d06e85084369a035b42c5d1d56287c874ac9
Tá an tiomantas seo le fáil i:
tiomanta ag
Tao Sang
tuismitheoir
5bf2a70382
tiomantas
8f72a6993f
@@ -0,0 +1,20 @@
|
||||
project(bit_extract)
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# Search for rocm in common locations
|
||||
list(APPEND CMAKE_PREFIX_PATH /opt/rocm/hip /opt/rocm)
|
||||
|
||||
# Find hip
|
||||
find_package(hip)
|
||||
|
||||
# Set compiler and linker
|
||||
set(CMAKE_CXX_COMPILER ${HIP_HIPCC_EXECUTABLE})
|
||||
|
||||
set(CMAKE_CXX_LINKER ${HIP_HIPCC_EXECUTABLE})
|
||||
|
||||
# Create the excutable
|
||||
add_executable(bit_extract bit_extract.cpp)
|
||||
|
||||
# Link with HIP
|
||||
target_link_libraries(bit_extract hip::host)
|
||||
@@ -9,19 +9,15 @@ HIPCC=$(HIP_PATH)/bin/hipcc
|
||||
|
||||
# Show how to use PLATFORM to specify different options for each compiler:
|
||||
ifeq (${HIP_PLATFORM}, nvcc)
|
||||
HIPCC_FLAGS = -gencode=arch=compute_20,code=sm_20
|
||||
HIPCC_FLAGS = -gencode=arch=compute_20,code=sm_20
|
||||
endif
|
||||
|
||||
EXE=bit_extract
|
||||
EXE_STATIC=bit_extract_static
|
||||
|
||||
$(EXE): bit_extract.cpp
|
||||
$(HIPCC) $(HIPCC_FLAGS) $< -o $@
|
||||
|
||||
$(EXE_STATIC): bit_extract.cpp
|
||||
$(HIPCC) -use-staticlib $(HIPCC_FLAGS) $< -o $@
|
||||
|
||||
all: $(EXE) $(EXE_STATIC)
|
||||
all: $(EXE)
|
||||
|
||||
clean:
|
||||
rm -f *.o $(EXE) $(EXE_STATIC)
|
||||
rm -f *.o $(EXE)
|
||||
|
||||
Tagairt in Eagrán Nua
Cuir bac ar úsáideoir