/*! \brief Builds a string with build options for the OpenCL kernels * * \throws std::bad_alloc if out of memory. */ static std::string makePreprocessorOptions(const std::string &kernelRootPath, const std::string &includeRootPath, size_t warpSize, ocl_vendor_id_t deviceVendorId, const std::string &extraDefines) { std::string preprocessorOptions; /* Compose the complete build options */ preprocessorOptions = formatString("-DWARP_SIZE_TEST=%d", static_cast<int>(warpSize)); preprocessorOptions += ' '; preprocessorOptions += makeVendorFlavorChoice(deviceVendorId); preprocessorOptions += ' '; preprocessorOptions += extraDefines; preprocessorOptions += ' '; preprocessorOptions += selectCompilerOptions(deviceVendorId); preprocessorOptions += ' '; preprocessorOptions += makeKernelIncludePathOption(kernelRootPath); preprocessorOptions += ' '; preprocessorOptions += makeKernelIncludePathOption(includeRootPath); // Mac OS (and maybe some other implementations) does not accept double spaces in options removeExtraSpaces(&preprocessorOptions); return preprocessorOptions; }
/*! \brief Builds a string with build options for the OpenCL kernels * * \throws std::bad_alloc if out of memory. */ std::string makePreprocessorOptions(const std::string &kernelRootPath, size_t warpSize, ocl_vendor_id_t deviceVendorId, const std::string &extraDefines) { std::string preprocessorOptions; /* Compose the complete build options */ preprocessorOptions = formatString("-DWARP_SIZE_TEST=%d", static_cast<int>(warpSize)); preprocessorOptions += ' '; preprocessorOptions += makeVendorFlavorChoice(deviceVendorId); preprocessorOptions += ' '; preprocessorOptions += extraDefines; preprocessorOptions += ' '; preprocessorOptions += selectCompilerOptions(deviceVendorId); preprocessorOptions += ' '; preprocessorOptions += makeKernelIncludePathOption(kernelRootPath); return preprocessorOptions; }