OpenTomb icon indicating copy to clipboard operation
OpenTomb copied to clipboard

Add selection of system LUA and BULLET libs

Open carlo-bramini opened this issue 6 years ago • 5 comments

This patch includes support for selecting system provided LUA 5.3 (and newer) and BULLET, in a similar manner it had been done for FreeType.

  • Added two new options, FORCE_SYSTEM_LUA and FORCE_SYSTEM_BULLET. By default, they are OFF so the internal copies or the libraries will be used without parameters. LUA is accepted only if version 5.3 or newer is found.

  • Added a new file, src/core/lua.h, used for including LUA stuff.

  • Inside src/core/lua.h, include directive has been changed from: #include <lua.h> to: #include "lua.h" as it has been written in the CMAKE documentation: https://cmake.org/cmake/help/v3.0/module/FindLua.html

Tested with MINGW-W64 cross compiler: LUA 5.2 is rejected, BULLET is not found. Tested with MSVC Community 2017: LUA 5.3 and BULLET are found and accepted.

carlo-bramini avatar Mar 18 '18 14:03 carlo-bramini

thanks, good idea... I will try to review the changes. minimum LUA version is 5.3

TeslaRus avatar Mar 19 '18 07:03 TeslaRus

I have set a variable called LUA_MIN_VERSION for checking the minimum version of the LUA package. If, in the future, there will be the need to use a more recent version than 5.3, you can just change that variable.

carlo-bramini avatar Mar 19 '18 09:03 carlo-bramini

Hi, I tried on Linux your CMakeLists.txt modifications for using system-provided Lua, but I did not modify lua.h header inclusion. Everything worked fine on Xubuntu 17.10. Is it also working without lua.h modifications on Windows ? I'm thinking that CMake documentation is telling that specifying "lua" directory when including lua/lua.h is not portable, but for me using #include "lua.h" or #include <lua.h> here does not change anything (both system-provided and OpenTomb-provided lua are working on my Linux distro).

RICCIARDI-Adrien avatar Apr 29 '18 09:04 RICCIARDI-Adrien

I was forced to change #include <lua.h> to #include "lua.h", othewise I got an error when compiling with VisualStudio 2017.

carlo-bramini avatar May 02 '18 08:05 carlo-bramini

Hi @carlo-bramini, maybe you can do another pull request containing bullet-related modifications only, so they get included (they were working fine on Linux). Lua stuff could be done in a second time.

RICCIARDI-Adrien avatar Jan 13 '19 09:01 RICCIARDI-Adrien