modified the build system of lua to a more minimal one
authorPerttu Ahola <celeron55@gmail.com>
Wed, 23 Feb 2011 22:19:41 +0000 (00:19 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Wed, 23 Feb 2011 22:19:41 +0000 (00:19 +0200)
src/CMakeLists.txt
src/client.cpp
src/defaultsettings.cpp
src/lua/CMakeLists.txt
src/lua/src/CMakeLists.txt
src/main.cpp

index 01ab2df5db7e26a58c566cb0f1b4072c53242eb5..d38ea3f0ba876da31bee56abd294f8d2f120416c 100644 (file)
@@ -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
index 3f0457e6e5af78c6d8b5bbca392f5140ef4037d3..3ea6665491fa6549f3763221b73ea98a3118aa72 100644 (file)
@@ -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++)
index 4a96f82331f8247523738a20f4b876ec9ba4bbe6..2a548d406e3a85155bb88151d9f6b58b33c7565b 100644 (file)
@@ -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");
index 21bceebebcc5af58c2f90556db9084ac74ed6055..c43dc173793ae73b6395c61f5c019bed55332ff9 100644 (file)
@@ -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)
 
index 47fba6ce33013d6501a8e0d4d4d5b0b8289944dd..f9bfda85e329b319750fedb7d9f912c819a14c15 100644 (file)
@@ -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)
-
index 95761cf96db476fff4f44e614619a10f7db89212..a74685fa2a1480878e0684b76840334dbb117454 100644 (file)
@@ -252,6 +252,14 @@ Doing now (most important at the top):
 # maybe done\r
 * not done\r
 \r
+=== Next\r
+* Continue making the scripting system:\r
+  * Rip up everything unnecessary from the lua build system\r
+  * Make updateNodeMesh for a less verbose mesh update on add/removenode\r
+  * Switch to using a safe way for the self and env pointers\r
+  * Make some global environment hooks, like node placed and general\r
+    on_step()\r
+\r
 === Fixmes\r
 * Check the fixmes in the list above\r
 * Make server find the spawning place from the real map data, not from\r