-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Mac OS #87
base: master
Are you sure you want to change the base?
Conversation
heya, nice, thanks for jumping onto this. as a general comment, the code with these patches applied will probably not run on my machine any more (or on macintosh with intel cpu?). also i want to limit platform specific code to very few places to make our life easier in the future. let me leave a few comments interleaved in the patch. |
src/db/db.c
Outdated
@@ -454,7 +478,7 @@ int dt_db_read(dt_db_t *db, const char *filename) | |||
lno++; | |||
|
|||
// scan filename:rating|labels:number |
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.
oh, macintosh thinks 32-bit are long? then probably better to use %"PRIu64"
here so it will work on all platforms.
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.
I just followed compiler warnings, I will see what is going on here, in case ok to switch to PRIu64
src/db/db.h
Outdated
@@ -4,6 +4,12 @@ | |||
#include <string.h> | |||
#include <strings.h> | |||
|
|||
#ifndef __APPLE__ |
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.
this argument swap issue is terrifying. there has got to be a better way (not involving the ifdef around all compare functions above).
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.
Yes I know, I want just to reach a working/compiling solution and then beutify. 😄
snprintf(cfgfilename, sizeof(cfgfilename), "%s", filename); | ||
snprintf(deffilename, sizeof(deffilename), "default.%"PRItkn, dt_token_str(input_module)); | ||
struct stat statbuf = {0}; | ||
time_t tcfg = 0, tbc1 = 0; | ||
|
||
if(!stat(cfgfilename, &statbuf)) | ||
#ifndef __APPLE__ |
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.
okay we probably want to factor this out in something like time_t t = dt_stat(filename)
defined in core.h
or similar, so the platform specific code is only in one place.
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.
Yes I will do something like that to put together all plat-spec code. Thank you for the tip 😉
@@ -314,7 +314,11 @@ void modify_roi_out( | |||
mod->img_param.whitebalance[3] /= mod->img_param.whitebalance[1]; | |||
mod->img_param.whitebalance[1] = 1.0f; | |||
|
|||
#ifndef __APPLE__ |
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.
really that doesn't exist? then maybe another wrapper in core.h like dt_isnan
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.
Yes... Too many things are not in Macos... Painful work..
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.
i think this patch is obsolete, the test==test performs nan testing without api call.
.. about rawspeed. does the vanilla rawspeed git build on M1? i would be surprised if not. anyways it's probably better to use upstream rawspeed for changes. about the blank screen. did you run |
Here I am! If you appreciate it, I'm working to make it compile with CMake, which does more platform-specific controls. I also updated ImGUI dependency (I cherry-picked your modifications) to check for the blank screen problem. Thank you for your feedback! |
With the new imgui this is the error:
Apparently, it cannot set the WindowSize properly... I saw you modified imgui backends for that. |
Updates on error state. I set the font size to 16.0 with a literal to go on. Now blocked at:
I think this is related to how the dynamic libraries of the modules are compiled. |
okay is that error any different to the older imgui at all? not sure i understand how you would put imgui into a gtk3/cairo application. as additional dependency? maybe a saner approach is to use about dynamic libraries. i saw you link there may also be an issue about setting file paths to discover additional data/config files/dsos. i'm highly unlikely to merge cmake build system patches. cmake doesn't do anything for me (it generates makefiles, i have makefiles already), i'm unconvinced it does much for platform independence except mostly a big if around stuff. all variables related to local build environments should go in re:imgui vs glfw functions: some code is c, some is c++ (as minimal as possible, only gui related and interfacing with rawspeed/exiv2). glfw is c, so there are some constraints as to when you can swap things around. |
I'm going to investigate the cause in the following days.
I would like essential ImGui components to control the processing on a single image, then extend for library management like in Ansel. Yes, I would like to get rid of GTK. For sure I will link with
Bad patch due to ramp up on the compilation flow of the project; I will force push the next days.
Thank you for the hint, I will investigate also this.
I will keep it separated. I found it more convenient than hand-written Makefiles for the long-term, but it could be optional for this work. For example, in shared libraries, it automatically handles all the different flags for other OSes.
Here, I need more experience in ImGui development to be helpful. I noticed the patch about |
c7f459d
to
0663632
Compare
Updated with only Makefile modifications. Now the error is:
Same error with updated ImGui (HEAD) and old version (HEAD~2). |
looks like you're lacking |
8322814
to
f93e947
Compare
Now Makefiles are more clean. Next error:
Same error for old and new ImGui+GLFW. Maybe is related to MoltenVK implementation of Vulkan on macOS? |
I rebased on master, GUI is working, |
@@ -6,6 +6,8 @@ | |||
.PHONY:all src clean distclean bin install release cli | |||
ifeq ($(OS),Windows_NT) | |||
include bin/config.mk.defaults.w64 | |||
else ifeq ($(OS),Darwin) | |||
include bin/config.mk.defaults.darwin |
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.
master has config.mk.defaults.osx
instead. probably makes sense to merge these.
@@ -53,7 +55,7 @@ endif | |||
|
|||
install-mod: bin Makefile | |||
mkdir -p $(VKDTDIR)/modules | |||
rsync -avP --include='**/params' --include='**/connectors' --include='**/*.ui' --include='**/ptooltips' --include='**/ctooltips' --include='**/readme.md' --include='**.spv' --include='**.so' --include '*/' --exclude='**' bin/modules/ ${VKDTDIR}/modules/ | |||
rsync -avP --include='**/params' --include='**/connectors' --include='**/*.ui' --include='**/ptooltips' --include='**/ctooltips' --include='**/readme.md' --include='**.spv' --include='**.$(SEXT)' --include '*/' --exclude='**' bin/modules/ ${VKDTDIR}/modules/ |
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.
meh. don't really care about macintosh specific file endings. .so works on windows (and macintosh) just fine. i'm manually opening the file / dlopening the symbols anyways.
endif | ||
ifeq ($(VKDT_USE_QUAKE), 1) | ||
RELEASE_FILES+=$(shell cd src/pipe/modules/quake/quakespasm; git ls-files | sed -e 's#^#src/pipe/modules/quake/quakespasm/#') | ||
RELEASE_FILES+=$(shell cd src/pipe/modules/quake/quakespasm; git ls-files | sed -e 's\#^\#src/pipe/modules/quake/quakespasm/\#') |
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.
oh does that not work on osx? i need to test this change on linux/windows/my old macos
@@ -101,9 +101,16 @@ VKDT_VULKAN_CFLAGS=$(eval VKDT_VULKAN_CFLAGS := $$(shell pkg-config --cflags vul | |||
VKDT_VULKAN_LDFLAGS=$(eval VKDT_VULKAN_LDFLAGS := $$(shell pkg-config --libs vulkan))$(VKDT_VULKAN_LDFLAGS) |
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.
this one isn't even loaded on macintosh?
@@ -0,0 +1,144 @@ | |||
# build time configuration. |
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.
see above, please merge with config.mk.defaults.osx
@@ -59,7 +59,7 @@ export VKDT_USE_ALSA | |||
|
|||
# build the i-mcraw loader module to load raw video from the motioncam app. | |||
# it has no additional dependencies but comes with several ten thousand lines of c++ code | |||
VKDT_USE_MCRAW=1 | |||
VKDT_USE_MCRAW=0 |
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.
does that not work? newer master should have removed the SSE/x86 code in this module. i don't see a reason why it wouldn't work on arm now.
@@ -103,26 +103,25 @@ gui/%.o: gui/%.c Makefile $(GUI_H) gui/flat.mk | |||
# main application | |||
# ====================== | |||
../bin/vkdt: $(GUI_O) $(QVK_O) $(CORE_O) $(SND_O) $(PIPE_O) $(DB_O) Makefile | |||
$(CC) $(GUI_O) $(QVK_O) $(CORE_O) $(SND_O) $(PIPE_O) $(DB_O) -pie -o $@ \ |
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.
probably needs some mechanism to put it back on none-macintosh systems.
@@ -52,7 +68,7 @@ fs_copy( | |||
if(sb.st_mode & S_IFDIR) { len = 0; goto copy_error; } // don't copy directories | |||
if(-1 == (fd1 = open(dst, O_CREAT | O_WRONLY | O_TRUNC, 0644))) goto copy_error; | |||
do { | |||
ret = sendfile(fd1, fd0, 0, len); // works on linux >= 2.6.33, else fd1 would need to be a socket | |||
ret = os_sendfile(fd1, fd0, 0, len); // works on linux >= 2.6.33, else fd1 would need to be a socket |
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.
this code path is not called any more on macintosh.
@@ -206,8 +222,8 @@ fs_basedir( | |||
snprintf(basedir, maxlen, "%s", path); | |||
fs_dirname(basedir); | |||
#elif defined(__APPLE__) | |||
pid_t pid = getpid(); | |||
proc_pidpath (pid, basedir, maxlen); | |||
uint32_t len = maxlen; |
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.
this is probably equivalent?
@@ -471,8 +487,12 @@ fs_createtime( | |||
#else | |||
struct stat statbuf = {0}; | |||
stat(filename, &statbuf); | |||
#ifdef __APPLE__ |
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.
i think this is obsolete now, the ifdef is in the else path of another ifdef APPLE, no?
#endif | ||
else | ||
{ | ||
char tmp[PATH_MAX]; | ||
if(snprintf(tmp, sizeof(tmp), "%s/%s", dt_pipe.basedir, deffilename) >= PATH_MAX) | ||
return VK_INCOMPLETE; | ||
if(!stat(tmp, &statbuf)) | ||
#ifdef __APPLE__ |
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.
i think all these are fine in master already.
@@ -156,6 +159,9 @@ qvk_init(const char *preferred_device_name, int preferred_device_id, int window) | |||
VkInstanceCreateInfo inst_create_info = { | |||
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO, | |||
.pApplicationInfo = &vk_app_info, | |||
#ifdef __APPLE__ |
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.
master has this portability extension already, patch is probably obsolete.
Thank you @hanatos for checking everything, I will revise everything singularly next days 👍🏻 |
Dear all, I appreciate your work here and would like to try porting vkDT to Mac OS.
I'm not an experienced Mac OS developer; I want to give it a try to use the software on my MacBook.
My setup:
Ventura 13.5Sequoia 15.1Dependency (to improve the list):
brew
.brew
, installllvm
andlibomp
for custom compilation of therawspeed
library.ToDo:
rawspeed
: add controls for Apple target in 4894513imgui
: cherry-picked modifications from @hanatos fork to upstream in c57af75glfw
: use submodule to compile it with ImGuiUp to now, the commits are just a fast try to make it work.
I know there is a lot of rubbish from many points of view of programmers 😄
Thank you again for this software!