aboutsummaryrefslogtreecommitdiff
path: root/src/lua
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-02-24 00:19:41 +0200
committerPerttu Ahola <celeron55@gmail.com>2011-02-24 00:19:41 +0200
commit9f859d838937136703b3e5993f4148ef93b459e9 (patch)
tree1f51649918fe77384a64ca001717125c6dbcdf93 /src/lua
parentbfd098074816956f902ed89613565fda02ff6bcc (diff)
downloadminetest-9f859d838937136703b3e5993f4148ef93b459e9.tar.gz
minetest-9f859d838937136703b3e5993f4148ef93b459e9.tar.bz2
minetest-9f859d838937136703b3e5993f4148ef93b459e9.zip
modified the build system of lua to a more minimal one
Diffstat (limited to 'src/lua')
-rw-r--r--src/lua/CMakeLists.txt154
-rw-r--r--src/lua/src/CMakeLists.txt54
2 files changed, 41 insertions, 167 deletions
diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt
index 21bceebeb..c43dc1737 100644
--- a/src/lua/CMakeLists.txt
+++ b/src/lua/CMakeLists.txt
@@ -9,79 +9,54 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(CustomMacros)
-#enable_testing()
-
set(COMMON_CFLAGS)
set(COMMON_LDFLAGS)
set(LIBS)
-#
-# Detect system type
-#
-if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+
+if(APPLE)
set(DEFAULT_POSIX TRUE)
set(DEFAULT_DLOPEN ON)
- set(DEFAULT_READLINE ON)
- set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -Wl,-E")
-else(CMAKE_SYSTEM_NAME STREQUAL "Linux")
- if(APPLE)
- set(DEFAULT_POSIX TRUE)
- set(DEFAULT_DLOPEN ON)
- # use this on Mac OS X 10.3-
- option(LUA_USE_MACOSX "Mac OS X 10.3-" OFF)
- elseif(CYGWIN)
- set(DEFAULT_POSIX TRUE)
- elseif(UNIX)
- set(DEFAULT_POSIX TRUE)
- elseif(WIN32)
- set(LUA_WIN TRUE)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_BUILD_AS_DLL")
- else(APPLE)
- set(DEFAULT_ANSI TRUE)
- endif(APPLE)
-endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # use this on Mac OS X 10.3-
+ option(LUA_USE_MACOSX "Mac OS X 10.3-" OFF)
+elseif(CYGWIN)
+ set(DEFAULT_POSIX TRUE)
+elseif(UNIX)
+ set(DEFAULT_POSIX TRUE)
+elseif(WIN32)
+ set(LUA_WIN TRUE)
+ set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_BUILD_AS_DLL")
+else()
+ set(DEFAULT_ANSI TRUE)
+endif()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -Wl,-E -lm")
+ set(DEFAULT_DLOPEN ON)
+endif()
-#
-# setup config options
-#
if(WIN32)
- set(BUILD_STATIC OFF)
-else(WIN32)
- option(BUILD_STATIC "build static library" ON)
-endif(WIN32)
+ #set(BUILD_STATIC OFF)
+ set(BUILD_STATIC ON)
+else()
+ #option(BUILD_STATIC "build static library" ON)
+ set(BUILD_STATIC ON)
+endif()
if(DEFAULT_DLOPEN)
option(LUA_USE_DLOPEN "Enable dlopen support." ON)
-else(DEFAULT_DLOPEN)
+else()
option(LUA_USE_DLOPEN "Enable dlopen support." OFF)
-endif(DEFAULT_DLOPEN)
+endif()
if(DEFAULT_POSIX)
- option(LUA_USE_CURSES "Enable Curses support." ON)
- option(LUA_USE_MKSTEMP "Use mkstemp." ON)
- option(LUA_USE_ISATTY "Enable isatty support." ON)
- option(LUA_USE_POPEN "Enable lua_popen support." ON)
- option(LUA_USE_ULONGJMP "Try using _longjmp/_setjmp (more efficient)" ON)
-else(DEFAULT_POSIX)
- option(LUA_USE_CURSES "Enable Curses support." OFF)
- option(LUA_USE_MKSTEMP "Use mkstemp." OFF)
- option(LUA_USE_ISATTY "Enable isatty support." OFF)
- option(LUA_USE_POPEN "Enable lua_popen support." OFF)
- option(LUA_USE_ULONGJMP "Try using _longjmp/_setjmp (more efficient)" OFF)
-endif(DEFAULT_POSIX)
-
-if(DEFAULT_READLINE)
- option(LUA_USE_READLINE "Enable readline support." ON)
-else(DEFAULT_READLINE)
- option(LUA_USE_READLINE "Enable readline support." OFF)
-endif(DEFAULT_READLINE)
+else()
+endif()
if(DEFAULT_ANSI)
option(LUA_ANSI "Disable non-ansi features." ON)
-else(DEFAULT_ANSI)
+else()
option(LUA_ANSI "Disable non-ansi features." OFF)
-endif(DEFAULT_ANSI)
-
-option(LUA_USE_APICHECK "Enable API checks." OFF)
+endif()
#
# Lua version
@@ -93,27 +68,11 @@ set(LUA_VERSION
"${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
set(LUA_SOVERSION
"${LUA_VERSION_MAJOR}")
-#
-# Lua package info.
-#
-set(CPACK_PACKAGE_VERSION_MAJOR ${LUA_VERSION_MAJOR})
-set(CPACK_PACKAGE_VERSION_MINOR ${LUA_VERSION_MINOR})
-set(CPACK_PACKAGE_VERSION_PATCH ${LUA_VERSION_PATCH})
-set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT")
-#set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README")
-set(CPACK_PACKAGE_VENDOR "Lua.org, PUC-Rio.")
-set(CPACK_SOURCE_GENERATOR "TGZ")
-set(CPACK_SOURCE_IGNORE_FILES
-"/\\\\.;/\\\\.git.*/;~$;build/;CMakeFiles/;CMakeCache;Testing/;cmake_install;CPack;Dart;Makefile$")
-set(CPACK_SOURCE_PACKAGE_FILE_NAME
- "${CMAKE_PROJECT_NAME}-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
-# MUST be after CPACK_* variables.
-include(CPack)
#
# libs & cflags
#
-set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -lm ")
+set(COMMON_LDFLAGS "${COMMON_LDFLAGS}")
# For "Mac OS X 10.3-"
if(LUA_USE_MACOSX)
@@ -121,52 +80,17 @@ if(LUA_USE_MACOSX)
set(LUA_USE_DLOPEN FALSE)
endif(LUA_USE_MACOSX)
-# enable options
if(LUA_USE_DLOPEN)
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_DLOPEN")
if(NOT APPLE)
set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -ldl ")
endif(NOT APPLE)
endif(LUA_USE_DLOPEN)
-if(LUA_USE_MKSTEMP)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_MKSTEMP")
-endif(LUA_USE_MKSTEMP)
-if(LUA_USE_ISATTY)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_ISATTY")
-endif(LUA_USE_ISATTY)
-if(LUA_USE_POPEN)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_POPEN")
-endif(LUA_USE_POPEN)
-if(LUA_USE_ULONGJMP)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_ULONGJMP")
-endif(LUA_USE_ULONGJMP)
-if(LUA_USE_APICHECK)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_APICHECK")
-endif(LUA_USE_APICHECK)
+
if(LUA_ANSI)
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_ANSI")
endif(LUA_ANSI)
-# readline support
-if(LUA_USE_READLINE)
- FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h)
- FIND_LIBRARY(READLINE_LIBRARY NAMES readline)
- if(READLINE_LIBRARY)
- set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_READLINE")
- set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -lreadline -lhistory")
- include_directories(${READLINE_INCLUDE_DIR})
- endif(READLINE_LIBRARY)
-endif(LUA_USE_READLINE)
-
-# curses
-if(LUA_USE_CURSES)
- include(FindCurses)
- if(CURSES_LIBRARY)
- include_directories(${CURSES_INCLUDE_DIR})
- set(LIBS ${LIBS} ${CURSES_LIBRARY})
- endif(CURSES_LIBRARY)
-endif(LUA_USE_CURSES)
-
#
# standard flags to use for each build type.
#
@@ -179,19 +103,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
endif(CMAKE_COMPILER_IS_GNUCC)
#
-# Install extra header files & manpages
-#
-#install(FILES
-# etc/lua.hpp
-# DESTINATION include)
-#install(FILES
-# doc/lua.1
-# doc/luac.1
-# DESTINATION man/man1)
-
-#
# sub-folders
#
ADD_SUBDIRECTORY(src build)
-#ADD_SUBDIRECTORY(test)
diff --git a/src/lua/src/CMakeLists.txt b/src/lua/src/CMakeLists.txt
index 47fba6ce3..f9bfda85e 100644
--- a/src/lua/src/CMakeLists.txt
+++ b/src/lua/src/CMakeLists.txt
@@ -44,60 +44,22 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
#
# Lua library.
#
-if(BUILD_STATIC)
- add_library(lua STATIC ${LUA_CORE_SRC})
- add_target_properties(lua COMPILE_FLAGS "${COMMON_CFLAGS}")
- add_target_properties(lua LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
- target_link_libraries(lua ${LIBS})
- set(LUA_STATIC_LIB lua)
- set(LUA_LIBS lua)
-else(BUILD_STATIC)
- add_library(lua_static STATIC ${LUA_CORE_SRC})
- add_target_properties(lua_static COMPILE_FLAGS "${COMMON_CFLAGS}")
- add_target_properties(lua_static LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
- target_link_libraries(lua_static ${LIBS})
- set(LUA_STATIC_LIB lua_static)
+add_library(lua STATIC ${LUA_CORE_SRC})
+add_target_properties(lua COMPILE_FLAGS "${COMMON_CFLAGS}")
+add_target_properties(lua LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
+target_link_libraries(lua ${LIBS})
+set(LUA_STATIC_LIB lua)
+set(LUA_LIBS lua)
- add_library(lua SHARED ${LUA_CORE_SRC})
- add_target_properties(lua COMPILE_FLAGS "${COMMON_CFLAGS}")
- add_target_properties(lua LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
- target_link_libraries(lua ${LIBS})
-
- set(LUA_LIBS lua_static lua)
-endif(BUILD_STATIC)
set_target_properties(${LUA_LIBS} PROPERTIES
VERSION ${LUA_VERSION}
SOVERSION ${LUA_SOVERSION}
CLEAN_DIRECT_OUTPUT 1
)
-#
-# Lua compiler
-#
-add_executable(luac luac.c print.c)
-add_target_properties(luac COMPILE_FLAGS "${COMMON_CFLAGS}")
-add_target_properties(luac LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
-target_link_libraries(luac ${LUA_STATIC_LIB} ${LIBS})
-
-#
-# Lua stand-alone interpreter
-#
-add_executable(lua.bin lua.c)
-add_target_properties(lua.bin COMPILE_FLAGS "${COMMON_CFLAGS}")
-add_target_properties(lua.bin LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
-target_link_libraries(lua.bin lua ${LIBS})
-# rename lub.bin to lua
-set_target_properties(lua.bin PROPERTIES OUTPUT_NAME lua)
-
-#
-# install lua/luac & library.
-#
-install(TARGETS luac lua.bin ${LUA_LIBS}
+# Install library
+install(TARGETS ${LUA_LIBS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
-install(FILES
- ${LUA_LIB_HEADERS}
- DESTINATION include)
-