mirror of
https://github.com/jwinterm/xmr-stak.git
synced 2026-10-17 05:41:41 +02:00
fix clang CUDA compile
- add clang compile section - cleanup CMake file - fix missing return value
This commit is contained in:
+25
-8
@@ -315,13 +315,17 @@ if(CMAKE_LINK_STATIC)
|
||||
set(LIBS "-static-libgcc -static-libstdc++ ${LIBS}")
|
||||
endif()
|
||||
|
||||
# compile C files
|
||||
file(GLOB SRCFILES_C "xmrstak/backend/cpu/crypto/*.c")
|
||||
|
||||
add_library(xmr-stak-c
|
||||
STATIC
|
||||
${SRCFILES_C}
|
||||
)
|
||||
set_property(TARGET xmr-stak-c PROPERTY C_STANDARD 99)
|
||||
target_link_libraries(xmr-stak-c ${LIBS})
|
||||
|
||||
# compile generic backend files
|
||||
file(GLOB BACKEND_CPP
|
||||
"xmrstak/*.cpp"
|
||||
"xmrstak/backend/cpu/*.cpp"
|
||||
@@ -337,22 +341,37 @@ add_library(xmr-stak-backend
|
||||
)
|
||||
target_link_libraries(xmr-stak-backend xmr-stak-c ${CMAKE_DL_LIBS})
|
||||
|
||||
# compile CUDA backend
|
||||
if(CUDA_FOUND)
|
||||
file(GLOB CUDASRCFILES
|
||||
"xmrstak/backend/nvidia/nvcc_code/*.cu"
|
||||
"xmrstak/backend/nvidia/*.cpp")
|
||||
|
||||
# build device code with nvcc
|
||||
cuda_add_library(xmrstak_cuda_backend
|
||||
SHARED
|
||||
${CUDASRCFILES}
|
||||
)
|
||||
if("${CUDA_COMPILER}" STREQUAL "clang")
|
||||
# build device code with clang
|
||||
add_library(
|
||||
xmrstak_cuda_backend
|
||||
SHARED
|
||||
${CUDASRCFILES}
|
||||
)
|
||||
set_target_properties(xmrstak_cuda_backend PROPERTIES COMPILE_FLAGS ${CLANG_BUILD_FLAGS})
|
||||
set_target_properties(xmrstak_cuda_backend PROPERTIES LINKER_LANGUAGE CXX)
|
||||
set_source_files_properties(${CUDASRCFILES} PROPERTIES LANGUAGE CXX)
|
||||
else()
|
||||
# build device code with nvcc
|
||||
cuda_add_library(
|
||||
xmrstak_cuda_backend
|
||||
SHARED
|
||||
${CUDASRCFILES}
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(xmrstak_cuda_backend ${CUDA_LIBRARIES})
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||
target_link_libraries(xmrstak_cuda_backend xmr-stak-backend)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# compile AMD backend
|
||||
if(OpenCL_FOUND)
|
||||
file(GLOB OPENCLSRCFILES
|
||||
"xmrstak/backend/amd/amd_gpu/*.cpp"
|
||||
@@ -367,12 +386,10 @@ if(OpenCL_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# compile final binary
|
||||
file(GLOB SRCFILES_CPP "xmrstak/cli/*.cpp")
|
||||
set_source_files_properties(${SRCFILES_CPP} PROPERTIES LANGUAGE CXX)
|
||||
|
||||
set_property(TARGET xmr-stak-c PROPERTY C_STANDARD 99)
|
||||
target_link_libraries(xmr-stak-c ${LIBS})
|
||||
|
||||
add_executable(xmr-stak
|
||||
${SRCFILES_CPP}
|
||||
)
|
||||
|
||||
@@ -252,7 +252,7 @@ bool jconf::parse_config(const char* sFilename)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace amd
|
||||
|
||||
@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
params::inst().useAMD = false;
|
||||
}
|
||||
else if(opName.compare("--noAMD") == 0)
|
||||
else if(opName.compare("--noNVIDIA") == 0)
|
||||
{
|
||||
params::inst().useNVIDIA = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user