-
Notifications
You must be signed in to change notification settings - Fork 87
Conversation
src/modelHandler_OpenCL.cpp
Outdated
@@ -313,7 +316,8 @@ namespace w2xc | |||
const char *dev_name = proc->dev_name; | |||
bool bin_avaiable = false; | |||
|
|||
#if ((defined __linux) && !(defined __ANDROID__)) || _WIN32 | |||
#if ((defined __linux) && !(defined __ANDROID__)) || defined(_WIN32) || \ | |||
defined(__DragonFly__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no cleaner way to check for *BSD variants than a million defined checks ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defined(BSD)
but it's only defined if <sys/param.h>
is included, haven't been updated since BSD 4.4 Lite2 and is also defined on macOS. sysctl code is kernel-specific e.g., KERN_PROC_PATHNAME
isn't supported on OpenBSD (for security reasons) or macOS (uses _NSGetExecutablePath
); while /proc
has been removed on DragonFly + OpenBSD and deprecated on FreeBSD + NetBSD.
Does current version look better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, GENERATE_BINARY
can probably be enabled on all platforms. If getting absolute path to executable isn't supported/implemented current directory can be used as a fallback.
AFAICT the two libraries needed for this app to run (OpenCL and OpenCV) isn't compatible with Solaris, so IMHO it's cleaner to not add any __sun-specific code for now. ... or should we? |
OpenCV (3.4.8 atm) is available in PkgSrc. OpenCL is not packaged by PkgSrc (NetBSD, Solaris) or OpenBSD Ports. With OpenCL the hard part is getting modern graphics drivers e.g., Userland is easier. For one, I've ported Intel NEO to FreeBSD without relying on platform-specific stuff. DragonFly picked up a few days later by nature of sharing package recipes. |
I'm gonna be that guy but, with all these limits and headaches to work around are there even any users of this program and or interested parties? |
FreeBSD and DragonFly have waifu2x-converter-cpp (since 2015) and waifu2x-ncnn-vulkan (unusable on NVIDIA) in packages. For one, I've used waifu2x-converter-cpp |
Dropped Solaris bits. Anything else? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTMN (Did not test on BSD, nor can. Up to you on that one, but the code looks fine.)
Tell me if it's good to go then I'll merge.
KERN_PROC_PATHNAME
is only used when running from build directory,~/.waifu2x
otherwisesysctl
either fails or succeeds but never truncates buffer, sorealloc
is rarely called more than once