agracio / edge-js

Run .NET and Node.js code in-process on Windows, macOS, and Linux
MIT License
618 stars 93 forks source link

Update target c++ standard to 17 to support new MacOS #187

Closed tripheo0412 closed 8 months ago

tripheo0412 commented 8 months ago

Building on Mac M1 using Node 18 is fine. When building on Node 19 or 20 we got an error due to incompatible with C++17 Issue #186

Solution is to force newer c++ 17 standard for complier instead of the old one c++ 14. Edit binding.gyp

      'cflags+': [
-        '-DHAVE_CORECLR -D_NO_ASYNCRTIMP -std=c++14 -Wno-reorder -Wno-sign-compare -Wno-mismatched-tags -Wno-missing-braces -Wno-redundant-move -Wno-deprecated-declarations -Wno-unused-private-field -Wno-unused-variable'
+        '-DHAVE_CORECLR -D_NO_ASYNCRTIMP -std=c++17 -Wno-reorder -Wno-sign-compare -Wno-mismatched-tags -Wno-missing-braces -Wno-redundant-move -Wno-deprecated-declarations -Wno-unused-private-field -Wno-unused-variable'
      ],
      'xcode_settings': {
        'OTHER_CFLAGS': [
          '-DHAVE_CORECLR -D_NO_ASYNCRTIMP -Wno-reorder -Wno-sign-compare -Wno-mismatched-tags -Wno-missing-braces -Wno-redundant-move -Wno-deprecated-declarations -Wno-unused-private-field -Wno-unused-variable'
        ],
        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
        'GCC_ENABLE_CPP_RTTI': 'YES',
-       'CLANG_CXX_LANGUAGE_STANDARD': 'c++14',
+       'CLANG_CXX_LANGUAGE_STANDARD': 'c++17',
        'CLANG_CXX_LIBRARY': 'libc++',
        'MACOSX_DEPLOYMENT_TARGET': '10.7'
      },
      'cflags+': [
-        '-DHAVE_NATIVECLR -std=c++14'
+        '-DHAVE_NATIVECLR -std=c++17'
      ],