Browse Source

Make it possible to build without opencl for cpu mining only.

Con Kolivas 14 years ago
parent
commit
cb13e2cfe5
3 changed files with 16 additions and 0 deletions
  1. 4 0
      findnonce.c
  2. 3 0
      findnonce.h
  3. 9 0
      miner.h

+ 4 - 0
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 */

+ 3 - 0
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__*/

+ 9 - 0
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];