Closed jcmonnin closed 4 years ago
Hi Jean-Claude,
That version-2.0
development was branched into c++17
. The latter branch requires a modern compiler with C++17 support, i.e. Visual C++ 2019, GCC 5.4.0 (not sure exactly).
You could try the c++17
version, I hope it will eventually be released as version 2.0.
Best regards Pavel
Thanks. I somehow missed that it evolved into the C++17 branch. The requirement on a C++17 compiler is fine for me. I will check that branch.
Hi Pavel,
I had no issue to upgrade to the C++17 branch on linux, however I'm stuck on windows.
Using the latest VisualStudio 2019 version (16.6.2), I get some compile errors (You cannot bind an lvalue to an rvalue reference
in class.hpp
).
I've spent a bit of time trying to track down what is going on. The VisualStudio solution with the test cases work fine, but the same code fails when copied to the application. It's build with CMake and looks like that this makes a difference. I've done a minimal test case in the v8pp repo to build the library and tests with CMake, and I get the same error when building the upstream test cases with CMake.
I've tried to track down the compiler setting differences, but so far I was unable to find the reason. I'll continue to track that issue tomorrow, but I wanted to check if you know what is going on here.
Thanks, Jean-Claude
CMake build files are in: https://github.com/jcmonnin/v8pp/tree/cmake
Running it gives:
C:\Users\jean-claude\Documents\src\v8pp\build>cmake -G Ninja ..
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/jean-claude/Documents/src/v8pp/build
C:\Users\jean-claude\Documents\src\v8pp\build>ninja -v
[0/1] "C:\Program Files\CMake\bin\cmake.exe" --regenerate-during-build -SC:\Users\jean-claude\Documents\src\v8pp -BC:\Users\jean-claude\Documents\src\v8pp\build
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/jean-claude/Documents/src/v8pp/build
[1/2] C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx64\x64\cl.exe /nologo /TP -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_COMPRESS_POINTERS -I..\. -I..\packages\v8-v142-x64.8.0.426.28\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 -std:c++17 /showIncludes /FoCMakeFiles\v8ppTest.dir\test\test_class.cpp.obj /FdCMakeFiles\v8ppTest.dir\ /FS -c ..\test\test_class.cpp
FAILED: CMakeFiles/v8ppTest.dir/test/test_class.cpp.obj
C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1426~1.288\bin\Hostx64\x64\cl.exe /nologo /TP -DV8_31BIT_SMIS_ON_64BIT_ARCH -DV8_COMPRESS_POINTERS -I..\. -I..\packages\v8-v142-x64.8.0.426.28\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 -std:c++17 /showIncludes /FoCMakeFiles\v8ppTest.dir\test\test_class.cpp.obj /FdCMakeFiles\v8ppTest.dir\ /FS -c ..\test\test_class.cpp
C:\Users\jean-claude\Documents\src\v8pp\v8pp/class.hpp(265): error C2664: 'v8::Local<v8::FunctionTemplate> v8pp::wrap_function_template<mem_func_type,Traits>(v8::Isolate *,F &&)': cannot convert argument 2 from 'mem_func_type' to 'F &&'
with
[
Traits=v8pp::raw_ptr_traits,
F=mem_func_type
]
and
[
F=mem_func_type
]
C:\Users\jean-claude\Documents\src\v8pp\v8pp/class.hpp(265): note: You cannot bind an lvalue to an rvalue reference
C:\Users\jean-claude\Documents\src\v8pp\v8pp/function.hpp(146): note: see declaration of 'v8pp::wrap_function_template'
..\test\test_class.cpp(184): note: see reference to function template instantiation 'v8pp::class_<X,Traits> &v8pp::class_<X,Traits>::function<int(__cdecl Xbase::* )(int)>(std::string_view,Function &&,v8::PropertyAttribute)' being compiled
with
[
Traits=v8pp::raw_ptr_traits,
Function=int (__cdecl Xbase::* )(int)
]
..\test\test_class.cpp(193): note: see reference to function template instantiation 'v8pp::class_<X,Traits> &v8pp::class_<X,Traits>::function<int(__cdecl Xbase::* )(int)>(std::string_view,Function &&,v8::PropertyAttribute)' being compiled
with
[
Traits=v8pp::raw_ptr_traits,
Function=int (__cdecl Xbase::* )(int)
]
..\test\test_class.cpp(482): note: see reference to function template instantiation 'void test_class_<v8pp::raw_ptr_traits>(void)' being compiled
C:\Users\jean-claude\Documents\src\v8pp\v8pp/class.hpp(265): error C2664: 'v8::Local<v8::FunctionTemplate> v8pp::wrap_function_template<mem_func_type,Traits>(v8::Isolate *,F &&)': cannot convert argument 2 from 'mem_func_type' to 'F &&'
with
[
Traits=v8pp::shared_ptr_traits,
F=mem_func_type
]
and
[
F=mem_func_type
]
C:\Users\jean-claude\Documents\src\v8pp\v8pp/class.hpp(265): note: You cannot bind an lvalue to an rvalue reference
C:\Users\jean-claude\Documents\src\v8pp\v8pp/function.hpp(146): note: see declaration of 'v8pp::wrap_function_template'
..\test\test_class.cpp(184): note: see reference to function template instantiation 'v8pp::class_<X,Traits> &v8pp::class_<X,Traits>::function<int(__cdecl Xbase::* )(int)>(std::string_view,Function &&,v8::PropertyAttribute)' being compiled
with
[
Traits=v8pp::shared_ptr_traits,
Function=int (__cdecl Xbase::* )(int)
]
..\test\test_class.cpp(193): note: see reference to function template instantiation 'v8pp::class_<X,Traits> &v8pp::class_<X,Traits>::function<int(__cdecl Xbase::* )(int)>(std::string_view,Function &&,v8::PropertyAttribute)' being compiled
with
[
Traits=v8pp::shared_ptr_traits,
Function=int (__cdecl Xbase::* )(int)
]
..\test\test_class.cpp(483): note: see reference to function template instantiation 'void test_class_<v8pp::shared_ptr_traits>(void)' being compiled
ninja: build stopped: subcommand failed.
The cmake build doesn't define /permissive-
by default (but new VisualStudio projects do).
The v8pp C++17 branch seems to require the permissive mode disabled in VisualStudio. I guess you might not want to fix it, as it's reasonable to disable permissive mode for new code, however it could be worthwhile to mention it in the docs. https://docs.microsoft.com/en-us/cpp/build/reference/permissive-standards-conformance
Disabling permissive mode required to do a surprising amount of fixes in the windows specific parts of our application, but it's good to have done it anyways.
Hi Jean-Claude,
thank you for the information! I've added an issue #138 for this feature that was long-standing inmy head.
Hi,
I have been using the 2.0 branch (with some custom patches). I need to upgrade the v8 version in my project from 7.3 to 8.3.
I noticed that there hasn't been any activities in the 2.0 branch for a while. v8pp version 1.7 has been updated to support recent v8 versions, but not the 2.0 branch.
I'm not sure if it's better to downgrade to v8pp 1.7 or to try to fix the 2.0 branch. Is the 2.0 branch dead or is it planned to continue that path eventually?
Kind regards, Jean-Claude