File tree 3 files changed +67
-27
lines changed
3 files changed +67
-27
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ # Locate LuaJIT library
2
+ # This module defines
3
+ # LUAJIT_FOUND, if false, do not try to link to Lua
4
+ # LUA_INCLUDE_DIR, where to find lua.h
5
+ # LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
6
+ #
7
+ # This module is similar to FindLua51.cmake except that it finds LuaJit instead.
8
+
9
+ FIND_PATH (LUA_INCLUDE_DIR luajit.h
10
+ HINTS
11
+ $ENV{LUA_DIR}
12
+ PATH_SUFFIXES include /luajit-2.0 include /luajit-5_1-2.0 include
13
+ PATHS
14
+ ~/Library/Frameworks
15
+ /Library/Frameworks
16
+ /sw # Fink
17
+ /opt/local # DarwinPorts
18
+ /opt/csw # Blastwave
19
+ /opt
20
+ )
21
+
22
+ FIND_LIBRARY (LUA_LIBRARY
23
+ NAMES luajit-5.1
24
+ HINTS
25
+ $ENV{LUA_DIR}
26
+ PATH_SUFFIXES lib64 lib
27
+ PATHS
28
+ ~/Library/Frameworks
29
+ /Library/Frameworks
30
+ /sw
31
+ /opt/local
32
+ /opt/csw
33
+ /opt
34
+ )
35
+
36
+ IF (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR} /luajit.h" )
37
+ FILE (STRINGS "${LUA_INCLUDE_DIR} /luajit.h" lua_version_str REGEX "^#define[ \t ]+LUA_RELEASE[ \t ]+\" LuaJIT .+\" " )
38
+
39
+ STRING (REGEX REPLACE "^#define[ \t ]+LUA_RELEASE[ \t ]+\" LuaJIT ([^\" ]+)\" .*" "\\ 1" LUA_VERSION_STRING "${lua_version_str} " )
40
+ UNSET (lua_version_str)
41
+ ENDIF ()
42
+
43
+ INCLUDE (FindPackageHandleStandardArgs)
44
+ # handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
45
+ # all listed variables are TRUE
46
+ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
47
+ REQUIRED_VARS LUA_LIBRARY LUA_INCLUDE_DIR
48
+ VERSION_VAR LUA_VERSION_STRING)
49
+
50
+ MARK_AS_ADVANCED (LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY)
Original file line number Diff line number Diff line change @@ -155,8 +155,23 @@ if(ENABLE_FREETYPE)
155
155
endif ()
156
156
endif (ENABLE_FREETYPE)
157
157
158
-
159
- find_package (Lua REQUIRED)
158
+ # LuaJIT
159
+ option (ENABLE_LUAJIT "Enable LuaJIT support" TRUE )
160
+ set (USE_LUAJIT FALSE )
161
+ if (ENABLE_LUAJIT)
162
+ find_package (LuaJIT)
163
+ if (LUAJIT_FOUND)
164
+ set (USE_LUAJIT TRUE )
165
+ endif (LUAJIT_FOUND)
166
+ else ()
167
+ message (STATUS "LuaJIT detection disabled! (ENABLE_LUAJIT=0)" )
168
+ endif ()
169
+ if (NOT USE_LUAJIT)
170
+ message (STATUS "LuaJIT not found, using bundled Lua." )
171
+ set (LUA_LIBRARY "lua" )
172
+ set (LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR} /lua/src" )
173
+ add_subdirectory (lua)
174
+ endif ()
160
175
161
176
find_package (GMP REQUIRED)
162
177
You can’t perform that action at this time.
0 commit comments