Bugfix: Fix build without curses but with OpenCL
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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
diff --git a/adl.c b/adl.c
index 8573e16..85ec0aa 100644
--- a/adl.c
+++ b/adl.c
@@ -33,6 +33,10 @@
#endif
#include "adl_functions.h"
+#ifndef HAVE_CURSES
+#define wlogprint(...) applog(LOG_WARNING, __VA_ARGS__)
+#endif
+
bool adl_active;
bool opt_reorder = false;
@@ -764,6 +768,7 @@ bool gpu_stats(int gpu, float *temp, int *engineclock, int *memclock, float *vdd
return true;
}
+#ifdef HAVE_CURSES
static void get_enginerange(int gpu, int *imin, int *imax)
{
struct gpu_adl *ga;
@@ -776,6 +781,7 @@ static void get_enginerange(int gpu, int *imin, int *imax)
*imin = ga->lpOdParameters.sEngineClock.iMin / 100;
*imax = ga->lpOdParameters.sEngineClock.iMax / 100;
}
+#endif
int set_engineclock(int gpu, int iEngineClock)
{
@@ -824,6 +830,7 @@ out:
return ret;
}
+#ifdef HAVE_CURSES
static void get_memoryrange(int gpu, int *imin, int *imax)
{
struct gpu_adl *ga;
@@ -836,6 +843,7 @@ static void get_memoryrange(int gpu, int *imin, int *imax)
*imin = ga->lpOdParameters.sMemoryClock.iMin / 100;
*imax = ga->lpOdParameters.sMemoryClock.iMax / 100;
}
+#endif
int set_memoryclock(int gpu, int iMemoryClock)
{
@@ -876,6 +884,7 @@ out:
return ret;
}
+#ifdef HAVE_CURSES
static void get_vddcrange(int gpu, float *imin, float *imax)
{
struct gpu_adl *ga;
@@ -889,7 +898,6 @@ static void get_vddcrange(int gpu, float *imin, float *imax)
*imax = (float)ga->lpOdParameters.sVddc.iMax / 1000;
}
-#ifdef HAVE_CURSES
static float curses_float(const char *query)
{
float ret;
@@ -997,6 +1005,7 @@ int set_fanspeed(int gpu, int iFanSpeed)
return ret;
}
+#ifdef HAVE_CURSES
static int set_powertune(int gpu, int iPercentage)
{
struct gpu_adl *ga;
@@ -1018,6 +1027,7 @@ static int set_powertune(int gpu, int iPercentage)
unlock_adl();
return ret;
}
+#endif
/* Returns whether the fanspeed is optimal already or not. The fan_window bool
* tells us whether the current fanspeed is in the target range for fanspeeds.
diff --git a/cgminer.c b/cgminer.c
index 55d3943..ea54081 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -202,10 +202,11 @@ enum pool_strategy pool_strategy = POOL_FAILOVER;
int opt_rotate_period;
static int total_urls, total_users, total_passes, total_userpasses;
+static
#ifndef HAVE_CURSES
const
#endif
-static bool curses_active;
+bool curses_active;
static char current_block[37];
static char *current_hash;
@@ -1312,8 +1313,10 @@ double total_secs = 0.1;
static char statusline[256];
/* logstart is where the log window should start */
static int devcursor, logstart, logcursor;
+#ifdef HAVE_CURSES
/* statusy is where the status window goes up to in cases where it won't fit at startup */
static int statusy;
+#endif
#ifdef HAVE_OPENCL
struct cgpu_info gpus[MAX_GPUDEVICES]; /* Maximum number apparently possible */
#endif
diff --git a/driver-opencl.c b/driver-opencl.c
index 880a4da..2cf4485 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -1210,16 +1210,17 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
clStates[i] = initCl(virtual_gpu, name, sizeof(name));
if (!clStates[i]) {
+#ifdef HAVE_CURSES
if (use_curses)
enable_curses();
+#endif
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) {
- char *buf;
-
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer.");
failmessage = true;
#ifdef HAVE_CURSES
+ char *buf;
if (use_curses) {
buf = curses_input("Press enter to continue");
if (buf)
diff --git a/logging.c b/logging.c
index 3195663..7d8a430 100644
--- a/logging.c
+++ b/logging.c
@@ -18,7 +18,7 @@ bool opt_log_output = false;
/* per default priorities higher than LOG_NOTICE are logged */
int opt_log_level = LOG_NOTICE;
-static void my_log_curses(int prio, char *f, va_list ap)
+static void my_log_curses(__maybe_unused int prio, char *f, va_list ap)
{
#ifdef HAVE_CURSES
extern bool use_curses;