Skip to content
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

Include lua headers from custom directory #1496

Open
pfirsich opened this issue May 29, 2023 · 2 comments
Open

Include lua headers from custom directory #1496

pfirsich opened this issue May 29, 2023 · 2 comments

Comments

@pfirsich
Copy link

Unfortunately vcpkg has moved LuaJIT headers to a luajit/ subdirectory (microsoft/vcpkg#5863). It is my understanding that this means that sol2 can not be used with LuaJIT if both are installed via vcpkg, because soll will always look for lua.h, is that correct?

I would propose to provide a way to customize the include directory with something like SOL_LUA_INCLUDE_PATH_BASE or something that will be prepended to the header names before inclusion. Like this:

#define SOL_INCLUDE_PATH_BASE luajit/
#include <sol/sol.hpp>

This would require some ugly macro magic to build the correct include paths and probably make the includes a bit less readable.

Alternatively one could provide SOL_INCLUDE_PATH_LUA, SOL_INCLUDE_PATH_LAUXLIB and SOL_INCLUDE_PATH_LUALIB respectively to specify the paths directly.

Then I would just be able to do this:

#define SOL_INCLUDE_PATH_LUA <luajit/lua.h>
#define SOL_INCLUDE_PATH_LUALIB <luajit/lualib.h>
#define SOL_INCLUDE_PATH_LAUXLIB <luajit/lauxlib.h>
#include <sol/sol.hpp>

This way sol2 will be robust against any future changes in vcpkg package layouts as well.

@dg0yt
Copy link

dg0yt commented May 29, 2023

This will not solve the issue in a way which is relevant for vcpkg.

@pfirsich
Copy link
Author

@dg0yt sorry, I have trouble understanding what you are trying to say. Could you explain, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants