mirror of
https://github.com/minetest/minetest.git
synced 2024-12-23 22:52:25 +01:00
modified the build system of lua to a more minimal one
This commit is contained in:
parent
bfd0980748
commit
9f859d8389
@ -148,7 +148,7 @@ if(MSVC)
|
|||||||
|
|
||||||
# EHa enables SEH exceptions (used for catching segfaults)
|
# EHa enables SEH exceptions (used for catching segfaults)
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /MD /O2 /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
set(CMAKE_CXX_FLAGS_RELEASE "/EHa /MD /O2 /Ob2 /Oi /Ot /Oy /GL /FD /MT /GS- /arch:SSE /fp:fast /D NDEBUG /D _HAS_ITERATOR_DEBUGGING=0 /TP")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\"")
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/LTCG /NODEFAULTLIB:\"libcmtd.lib\" /NODEFAULTLIB:\"libcmt.lib\"")
|
||||||
|
|
||||||
# Debug build doesn't catch exceptions by itself
|
# Debug build doesn't catch exceptions by itself
|
||||||
# Add some optimizations because otherwise it's VERY slow
|
# Add some optimizations because otherwise it's VERY slow
|
||||||
|
@ -1562,15 +1562,20 @@ void Client::addNode(v3s16 p, MapNode n)
|
|||||||
{
|
{
|
||||||
JMutexAutoLock envlock(m_env_mutex);
|
JMutexAutoLock envlock(m_env_mutex);
|
||||||
|
|
||||||
|
TimeTaker timer1("Client::addNode()");
|
||||||
|
|
||||||
core::map<v3s16, MapBlock*> modified_blocks;
|
core::map<v3s16, MapBlock*> modified_blocks;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
TimeTaker timer3("Client::addNode(): addNodeAndUpdate");
|
||||||
m_env.getMap().addNodeAndUpdate(p, n, modified_blocks);
|
m_env.getMap().addNodeAndUpdate(p, n, modified_blocks);
|
||||||
}
|
}
|
||||||
catch(InvalidPositionException &e)
|
catch(InvalidPositionException &e)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
TimeTaker timer2("Client::addNode(): updateMeshes");
|
||||||
|
|
||||||
for(core::map<v3s16, MapBlock * >::Iterator
|
for(core::map<v3s16, MapBlock * >::Iterator
|
||||||
i = modified_blocks.getIterator();
|
i = modified_blocks.getIterator();
|
||||||
i.atEnd() == false; i++)
|
i.atEnd() == false; i++)
|
||||||
|
@ -54,6 +54,7 @@ void set_default_settings()
|
|||||||
g_settings.setDefault("fast_move", "false");
|
g_settings.setDefault("fast_move", "false");
|
||||||
|
|
||||||
g_settings.setDefault("enable_experimental", "false");
|
g_settings.setDefault("enable_experimental", "false");
|
||||||
|
g_settings.setDefault("creative_mode", "false");
|
||||||
|
|
||||||
g_settings.setDefault("objectdata_interval", "0.2");
|
g_settings.setDefault("objectdata_interval", "0.2");
|
||||||
g_settings.setDefault("active_object_range", "2");
|
g_settings.setDefault("active_object_range", "2");
|
||||||
|
@ -9,20 +9,10 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
|||||||
|
|
||||||
include(CustomMacros)
|
include(CustomMacros)
|
||||||
|
|
||||||
#enable_testing()
|
|
||||||
|
|
||||||
set(COMMON_CFLAGS)
|
set(COMMON_CFLAGS)
|
||||||
set(COMMON_LDFLAGS)
|
set(COMMON_LDFLAGS)
|
||||||
set(LIBS)
|
set(LIBS)
|
||||||
#
|
|
||||||
# Detect system type
|
|
||||||
#
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
||||||
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)
|
if(APPLE)
|
||||||
set(DEFAULT_POSIX TRUE)
|
set(DEFAULT_POSIX TRUE)
|
||||||
set(DEFAULT_DLOPEN ON)
|
set(DEFAULT_DLOPEN ON)
|
||||||
@ -35,53 +25,38 @@ else(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
set(LUA_WIN TRUE)
|
set(LUA_WIN TRUE)
|
||||||
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_BUILD_AS_DLL")
|
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_BUILD_AS_DLL")
|
||||||
else(APPLE)
|
else()
|
||||||
set(DEFAULT_ANSI TRUE)
|
set(DEFAULT_ANSI TRUE)
|
||||||
endif(APPLE)
|
endif()
|
||||||
endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
||||||
|
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||||
|
set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -Wl,-E -lm")
|
||||||
|
set(DEFAULT_DLOPEN ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
|
||||||
# setup config options
|
|
||||||
#
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(BUILD_STATIC OFF)
|
#set(BUILD_STATIC OFF)
|
||||||
else(WIN32)
|
set(BUILD_STATIC ON)
|
||||||
option(BUILD_STATIC "build static library" ON)
|
else()
|
||||||
endif(WIN32)
|
#option(BUILD_STATIC "build static library" ON)
|
||||||
|
set(BUILD_STATIC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(DEFAULT_DLOPEN)
|
if(DEFAULT_DLOPEN)
|
||||||
option(LUA_USE_DLOPEN "Enable dlopen support." ON)
|
option(LUA_USE_DLOPEN "Enable dlopen support." ON)
|
||||||
else(DEFAULT_DLOPEN)
|
else()
|
||||||
option(LUA_USE_DLOPEN "Enable dlopen support." OFF)
|
option(LUA_USE_DLOPEN "Enable dlopen support." OFF)
|
||||||
endif(DEFAULT_DLOPEN)
|
endif()
|
||||||
|
|
||||||
if(DEFAULT_POSIX)
|
if(DEFAULT_POSIX)
|
||||||
option(LUA_USE_CURSES "Enable Curses support." ON)
|
else()
|
||||||
option(LUA_USE_MKSTEMP "Use mkstemp." ON)
|
endif()
|
||||||
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)
|
|
||||||
|
|
||||||
if(DEFAULT_ANSI)
|
if(DEFAULT_ANSI)
|
||||||
option(LUA_ANSI "Disable non-ansi features." ON)
|
option(LUA_ANSI "Disable non-ansi features." ON)
|
||||||
else(DEFAULT_ANSI)
|
else()
|
||||||
option(LUA_ANSI "Disable non-ansi features." OFF)
|
option(LUA_ANSI "Disable non-ansi features." OFF)
|
||||||
endif(DEFAULT_ANSI)
|
endif()
|
||||||
|
|
||||||
option(LUA_USE_APICHECK "Enable API checks." OFF)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Lua version
|
# Lua version
|
||||||
@ -93,27 +68,11 @@ set(LUA_VERSION
|
|||||||
"${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
|
"${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}")
|
||||||
set(LUA_SOVERSION
|
set(LUA_SOVERSION
|
||||||
"${LUA_VERSION_MAJOR}")
|
"${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
|
# libs & cflags
|
||||||
#
|
#
|
||||||
set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -lm ")
|
set(COMMON_LDFLAGS "${COMMON_LDFLAGS}")
|
||||||
|
|
||||||
# For "Mac OS X 10.3-"
|
# For "Mac OS X 10.3-"
|
||||||
if(LUA_USE_MACOSX)
|
if(LUA_USE_MACOSX)
|
||||||
@ -121,52 +80,17 @@ if(LUA_USE_MACOSX)
|
|||||||
set(LUA_USE_DLOPEN FALSE)
|
set(LUA_USE_DLOPEN FALSE)
|
||||||
endif(LUA_USE_MACOSX)
|
endif(LUA_USE_MACOSX)
|
||||||
|
|
||||||
# enable options
|
|
||||||
if(LUA_USE_DLOPEN)
|
if(LUA_USE_DLOPEN)
|
||||||
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_DLOPEN")
|
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_USE_DLOPEN")
|
||||||
if(NOT APPLE)
|
if(NOT APPLE)
|
||||||
set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -ldl ")
|
set(COMMON_LDFLAGS "${COMMON_LDFLAGS} -ldl ")
|
||||||
endif(NOT APPLE)
|
endif(NOT APPLE)
|
||||||
endif(LUA_USE_DLOPEN)
|
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)
|
if(LUA_ANSI)
|
||||||
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_ANSI")
|
set(COMMON_CFLAGS "${COMMON_CFLAGS} -DLUA_ANSI")
|
||||||
endif(LUA_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.
|
# standard flags to use for each build type.
|
||||||
#
|
#
|
||||||
@ -178,20 +102,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2 -g")
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2 -g")
|
||||||
endif(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
|
# sub-folders
|
||||||
#
|
#
|
||||||
ADD_SUBDIRECTORY(src build)
|
ADD_SUBDIRECTORY(src build)
|
||||||
#ADD_SUBDIRECTORY(test)
|
|
||||||
|
|
||||||
|
@ -44,60 +44,22 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}
|
|||||||
#
|
#
|
||||||
# Lua library.
|
# Lua library.
|
||||||
#
|
#
|
||||||
if(BUILD_STATIC)
|
|
||||||
add_library(lua STATIC ${LUA_CORE_SRC})
|
add_library(lua STATIC ${LUA_CORE_SRC})
|
||||||
add_target_properties(lua COMPILE_FLAGS "${COMMON_CFLAGS}")
|
add_target_properties(lua COMPILE_FLAGS "${COMMON_CFLAGS}")
|
||||||
add_target_properties(lua LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
|
add_target_properties(lua LINK_FLAGS "${LD_FLAGS} ${COMMON_LDFLAGS}")
|
||||||
target_link_libraries(lua ${LIBS})
|
target_link_libraries(lua ${LIBS})
|
||||||
set(LUA_STATIC_LIB lua)
|
set(LUA_STATIC_LIB lua)
|
||||||
set(LUA_LIBS 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 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
|
set_target_properties(${LUA_LIBS} PROPERTIES
|
||||||
VERSION ${LUA_VERSION}
|
VERSION ${LUA_VERSION}
|
||||||
SOVERSION ${LUA_SOVERSION}
|
SOVERSION ${LUA_SOVERSION}
|
||||||
CLEAN_DIRECT_OUTPUT 1
|
CLEAN_DIRECT_OUTPUT 1
|
||||||
)
|
)
|
||||||
|
|
||||||
#
|
# Install library
|
||||||
# Lua compiler
|
install(TARGETS ${LUA_LIBS}
|
||||||
#
|
|
||||||
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}
|
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
ARCHIVE DESTINATION lib)
|
ARCHIVE DESTINATION lib)
|
||||||
|
|
||||||
install(FILES
|
|
||||||
${LUA_LIB_HEADERS}
|
|
||||||
DESTINATION include)
|
|
||||||
|
|
||||||
|
@ -252,6 +252,14 @@ Doing now (most important at the top):
|
|||||||
# maybe done
|
# maybe done
|
||||||
* not done
|
* not done
|
||||||
|
|
||||||
|
=== Next
|
||||||
|
* Continue making the scripting system:
|
||||||
|
* Rip up everything unnecessary from the lua build system
|
||||||
|
* Make updateNodeMesh for a less verbose mesh update on add/removenode
|
||||||
|
* Switch to using a safe way for the self and env pointers
|
||||||
|
* Make some global environment hooks, like node placed and general
|
||||||
|
on_step()
|
||||||
|
|
||||||
=== Fixmes
|
=== Fixmes
|
||||||
* Check the fixmes in the list above
|
* Check the fixmes in the list above
|
||||||
* Make server find the spawning place from the real map data, not from
|
* Make server find the spawning place from the real map data, not from
|
||||||
|
Loading…
Reference in New Issue
Block a user