modified the build system of lua to a more minimal one
parent
bfd0980748
commit
9f859d8389
|
@ -148,7 +148,7 @@ if(MSVC)
|
|||
|
||||
# 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_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
|
||||
# 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);
|
||||
|
||||
TimeTaker timer1("Client::addNode()");
|
||||
|
||||
core::map<v3s16, MapBlock*> modified_blocks;
|
||||
|
||||
try
|
||||
{
|
||||
TimeTaker timer3("Client::addNode(): addNodeAndUpdate");
|
||||
m_env.getMap().addNodeAndUpdate(p, n, modified_blocks);
|
||||
}
|
||||
catch(InvalidPositionException &e)
|
||||
{}
|
||||
|
||||
TimeTaker timer2("Client::addNode(): updateMeshes");
|
||||
|
||||
for(core::map<v3s16, MapBlock * >::Iterator
|
||||
i = modified_blocks.getIterator();
|
||||
i.atEnd() == false; i++)
|
||||
|
|
|
@ -54,6 +54,7 @@ void set_default_settings()
|
|||
g_settings.setDefault("fast_move", "false");
|
||||
|
||||
g_settings.setDefault("enable_experimental", "false");
|
||||
g_settings.setDefault("creative_mode", "false");
|
||||
|
||||
g_settings.setDefault("objectdata_interval", "0.2");
|
||||
g_settings.setDefault("active_object_range", "2");
|
||||
|
|
|
@ -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.
|
||||
#
|
||||
|
@ -178,20 +102,8 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} -O2 -g")
|
||||
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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -252,6 +252,14 @@ Doing now (most important at the top):
|
|||
# maybe 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
|
||||
* Check the fixmes in the list above
|
||||
* Make server find the spawning place from the real map data, not from
|
||||
|
|
Loading…
Reference in New Issue