소스 검색

Support build for Lua 5.1 (for LuaJIT), Lua 5.2 and Lua 5.3 (Step 6/?)

See #195
bel2125 9 년 전
부모
커밋
e5adc3377d
2개의 변경된 파일31개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 3
      Makefile
  2. 27 1
      resources/Makefile.in-lua

+ 4 - 3
Makefile

@@ -77,13 +77,14 @@ else
   LCC = $(CC)
 endif
 
-ifdef WITH_LUAJIT_SHARED
-  WITH_LUA_SHARED = 1
+ifdef WITH_LUA_SHARED
   WITH_LUA = 1
 endif
 
-ifdef WITH_LUA_SHARED
+ifdef WITH_LUAJIT_SHARED
+  WITH_LUA_SHARED = 1
   WITH_LUA = 1
+  WITH_LUA_VERSION = 501
 endif
 
 ifdef WITH_LUA

+ 27 - 1
resources/Makefile.in-lua

@@ -9,7 +9,33 @@ ifndef WITH_LUA
   $(error WITH_LUA is not defined)
 endif
 
-LUA_DIR = src/third_party/lua-5.1.5/src
+# Lua Default version is 502
+WITH_LUA_VERSION ?= 502
+LUA_VERSION_KNOWN = 0
+
+# Select src and header according to the Lua version
+ifeq ($(WITH_LUA_VERSION), 501)
+  $(info Lua: Using version 5.1.5)
+  LUA_DIR = src/third_party/lua-5.1.5/src
+  LUA_VERSION_KNOWN = 1
+endif
+ifeq ($(WITH_LUA_VERSION), 502)
+  $(info Lua: Using version 5.2.4)
+  LUA_DIR = src/third_party/lua-5.2.4/src
+  LUA_VERSION_KNOWN = 1
+endif
+ifeq ($(WITH_LUA_VERSION), 503)
+  $(info Lua: Using version 5.3.0)
+  LUA_DIR = src/third_party/lua-5.3.0/src
+  LUA_VERSION_KNOWN = 1
+endif
+
+ifneq ($(LUA_VERSION_KNOWN), 1)
+  $(error Lua: Unknwon version - $(WITH_LUA_VERSION))
+endif
+
+
+# Add flags for all Lua versions
 LUA_CFLAGS = -I$(LUA_DIR) -DLUA_COMPAT_ALL -DUSE_LUA
 
 ifneq ($(TARGET_OS),WIN32)