diff options
author | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-11-11 21:43:51 +0100 |
---|---|---|
committer | psychocrypt <psychocrypt@users.noreply.github.com> | 2017-11-11 22:19:43 +0100 |
commit | 062287ad4740fd4ea7365f188d2a31c43b489ab5 (patch) | |
tree | 223a6530666ea02f56d8f3139c55af473230a0d8 | |
parent | 71c4e937aeb0a202ea577b52656b68002ba33291 (diff) | |
download | xmr-stak-062287ad4740fd4ea7365f188d2a31c43b489ab5.zip xmr-stak-062287ad4740fd4ea7365f188d2a31c43b489ab5.tar.gz |
fix compile
- generate define `BACKEND_TYPE` type in CMake
- fix comile because `GIT_COMMIT_HASH` is no string
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | xmrstak/version.cpp | 27 |
2 files changed, 19 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 491d7e3..7c56284 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,7 @@ if(CUDA_ENABLE) find_package(CUDA 7.5) if(CUDA_FOUND) - + list(APPEND BACKEND_TYPES "nvidia") option(XMR-STAK_LARGEGRID "Support large CUDA block count > 128" ON) if(XMR-STAK_LARGEGRID) add_definitions("-DXMR_STAK_LARGEGRID=${XMR-STAK_LARGEGRID}") @@ -233,6 +233,7 @@ if(OpenCL_ENABLE) # find package will use the previews searched path variables find_package(OpenCL) if(OpenCL_FOUND) + list(APPEND BACKEND_TYPES "amd") include_directories(SYSTEM ${OpenCL_INCLUDE_DIRS}) #set(LIBS ${LIBS} ${OpenCL_LIBRARY}) link_directories(${OpenCL_LIBRARY}) @@ -250,6 +251,8 @@ endif() option(CPU_ENABLE "Enable or disable CPU support" ON) if(NOT CPU_ENABLE) add_definitions("-DCONF_NO_CPU") +else() + list(APPEND BACKEND_TYPES "cpu") endif() ################################################################################ @@ -385,6 +388,9 @@ if(NOT "${GIT_BRANCH}" STREQUAL "") add_definitions("-DGIT_BRANCH=${GIT_BRANCH}") endif() +# generate backend string +string(REPLACE ";" "-" STR_BACKEND_TYPES "${BACKEND_TYPES}") +add_definitions("-DBACKEND_TYPE=${STR_BACKEND_TYPES}") ################################################################################ # Compile & Link diff --git a/xmrstak/version.cpp b/xmrstak/version.cpp index 2308580..3cecc8f 100644 --- a/xmrstak/version.cpp +++ b/xmrstak/version.cpp @@ -2,15 +2,19 @@ //! git will put "#define GIT_ARCHIVE 1" on the next line inside archives. $Format:%n#define GIT_ARCHIVE 1$ #if defined(GIT_ARCHIVE) && !defined(GIT_COMMIT_HASH) -#define GIT_COMMIT_HASH "$Format:%h$" +#define GIT_COMMIT_HASH $Format:%h$ #endif #ifndef GIT_COMMIT_HASH -#define GIT_COMMIT_HASH "0000000" +#define GIT_COMMIT_HASH 0000000 #endif #ifndef GIT_BRANCH -#define GIT_BRANCH "unknown" +#define GIT_BRANCH unknown +#endif + +#ifndef BACKEND_TYPE +#define BACKEND_TYPE unknown #endif #define XMR_STAK_NAME "xmr-stak" @@ -28,16 +32,6 @@ #define OS_TYPE "unk" #endif -#if !defined(CONF_NO_CUDA) && !defined(CONF_NO_OPENCL) -#define BACKEND_TYPE "cpu-nvidia-amd" -#elif !defined(CONF_NO_OPENCL) -#define BACKEND_TYPE "cpu-amd" -#elif !defined(CONF_NO_CUDA) -#define BACKEND_TYPE "cpu-nvidia" -#else -#define BACKEND_TYPE "cpu" -#endif - #if defined(CONF_NO_AEON) #define COIN_TYPE "monero" #elif defined(CONF_NO_MONERO) @@ -46,8 +40,11 @@ #define COIN_TYPE "aeon-monero" #endif -#define VERSION_LONG XMR_STAK_NAME "/" XMR_STAK_VERSION "/" GIT_COMMIT_HASH "/" GIT_BRANCH "/" OS_TYPE "/" BACKEND_TYPE "/" COIN_TYPE "/" -#define VERSION_SHORT XMR_STAK_NAME " " XMR_STAK_VERSION " " GIT_COMMIT_HASH +#define XMRSTAK_PP_TOSTRING1(str) #str +#define XMRSTAK_PP_TOSTRING(str) XMRSTAK_PP_TOSTRING1(str) + +#define VERSION_LONG XMR_STAK_NAME "/" XMR_STAK_VERSION "/" XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH) "/" XMRSTAK_PP_TOSTRING(GIT_BRANCH) "/" OS_TYPE "/" XMRSTAK_PP_TOSTRING(BACKEND_TYPE) "/" COIN_TYPE "/" +#define VERSION_SHORT XMR_STAK_NAME " " XMR_STAK_VERSION " " XMRSTAK_PP_TOSTRING(GIT_COMMIT_HASH) const char ver_long[] = VERSION_LONG; const char ver_short[] = VERSION_SHORT; |