1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-08 22:08:02 +00:00

Removed trailing slashes from folder paths to avoid kernel building under Windows (MSVS).

This commit is contained in:
troky 2014-06-10 16:40:37 +02:00
parent 9f6bf16196
commit cbc22823df
3 changed files with 10 additions and 14 deletions

6
ocl.c
View File

@ -369,8 +369,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize, algorithm_t *alg
strcpy(build_data->source_filename, filename); strcpy(build_data->source_filename, filename);
strcpy(build_data->platform, name); strcpy(build_data->platform, name);
strcpy(build_data->sgminer_path, sgminer_path); strcpy(build_data->sgminer_path, sgminer_path);
if (opt_kernel_path && *opt_kernel_path) if (opt_kernel_path && *opt_kernel_path) {
build_data->kernel_path = opt_kernel_path; build_data->kernel_path = opt_kernel_path;
}
else {
build_data->kernel_path = NULL;
}
build_data->work_size = clState->wsize; build_data->work_size = clState->wsize;
build_data->has_bit_align = clState->hasBitAlign; build_data->has_bit_align = clState->hasBitAlign;

View File

@ -20,7 +20,7 @@ static char *file_contents(const char *filename, int *length)
if (!f) { if (!f) {
/* Then from `pwd`/kernel/ */ /* Then from `pwd`/kernel/ */
strcpy(fullpath, sgminer_path); strcpy(fullpath, sgminer_path);
strcat(fullpath, "kernel/"); strcat(fullpath, "/kernel/");
strcat(fullpath, filename); strcat(fullpath, filename);
f = fopen(fullpath, "rb"); f = fopen(fullpath, "rb");
} }
@ -49,7 +49,7 @@ static char *file_contents(const char *filename, int *length)
void set_base_compiler_options(build_kernel_data *data) void set_base_compiler_options(build_kernel_data *data)
{ {
char buf[255]; char buf[255];
sprintf(data->compiler_options, "-I \"%s\" -I \"%skernel\" -I \".\" -D WORKSIZE=%d", sprintf(data->compiler_options, "-I \"%s\" -I \"%s\\kernel\" -I \".\" -D WORKSIZE=%d",
data->sgminer_path, data->sgminer_path, (int)data->work_size); data->sgminer_path, data->sgminer_path, (int)data->work_size);
applog(LOG_DEBUG, "Setting worksize to %d", (int)(data->work_size)); applog(LOG_DEBUG, "Setting worksize to %d", (int)(data->work_size));
@ -61,7 +61,7 @@ void set_base_compiler_options(build_kernel_data *data)
applog(LOG_DEBUG, "cl_amd_media_ops found, setting BITALIGN"); applog(LOG_DEBUG, "cl_amd_media_ops found, setting BITALIGN");
} else } else
applog(LOG_DEBUG, "cl_amd_media_ops not found, will not set BITALIGN"); applog(LOG_DEBUG, "cl_amd_media_ops not found, will not set BITALIGN");
if (data->kernel_path) { if (data->kernel_path) {
strcat(data->compiler_options, " -I \""); strcat(data->compiler_options, " -I \"");
strcat(data->compiler_options, data->kernel_path); strcat(data->compiler_options, data->kernel_path);
@ -126,10 +126,9 @@ cl_program build_opencl_kernel(build_kernel_data *data, const char *filename)
applog(LOG_ERR, "Error %d: Building Program (clBuildProgram)", status); applog(LOG_ERR, "Error %d: Building Program (clBuildProgram)", status);
status = clGetProgramBuildInfo(program, *data->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size); status = clGetProgramBuildInfo(program, *data->device, CL_PROGRAM_BUILD_LOG, 0, NULL, &log_size);
char *sz_log = (char *)malloc(log_size + 1); char *sz_log = (char *)malloc(log_size);
status = clGetProgramBuildInfo(program, *data->device, CL_PROGRAM_BUILD_LOG, log_size, sz_log, NULL); status = clGetProgramBuildInfo(program, *data->device, CL_PROGRAM_BUILD_LOG, log_size, sz_log, NULL);
sz_log[log_size] = '\0'; applogsiz(LOG_ERR, log_size, "%s", sz_log);
applog(LOG_ERR, "%s", sz_log);
free(sz_log); free(sz_log);
goto out; goto out;
} }

View File

@ -7913,10 +7913,8 @@ int main(int argc, char *argv[])
s = strdup(argv[0]); s = strdup(argv[0]);
strcpy(sgminer_path, dirname(s)); strcpy(sgminer_path, dirname(s));
free(s); free(s);
strcat(sgminer_path, "/");
#else #else
GetCurrentDirectory(PATH_MAX - 1, sgminer_path); GetCurrentDirectory(PATH_MAX - 1, sgminer_path);
strcat(sgminer_path, "\\");
#endif #endif
/* Default algorithm specified in algorithm.c ATM */ /* Default algorithm specified in algorithm.c ATM */
@ -8001,11 +7999,6 @@ int main(int argc, char *argv[])
char *old_path = opt_kernel_path; char *old_path = opt_kernel_path;
opt_kernel_path = (char *)alloca(PATH_MAX); opt_kernel_path = (char *)alloca(PATH_MAX);
strcpy(opt_kernel_path, old_path); strcpy(opt_kernel_path, old_path);
#ifdef _MSC_VER
strcat(opt_kernel_path, "\\");
#else
strcat(opt_kernel_path, "/");
#endif
} }