Overlay/games-action/minetest/files/minetest-0.4.9-lua-luajit-o...

57 lines
1.6 KiB
Diff

commit d8dbda3636a91eba52c97450b58f767d5a4a376e
Author: hasufell <hasufell@gentoo.org>
Date: Mon Nov 25 00:25:55 2013 +0100
add USE_LUAJIT option
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a30dc98..a1fee7a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -179,24 +179,29 @@ if(USE_FREETYPE)
endif(USE_FREETYPE)
-find_library(LUA_LIBRARY luajit
- NAMES luajit-5.1)
-find_path(LUA_INCLUDE_DIR luajit.h
- NAMES luajit.h
- PATH_SUFFIXES luajit-2.0)
-message (STATUS "LuaJIT library: ${LUA_LIBRARY}")
-message (STATUS "LuaJIT headers: ${LUA_INCLUDE_DIR}")
+option(USE_LUAJIT "Use luajit instead of lua" OFF)
set(USE_LUAJIT 0)
-if(LUA_LIBRARY AND LUA_INCLUDE_DIR)
- message (STATUS "LuaJIT found.")
- set(USE_LUAJIT 1)
-else(LUA_LIBRARY AND LUA_INCLUDE_DIR)
- message (STATUS "LuaJIT not found, using bundled Lua.")
- set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src")
- set(LUA_LIBRARY "lua")
- add_subdirectory(lua)
-endif(LUA_LIBRARY AND LUA_INCLUDE_DIR)
+if(USE_LUAJIT)
+ find_library(LUA_LIBRARY luajit
+ NAMES luajit-5.1)
+ find_path(LUA_INCLUDE_DIR luajit.h
+ NAMES luajit.h
+ PATH_SUFFIXES luajit-2.0)
+ if(LUA_LIBRARY AND LUA_INCLUDE_DIR)
+ message (STATUS "LuaJIT found")
+ set(USE_LUAJIT 1)
+ else(LUA_LIBRARY AND LUA_INCLUDE_DIR)
+ message (FATAL_ERROR "LuaJIT not found!")
+ endif(LUA_LIBRARY AND LUA_INCLUDE_DIR)
+else(USE_LUAJIT)
+ find_package(Lua51)
+ if(LUA51_FOUND)
+ message (STATUS "Lua51 found")
+ else(LUA51_FOUND)
+ message (FATAL_ERROR "Lua51 not found!")
+ endif(LUA51_FOUND)
+endif(USE_LUAJIT)
mark_as_advanced(LUA_LIBRARY)
mark_as_advanced(LUA_INCLUDE_DIR)