-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Replace Luabind with Sol2 #3382
Conversation
|
||
// TODO: do we want this? | ||
//"get_nodes", | ||
//&osmium::Way::nodes); |
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.
Yeah we need to have a 1:1 feature parity with our old Luabind code. Please go over both impls. and check this.
(Sorry that was me being lazy not registering all functions in the initial pass)
context.state.new_type<RasterDatum>("RasterDatum", | ||
"datum", &RasterDatum::datum, | ||
"invalid_data", &RasterDatum::get_invalid); | ||
*/ |
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.
Same here before we can merge this.
6391a29
to
958354a
Compare
{ | ||
auto get_value_by_key(const char *key, const char *default_value = nullptr) const | ||
{ | ||
return way.get_value_by_key(key, default_value); |
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.
note the recent change to return null instead of empty tags
479a2bb
to
c67cb66
Compare
@@ -91,6 +91,7 @@ endif() | |||
|
|||
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include/) | |||
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/include/) | |||
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/third_party/) |
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.
Hm can you vendor the package at third_party/sol2/ add this path here and then
third_party/sol2/sol2/sol.hpp
^ includedir points here
so the user can still do include <sol2/sol.hpp>
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.
also below: can you rebase on master, all access restricted tags should be gone by now - if not please ping me
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.
Already rebased, which is how I picked up on the missing sol directory includes. I'll update how the sol header is saved and update in the cmakelists now.
@@ -46,6 +46,7 @@ struct ExtractionWay | |||
roundabout = false; | |||
circular = false; | |||
is_startpoint = true; | |||
ignore_in_grid = false; |
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.
Could this be left-over code? I wanted to check for it but could not find it in the remaining parts of the PR.
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 added this field. Sol was erroring in places where we set this property in bicycle/foot profiles but hadn't registered a corresponding field in the bindings. I'm not sure how luabind handled this before.
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 did some digging. Seems the profiles are out of date. That flag was removed in faa880d
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.
Capturing from chat: Next actions:
- remove dead flag (ignore_in_grid) from foot/bicycle profile
- remove bindings for (ignore_in_grid)
- remove ignore_in_grid from extraction_way.hpp
e715643
to
3c7834f
Compare
745d37c
to
6ca1521
Compare
I checked compatibility with Lua 5.1 and 5.2 by building osrm with both versions and running tests. They check out OK; if there's any further testing I should do, lmk @MoKob @daniel-j-h |
6ca1521
to
769a6ab
Compare
@daniel-j-h @TheMarex review? |
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.
Almost read for merging once we pushed 5.5 out. 🎉 👋 luabind. We should also mark https://github.com/mapbox/luabind as deprecated since we won't support this anymore.
@@ -282,15 +282,15 @@ endif() | |||
|
|||
# Configuring compilers | |||
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics") | |||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Wuninitialized -Wunreachable-code -Wstrict-overflow=2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fPIC -fcolor-diagnostics -ftemplate-depth=1024") |
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.
😿
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.
clang has a default limit of 256, gcc has 1024 - this is fine 👍
#define SCRIPTING_ENVIRONMENT_LUA_HPP | ||
|
||
#include "extractor/scripting_environment.hpp" | ||
#ifndef SCRIPTING_ENVIRONMENT_SOL2_HPP |
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.
Hm why did we rename this file? Sure the library that we use for executing lua changed but this is still for executing lua code.
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 did this back a month ago when I was experimenting with sol2 and still had the luabind files around - this can change now
} | ||
} | ||
|
||
void Sol2ScriptingContext::processNode(const osmium::Node &node, ExtractionNode &result) |
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.
Naming convention would be ProcessNode
.
node_function(node, result); | ||
} | ||
|
||
void Sol2ScriptingContext::processWay(const osmium::Way &way, ExtractionWay &result) |
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.
Naming convention would be ProcessWay
.
@@ -473,6 +465,33 @@ else() | |||
find_package(GDAL) | |||
endif() | |||
|
|||
FIND_PACKAGE(Lua 5.2 EXACT) |
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 we can now simplify all this logic down to find_package(Lua 5.1)
which will look for lua 5.1+. Sol seems to have a good support for all lua versions, unlike luabind.
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.
The check here was because of the Lua 5.3 memory issue and not specifically for Luabind - until we confirm the Lua 5.3 memory issues are gone simply by using sol we should keep it.
@@ -96,6 +96,7 @@ struct ExtractionWay | |||
bool roundabout; | |||
bool circular; | |||
bool is_startpoint; | |||
bool ignore_in_grid; |
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 seems like an accidental change.
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 this has to go - not only here but also in the profiles and the bindings, see #3382 (review)
ed88ad5
to
945f1ce
Compare
1909893
to
748895b
Compare
Windows build are failing:
Seems like the C++ |
Timing the switch:
|
These are great numbers and will lift some pressure from the guidance code! (Unrelated to this PR: the next step would be to instead of context switching for every node or way, we switch on a nodes-chunk and ways-chunk basis => #1777) |
@daniel-j-h where is |
Yes this looks like the file we need. It's just setting up the includes for the C name mangling. |
@daniel-j-h could you try again - I've updated and rebuilt that binary deps package.
|
748895b
to
fb81ec2
Compare
Rebased against master and force-pushed. Let's see if Appveyor is happy with it now. cc @karenzshea |
@BergWerkGIS thanks, this resolved it. Ready for merge now! 🎉 |
It's gone, Luabind is gone - I can't believe it! :) Updating the Wiki pages now. |
Issue
#3013
To quote @daniel-j-h
Tasklist
null
is backwards incompatibleRequirements / Relations
This is a pre-MLD task.