cppexpose icon indicating copy to clipboard operation
cppexpose copied to clipboard

Handle duktape as external project

Open scheibel opened this issue 2 years ago • 2 comments

scheibel avatar Feb 05 '23 20:02 scheibel

Do we have a general concept for handling external dependencies (cmake's ExternalProject, or Conan, or ...)? Depending on system packages for external C++ dependencies is also not very nice ... But guessing from the titel, you are talking about using ExternalProject?

sbusch42 avatar Feb 05 '23 20:02 sbusch42

I thought about a similar approach we applied to the externalization of googletest / googlemock (effective as of https://github.com/cginternals/cmake-init/commit/0571c02c1f1210a7f8e31fde6750e8fbda3b8c6a). For those projects, an external setup by means of pkg-config was already established and we integrate them by being discoverable through find_package.

If we don't find something similar for duktape, I suggest we propose a change to the duktape project or fork from it.

Advantages:

  • Access to up-to-date duktape versions
  • No cluttering of our own sources

Disdavantages:

  • Another project to set up
  • If duktape does not come with a cmake-friendly environment, the implicit updates are not available

Ultimately, I'm also fine with leaving duktape as is, but the latest stack trace re-triggered this issue:

[ 34%] Building C object source/cppexpose/CMakeFiles/cppexpose.dir/source/scripting/duktape-1.4.0/duktape.c.o
cc1: warning: command-line option ‘-Wreorder’ is valid for C++/ObjC++ but not for C
duk_api_codec.c: In function ‘duk__base64_encode_helper’:
duk_api_codec.c:57:2: warning: switch missing default case [-Wswitch-default]
duk_bi_duktape.c: In function ‘duk_bi_duktape_object_info’:
duk_bi_duktape.c:57:2: warning: switch missing default case [-Wswitch-default]
duk_bi_json.c: In function ‘duk__enc_value1’:
duk_bi_json.c:2039:4: warning: switch missing default case [-Wswitch-default]
duk_js_compiler.c: In function ‘duk__expr_nud’:
duk_js_compiler.c:3269:2: warning: switch missing default case [-Wswitch-default]
duk_js_compiler.c: In function ‘duk__ispec_toregconst_raw’:
duk_js_compiler.c:1968:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
duk_js_compiler.c:2081:2: note: here
duk_js_executor.c: In function ‘duk__js_execute_bytecode_inner’:
duk_heap_stringtable.c:962:33: warning: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 11 [-Wformat-truncation=]
duk_heap_stringtable.c:962:33: note: directive argument in the range [0, 18446744073709551614]
In file included from /usr/include/stdio.h:894,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duk_config.h:664,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duktape.h:126,
                 from duk_internal.h:26:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 21 bytes into a destination of size 11
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
duk_bi_date.c: In function ‘duk_bi_date_prototype_tostring_shared’:
duk_bi_date.c:984:39: warning: ‘%02d’ directive output may be truncated writing 2 bytes into a region of size between 0 and 4 [-Wformat-truncation=]
duk_bi_date.c:984:39: note: directive argument in the range [0, 59]
In file included from /usr/include/stdio.h:894,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duk_config.h:664,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duktape.h:126,
                 from duk_internal.h:26:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 7 and 11 bytes into a destination of size 8
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
duk_bi_date.c:981:39: warning: ‘%02d’ directive output may be truncated writing 2 bytes into a region of size between 0 and 4 [-Wformat-truncation=]
duk_bi_date.c:981:39: note: directive argument in the range [0, 59]
In file included from /usr/include/stdio.h:894,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duk_config.h:664,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duktape.h:126,
                 from duk_internal.h:26:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 7 and 11 bytes into a destination of size 8
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
duk_hobject_props.c: In function ‘duk__realloc_props’:
duk_heap_stringtable.c:962:33: warning: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 11 [-Wformat-truncation=]
duk_heap_stringtable.c:962:33: note: directive argument in the range [0, 18446744073709551614]
In file included from /usr/include/stdio.h:894,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duk_config.h:664,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duktape.h:126,
                 from duk_internal.h:26:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 21 bytes into a destination of size 11
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~
duk_hobject_enum.c: In function ‘duk_hobject_enumerator_create’:
duk_heap_stringtable.c:962:33: warning: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 11 [-Wformat-truncation=]
duk_heap_stringtable.c:962:33: note: directive argument in the range [0, 18446744073709551614]
In file included from /usr/include/stdio.h:894,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duk_config.h:664,
                 from /home/scheibel/github.com/cginternals/cppexpose/source/cppexpose/source/scripting/duktape-1.4.0/duktape.h:126,
                 from duk_internal.h:26:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:71:10: note: ‘__builtin___snprintf_chk’ output between 2 and 21 bytes into a destination of size 11
   71 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   72 |                                    __glibc_objsize (__s), __fmt,
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   73 |                                    __va_arg_pack ());
      |                                    ~~~~~~~~~~~~~~~~~

scheibel avatar Feb 05 '23 22:02 scheibel