Make it possible to build without opencl for cpu mining only.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
diff --git a/findnonce.c b/findnonce.c
index af1525a..de9890e 100644
--- a/findnonce.c
+++ b/findnonce.c
@@ -8,6 +8,9 @@
* any later version. See COPYING for more details.
*/
+#include "config.h"
+#ifdef HAVE_OPENCL
+
#include <stdio.h>
#include <inttypes.h>
#include <pthread.h>
@@ -252,3 +255,4 @@ void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res)
return;
}
}
+#endif /* HAVE_OPENCL */
diff --git a/findnonce.h b/findnonce.h
index bc5070f..e526aab 100644
--- a/findnonce.h
+++ b/findnonce.h
@@ -1,12 +1,15 @@
#ifndef __FINDNONCE_H__
#define __FINDNONCE_H__
#include "miner.h"
+#include "config.h"
#define MAXTHREADS (0xFFFFFFFEULL)
/* Maximum worksize 512 * maximum vectors 4 plus one flag entry */
#define MAXBUFFERS (4 * 512)
#define BUFFERSIZE (sizeof(uint32_t) * (MAXBUFFERS + 1))
+#ifdef HAVE_OPENCL
extern void precalc_hash(dev_blk_ctx *blk, uint32_t *state, uint32_t *data);
extern void postcalc_hash_async(struct thr_info *thr, struct work *work, uint32_t *res);
+#endif /* HAVE_OPENCL */
#endif /*__FINDNONCE_H__*/
diff --git a/miner.h b/miner.h
index 7aad072..fd824b9 100644
--- a/miner.h
+++ b/miner.h
@@ -9,11 +9,14 @@
#include <pthread.h>
#include <jansson.h>
#include <curl/curl.h>
+
+#ifdef HAVE_OPENCL
#ifdef __APPLE_CC__
#include <OpenCL/opencl.h>
#else
#include <CL/cl.h>
#endif
+#endif /* HAVE_OPENCL */
#ifdef STDC_HEADERS
# include <stdlib.h>
@@ -211,6 +214,7 @@ extern struct thr_info *thr_info;
extern int longpoll_thr_id;
extern struct work_restart *work_restart;
+#ifdef HAVE_OPENCL
typedef struct {
cl_uint ctx_a; cl_uint ctx_b; cl_uint ctx_c; cl_uint ctx_d;
cl_uint ctx_e; cl_uint ctx_f; cl_uint ctx_g; cl_uint ctx_h;
@@ -222,6 +226,11 @@ typedef struct {
cl_uint W16; cl_uint W17; cl_uint W2;
cl_uint PreVal4; cl_uint T1;
} dev_blk_ctx;
+#else
+typedef struct {
+ uint32_t nonce;
+} dev_blk_ctx;
+#endif
struct work {
unsigned char data[128];