skei / SA_Toolkit

plugin toolkit/framework
MIT License
33 stars 1 forks source link

Question: Would it be possible to add macOS support ? #2

Closed dschiller closed 5 months ago

dschiller commented 5 months ago

Dear Tor, would it be possible to add macOS support for your toolkit ?

Best Dirk

dschiller commented 5 months ago

i see "no mac version planned"

skei commented 5 months ago

i don't have a mac, and don't plan to get one.. so it would need input from someone else..

dschiller commented 5 months ago

i was guessing that this may be the issue. i have a mac here and could fix some smaller things like OpenGL and malloc but now i am facing the issue with XCB_NONE and don't know where it is defined. i try to build w/o a ui currently to get it build only as a plugin w/o ui.

Also in order to build it i need to go into the build folder as the following fails:

./build/compile build/build.cpp -o build.clap -f clap -g nogui -d
clang: error: no such file or directory: 'build.cpp'

But this works:

cd build
./compile build.cpp -o build.clap -f clap -g nogui -d
...

Here are my two changes:

Screenshot 2024-06-09 at 13 21 14

Screenshot 2024-06-09 at 13 21 44

which works okay so far.

And those are the errors i currently get with XCB_NONE:

dirk.schiller@FVFF512MQ05N build % ./compile build.cpp -o build.clap -f clap -g nogui -d            
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:10:
In file included from ../src/base/sat_types.h:17:
In file included from ../src/base/type/sat_string.h:7:
../src/base/util/sat_convert.h:27:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
  sprintf(AString,format_string,AValue);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:10:
In file included from ../src/base/sat_types.h:17:
In file included from ../src/base/type/sat_string.h:7:
../src/base/util/sat_convert.h:38:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
  sprintf(AString,format_string,AValue);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:11:
In file included from ../src/base/sat_global.h:5:
In file included from ../src/base/sat_debug.h:5:
../src/base/sat_print.h:116:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
      sprintf(buffer, SAT_TERM_FG_YELLOW "%.6f" SAT_TERM_RESET ":",time);
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:11:
In file included from ../src/base/sat_global.h:5:
In file included from ../src/base/sat_debug.h:5:
../src/base/sat_print.h:127:69: error: use of undeclared identifier 'thread_id'
      sprintf(buffer, SAT_TERM_FG_MAGENTA "%08x" SAT_TERM_RESET ":",thread_id);
                                                                    ^
../src/base/sat_print.h:138:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    sprintf(line_str, SAT_TERM_FG_CYAN "%i", ALine);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:11:
In file included from ../src/base/sat_global.h:5:
In file included from ../src/base/sat_debug.h:5:
../src/base/sat_print.h:158:5: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
    vsprintf(MPrintBuffer,format,args);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:11:
In file included from ../src/base/sat_global.h:6:
../src/base/sat_log_file.h:160:7: error: unknown type name 'SAT_CurrentTime'
      SAT_CurrentTime time = {0};
      ^
../src/base/sat_log_file.h:205:32: error: use of undeclared identifier 'SAT_GetHomePath'
      dprint("Home path: %s\n",SAT_GetHomePath(buffer));
                               ^
../src/base/sat_log_file.h:206:35: error: use of undeclared identifier 'SAT_GetDesktopPath'
      dprint("Desktop path: %s\n",SAT_GetDesktopPath(buffer));
                                  ^
../src/base/sat_log_file.h:207:36: error: use of undeclared identifier 'SAT_GetBaseFilename'
      dprint("Base filename: %s\n",SAT_GetBaseFilename(buffer));
                                   ^
../src/base/sat_log_file.h:208:32: error: use of undeclared identifier 'SAT_GetBasePath'
      dprint("Base path: %s\n",SAT_GetBasePath(buffer));
                               ^
../src/base/sat_log_file.h:267:50: error: use of undeclared identifier 'thread_id'
              sprintf(temp,"[%.6f,%08x] %s",time,thread_id,str);
                                                 ^
../src/base/sat_log_file.h:306:9: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
        vsprintf(MTempBuffer,format,args);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:5:
In file included from ../src/sat.h:11:
In file included from ../src/base/sat_global.h:6:
../src/base/sat_log_file.h:332:9: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
        vsprintf(MTempBuffer,format,args);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:5:
../src/plugin/sat_parameter.h:310:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    sprintf(MValueText,"%.2f",AValue);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:6:
In file included from ../src/gui/painter/sat_base_painter.h:9:
../src/gui/painter/sat_painter_owner.h:14:13: error: unknown type name 'xcb_connection_t'
    virtual xcb_connection_t* on_painterOwner_getXcbConnection()  = 0; //{ return nullptr; }
            ^
../src/gui/painter/sat_painter_owner.h:15:13: error: unknown type name 'xcb_visualid_t'
    virtual xcb_visualid_t    on_painterOwner_getXcbVisual()      = 0; //{ return XCB_NONE; }
            ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:6:
In file included from ../src/gui/painter/sat_base_painter.h:10:
../src/gui/painter/sat_paint_target.h:14:13: error: unknown type name 'xcb_drawable_t'
    virtual xcb_drawable_t on_paintTarget_getXcbDrawable() = 0; //{ return XCB_NONE; }
            ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:34:
In file included from ../src/gui/painter/sat_nanovg_painter.h:9:
In file included from ../src/gui/sat_surface.h:6:
In file included from ../src/gui/surface/sat_base_surface.h:6:
../src/gui/surface/sat_surface_owner.h:20:13: error: unknown type name 'xcb_connection_t'
    virtual xcb_connection_t* on_surfaceOwner_getXcbConnection()  = 0; //{ return nullptr; }
            ^
../src/gui/surface/sat_surface_owner.h:21:13: error: unknown type name 'xcb_drawable_t'
    virtual xcb_drawable_t    on_surfaceOwner_getXcbDrawable()    = 0; //{ return XCB_NONE; }
            ^
../src/gui/surface/sat_surface_owner.h:22:13: error: unknown type name 'xcb_visualid_t'
    virtual xcb_visualid_t    on_surfaceOwner_getXcbVisual()      = 0; //{ return XCB_NONE; }
            ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:34:
In file included from ../src/gui/painter/sat_nanovg_painter.h:9:
In file included from ../src/gui/sat_surface.h:23:
In file included from ../src/gui/surface/sat_nanovg_surface.h:9:
../src/gui/painter/sat_paint_source.h:14:13: error: unknown type name 'xcb_drawable_t'
    virtual xcb_drawable_t on_paintSource_getXcbDrawable() = 0; //{ return XCB_NONE; }
            ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:34:
In file included from ../src/gui/painter/sat_nanovg_painter.h:9:
In file included from ../src/gui/sat_surface.h:23:
../src/gui/surface/sat_nanovg_surface.h:80:3: error: unknown type name 'xcb_connection_t'
  xcb_connection_t* on_painterOwner_getXcbConnection()  override { return nullptr; }  // MConnection; }
  ^
../src/gui/surface/sat_nanovg_surface.h:81:3: error: unknown type name 'xcb_visualid_t'
  xcb_visualid_t    on_painterOwner_getXcbVisual()      override { return XCB_NONE; } // MScreenVisual; }
  ^
../src/gui/surface/sat_nanovg_surface.h:92:3: error: unknown type name 'xcb_drawable_t'
  xcb_drawable_t    on_paintSource_getXcbDrawable()     override { return XCB_NONE; }
  ^
../src/gui/surface/sat_nanovg_surface.h:102:3: error: unknown type name 'xcb_drawable_t'
  xcb_drawable_t    on_paintTarget_getXcbDrawable()     override { return XCB_NONE; }
  ^
../src/gui/surface/sat_nanovg_surface.h:117:11: warning: 'getImage' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  int32_t getImage() {
          ^
../src/gui/surface/sat_base_surface.h:41:19: note: overridden virtual function is here
  virtual int32_t getImage()    { return 0; }
                  ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:34:
In file included from ../src/gui/painter/sat_nanovg_painter.h:9:
In file included from ../src/gui/sat_surface.h:23:
../src/gui/surface/sat_nanovg_surface.h:126:8: warning: 'select' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  void select() {
       ^
../src/gui/surface/sat_base_surface.h:42:19: note: overridden virtual function is here
  virtual void    select()      {}
                  ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:34:
In file included from ../src/gui/painter/sat_nanovg_painter.h:9:
In file included from ../src/gui/sat_surface.h:23:
../src/gui/surface/sat_nanovg_surface.h:132:8: warning: 'deselect' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
  void deselect() {
       ^
../src/gui/surface/sat_base_surface.h:43:19: note: overridden virtual function is here
  virtual void    deselect()    {}
                  ^
In file included from build.cpp:33:
In file included from ./../plugins/test/plugin_gui1.h:2:
In file included from ../src/plugin/sat_plugin.h:8:
In file included from ../src/plugin/sat_editor.h:8:
In file included from ../src/gui/window/sat_window_listener.h:8:
In file included from ../src/gui/sat_widget.h:6:
In file included from ../src/gui/widget/sat_base_widget.h:9:
In file included from ../src/gui/painter/sat_paint_context.h:6:
In file included from ../src/gui/sat_painter.h:34:
In file included from ../src/gui/painter/sat_nanovg_painter.h:9:
In file included from ../src/gui/sat_surface.h:23:
../src/gui/surface/sat_nanovg_surface.h:81:75: error: use of undeclared identifier 'XCB_NONE'
  xcb_visualid_t    on_painterOwner_getXcbVisual()      override { return XCB_NONE; } // MScreenVisual; }
                                                                          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
11 warnings and 20 errors generated.

i could create a branch and give feedback to you in order to find a way trough all the issues on mac possibly to make it run

skei commented 5 months ago

thanks a lot! help with getting it to potentially compile on a mac would be awesome! i never tried to compile with clang, and of course, never on a mac :-)

the xcb errors indicate that there might be some #ifdefs missing here and there (to get rid of all the gui related stuff).. there's places where i only differentiate between linux and win32.. mac should be considered there too.. i will look more into this!

dschiller commented 5 months ago

if possible could you give permission for my user to your repo so that i can create a branch and push my changes ?

Screenshot 2024-06-09 at 13 43 02

dschiller commented 5 months ago

found the issue with the compile script - forgot the -i flag which makes the script defaults to build.cpp.

dschiller commented 5 months ago

i fixed some places in the compile script which leads to other issues i will take a look into:

Screenshot 2024-06-09 at 14 05 29

Screenshot 2024-06-09 at 14 08 56

dirk.schiller@FVFF512MQ05N SA_Toolkit % ./build/compile -i build/build.cpp -o build.clap -f clap -g nogui -d -v
g++ build/build.cpp -o build.clap -std=gnu++17 -Wall -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-narrowing -pthread -Wl,--as-needed -DSAT_PLUGIN_CLAP -shared -fPIC -DSAT_LIBRARY -DSAT_NO_GUI -DSAT_DEBUG -g -export-dynamic -I./src -lm -ldl -lrt
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:10:
In file included from ./src/base/sat_types.h:17:
In file included from ./src/base/type/sat_string.h:7:
./src/base/util/sat_convert.h:27:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
  sprintf(AString,format_string,AValue);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:10:
In file included from ./src/base/sat_types.h:17:
In file included from ./src/base/type/sat_string.h:7:
./src/base/util/sat_convert.h:38:3: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
  sprintf(AString,format_string,AValue);
  ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:5:
In file included from ./src/base/sat_debug.h:5:
./src/base/sat_print.h:116:7: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
      sprintf(buffer, SAT_TERM_FG_YELLOW "%.6f" SAT_TERM_RESET ":",time);
      ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:5:
In file included from ./src/base/sat_debug.h:5:
./src/base/sat_print.h:127:69: error: use of undeclared identifier 'thread_id'
      sprintf(buffer, SAT_TERM_FG_MAGENTA "%08x" SAT_TERM_RESET ":",thread_id);
                                                                    ^
./src/base/sat_print.h:138:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    sprintf(line_str, SAT_TERM_FG_CYAN "%i", ALine);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:5:
In file included from ./src/base/sat_debug.h:5:
./src/base/sat_print.h:158:5: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
    vsprintf(MPrintBuffer,format,args);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:6:
./src/base/sat_log_file.h:160:7: error: unknown type name 'SAT_CurrentTime'
      SAT_CurrentTime time = {0};
      ^
./src/base/sat_log_file.h:205:32: error: use of undeclared identifier 'SAT_GetHomePath'
      dprint("Home path: %s\n",SAT_GetHomePath(buffer));
                               ^
./src/base/sat_log_file.h:206:35: error: use of undeclared identifier 'SAT_GetDesktopPath'
      dprint("Desktop path: %s\n",SAT_GetDesktopPath(buffer));
                                  ^
./src/base/sat_log_file.h:207:36: error: use of undeclared identifier 'SAT_GetBaseFilename'
      dprint("Base filename: %s\n",SAT_GetBaseFilename(buffer));
                                   ^
./src/base/sat_log_file.h:208:32: error: use of undeclared identifier 'SAT_GetBasePath'
      dprint("Base path: %s\n",SAT_GetBasePath(buffer));
                               ^
./src/base/sat_log_file.h:267:50: error: use of undeclared identifier 'thread_id'
              sprintf(temp,"[%.6f,%08x] %s",time,thread_id,str);
                                                 ^
./src/base/sat_log_file.h:306:9: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
        vsprintf(MTempBuffer,format,args);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:6:
./src/base/sat_log_file.h:332:9: warning: 'vsprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead. [-Wdeprecated-declarations]
        vsprintf(MTempBuffer,format,args);
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:199:1: note: 'vsprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use vsnprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:8:
In file included from ./src/plugin/sat_editor.h:5:
./src/plugin/sat_parameter.h:310:5: warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations]
    sprintf(MValueText,"%.2f",AValue);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:180:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/cdefs.h:218:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))
                                                      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:8:
In file included from ./src/plugin/sat_editor.h:16:
In file included from ./src/plugin/editor/sat_no_editor.h:6:
./src/plugin/editor/sat_editor_listener.h:17:47: error: unknown type name 'SAT_Timer'
  virtual void        on_editorListener_timer(SAT_Timer* ATimer, double ADelta) {}
                                              ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:8:
In file included from ./src/plugin/sat_editor.h:16:
./src/plugin/editor/sat_no_editor.h:17:5: error: no matching constructor for initialization of 'SAT_BaseEditor'
  : SAT_BaseEditor(AListener,AWidth,AHeight,AScale,AProportional) {
    ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./src/plugin/editor/sat_base_editor.h:14:3: note: candidate constructor not viable: requires 3 arguments, but 5 were provided
  SAT_BaseEditor(SAT_EditorListener* AListener, uint32_t AWidth, uint32_t AHeight/*, double AScale=1.0, bool AProportional=false*/) {
  ^
./src/plugin/editor/sat_base_editor.h:8:7: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 5 were provided
class SAT_BaseEditor {
      ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:10:
In file included from ./src/base/sat_types.h:18:
./src/base/type/sat_tree.h:14:17: warning: private field 'MParent' is not used [-Wunused-private-field]
  SAT_TreeNode* MParent;
                ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:5:
In file included from ./src/base/sat_debug.h:20:
./src/base/debug/sat_debug_crash_handler.h:56:15: warning: private field 'MSignalNames' is not used [-Wunused-private-field]
  const char* MSignalNames[32] = {
              ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:6:
./src/base/sat_log_file.h:47:15: warning: private field 'MLogfileName' is not used [-Wunused-private-field]
  char        MLogfileName[SAT_MAX_PATH_LENGTH] = {0};
              ^
./src/base/sat_log_file.h:49:15: warning: private field 'MDesktopPath' is not used [-Wunused-private-field]
  char        MDesktopPath[SAT_MAX_PATH_LENGTH] = {0};
              ^
./src/base/sat_log_file.h:50:15: warning: private field 'MFilename' is not used [-Wunused-private-field]
  char        MFilename[SAT_MAX_PATH_LENGTH*2]  = {0};
              ^
In file included from build/build.cpp:33:
In file included from build/../plugins/test/plugin_gui1.h:2:
In file included from ./src/plugin/sat_plugin.h:5:
In file included from ./src/sat.h:11:
In file included from ./src/base/sat_global.h:8:
./src/base/sat_registry.h:37:27: warning: private field 'MPluginPath' is not used [-Wunused-private-field]
  char                    MPluginPath[1024] = {0};
                          ^
14 warnings and 9 errors generated.
dschiller commented 5 months ago

added a SAT_MAC define

dirk.schiller@FVFF512MQ05N SA_Toolkit % git diff
diff --git a/build/compile b/build/compile
index b614c36..73dc654 100755
--- a/build/compile
+++ b/build/compile
@@ -30,7 +30,11 @@ FLAGS+=" -Wl,--as-needed"
 #FLAGS+=" -static-libstdc++"

 INC=""
-INC+=" -I../src"
+if [[ "$OSTYPE" == "darwin"* ]]; then
+  INC+=" -I./src"
+else
+  INC+=" -I../src"
+fi

 PRELIB=""

@@ -78,8 +82,8 @@ do
     i)    INPUT=$OPTARG;;
     o)    OUTPUT=$OPTARG;;
     b)    BUILD_COUNT=$OPTARG;;
-    f)    FORMAT=${OPTARG^^};;
-    g)    GUI=${OPTARG^^};;
+    f)    FORMAT=$(echo "$OPTARG" | tr '[:lower:]' '[:upper:]');;
+    g)    GUI=$(echo "$OPTARG" | tr '[:lower:]' '[:upper:]');;
     w)    WIN32=true;;
     d)    DEBUG=true;;
     s)    SANITIZE=true;;
diff --git a/src/base/sat_defines.h b/src/base/sat_defines.h
index bf5e752..7682a73 100644
--- a/src/base/sat_defines.h
+++ b/src/base/sat_defines.h
@@ -10,6 +10,10 @@
   #define  SAT_WIN32
 #endif

+#if defined (__APPLE__) || (__MACH__)
+  #define  SAT_MAC
+#endif
+
 //----------

 #if defined (__i386__) || defined (_X86_) || defined (__X86__)
diff --git a/src/base/sat_print.h b/src/base/sat_print.h
index 8207877..905eca8 100644
--- a/src/base/sat_print.h
+++ b/src/base/sat_print.h
@@ -113,7 +113,11 @@ public:

     #ifdef SAT_PRINT_TIME
       double time = timeElapsed();
-      sprintf(buffer, SAT_TERM_FG_YELLOW "%.6f" SAT_TERM_RESET ":",time);
+      #ifdef SAT_MAC
+        snprintf(buffer, sizeof(buffer), SAT_TERM_FG_YELLOW "%.6f" SAT_TERM_RESET ":",time);
+      #else
+        sprintf(buffer, SAT_TERM_FG_YELLOW "%.6f" SAT_TERM_RESET ":",time);
+      #endif
       strcat(MPrefixBuffer,buffer);
     #endif

@@ -135,7 +139,11 @@ public:
     strcat(MPrefixBuffer,":");

     char line_str[16] = {0};
-    sprintf(line_str, SAT_TERM_FG_CYAN "%i", ALine);
+    #ifdef SAT_MAC
+      snprintf(line_str, sizeof(line_str), SAT_TERM_FG_CYAN "%i", ALine);
+    #else
+      sprintf(line_str, SAT_TERM_FG_CYAN "%i", ALine);
+    #endif
     strcat(MPrefixBuffer,line_str);
     strcat(MPrefixBuffer,SAT_TERM_RESET );

diff --git a/src/base/util/sat_convert.h b/src/base/util/sat_convert.h
index f182fa7..d488b57 100644
--- a/src/base/util/sat_convert.h
+++ b/src/base/util/sat_convert.h
@@ -24,7 +24,11 @@ char* SAT_FloatToString(char* AString, float AValue, uint32_t ADigits=3) {
   format_string[2] = 48 + ADigits;
   format_string[3] = 'f';
   format_string[4] = 0;
-  sprintf(AString,format_string,AValue);
+  #ifdef SAT_MAC
+    snprintf(AString,sizeof(AString),format_string,AValue);
+  #else
+    sprintf(AString,format_string,AValue);
+  #endif
   return AString;
 }

@@ -35,7 +39,11 @@ char* SAT_IntToString(char* AString, int32_t AValue) {
   format_string[0] = '%';
   format_string[1] = 'i';
   format_string[2] = 0;
-  sprintf(AString,format_string,AValue);
+  #ifdef SAT_MAC
+    snprintf(AString,sizeof(AString),format_string,AValue);
+  #else
+    sprintf(AString,format_string,AValue);
+  #endif
   return AString;
 }