1
0

Merge pull request #446 from worktycho/cmake

Rebuild build system with cmake
This commit is contained in:
Alexander Harkness 2013-12-21 06:08:54 -08:00
commit 3dbc1a7e8a
37 changed files with 10133 additions and 32544 deletions

28
.gitignore vendored
View File

@ -7,7 +7,7 @@ Symbols
cloc-ignored.txt
cloc.xml
cloc.xsl
*.ncb
*.ncb
*.user
*.suo
/EveryNight.cmd
@ -17,6 +17,7 @@ cloc.xsl
*.sublime-*
## emacs
*.*~
*~
# world inside source
ChunkWorx.ini
@ -34,3 +35,28 @@ logs
players
world
world_nether
#cmake stuff
CMakeFiles/
cmake_install.cmake
CMakeCache.txt
Makefile
*.a
*.d
CMakeCache.txt
CMakeFiles
Makefile
cmake_install.cmake
install_mainfest.txt
src/MCServer
lib/tolua++/tolua
src/Bindings/Bindings.*
MCServer.dir/
#win32 cmake stuff
*.vcxproj
*.vcxproj.filters
*.opensdf
*.sdf
*.sln

View File

@ -3,7 +3,7 @@ compiler:
- gcc
- clang
# Build MCServer
script: make release=1 -j 2
script: cmake . -DCMAKE_BUILD_TYPE=RELEASE && make -j 2
# Notification Settings
notifications:

101
CMakeLists.txt Normal file
View File

@ -0,0 +1,101 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
macro(add_flags FLAGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${FLAGS}")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} ${FLAGS}")
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${FLAGS}")
endmacro()
SET(CMAKE_CXX_FLAGS_PROFILE
"${CMAKE_CXX_FLAGS_DEBUG} -pg -DNDEBUG"
CACHE STRING "Flags used by the C++ compiler during profile builds."
FORCE )
SET(CMAKE_C_FLAGS_PROFILE
"${CMAKE_C_FLAGS_DEBUG} -pg -DNDEBUG"
CACHE STRING "Flags used by the C compiler during profile builds."
FORCE )
SET(CMAKE_EXE_LINKER_FLAGS_PROFILE
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} -pg"
CACHE STRING "Flags used for linking binaries during profile builds."
FORCE )
SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE
"${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -pg"
CACHE STRING "Flags used by the shared libraries linker during profile builds."
FORCE )
MARK_AS_ADVANCED(
CMAKE_CXX_FLAGS_PROFILE
CMAKE_C_FLAGS_PROFILE
CMAKE_EXE_LINKER_FLAGS_PROFILE
CMAKE_SHARED_LINKER_FLAGS_PROFILE )
if(UNIX)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DNDEBUG")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_DEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -D_DEBUG")
endif()
if(WIN32)
add_flags("/MP")
else()
add_flags("-pthread")
endif()
set(CMAKE_CXX_FLAGS_RELEASE_BAK "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS_RELEASE_BAK "${CMAKE_C_FLAGS_RELEASE}")
if (UNIX)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -w")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -w")
else()
#remove /W3 from command line -- cannot just cancel it later with /w like in unix because of D9025
#only remove frome relase as we force release
string(REPLACE "/W3" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
string(REPLACE "/W3" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
endif()
set(CMAKE_BUILD_TYPE_BAK ${CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE "Release")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_definitions(-DCRYPTOPP_DISABLE_ASM)
endif()
add_definitions(-DLUA_USE_DLOPEN)
add_subdirectory(lib/inifile/)
add_subdirectory(lib/jsoncpp/)
add_subdirectory(lib/cryptopp/)
add_subdirectory(lib/zlib/)
add_subdirectory(lib/lua/)
add_subdirectory(lib/tolua++/)
add_subdirectory(lib/sqlite/)
add_subdirectory(lib/expat/)
add_subdirectory(lib/luaexpat/)
add_subdirectory(lib/md5/)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_BAK}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_BAK}")
#TODo: set -Wall -Werror -Wextra
if(UNIX)
add_flags("-Wall -Wextra")
else()
add_flags("/Wall")
endif()
set(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE_BAK}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -rdynamic")
set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_PROFILE} -rdynamic")
add_subdirectory (src)

View File

@ -1,194 +0,0 @@
###################################################
#
# Makefile for MCServer
# Creator: tedik
#
###################################################
#
# Info:
# This makefile is gnu-make spacific, other make systems needn't understand it
# This makefile generates include-file dependencies into *.d files in each build and then reuses these dependencies in the following builds
#
# Usage:
# To make a release build, call "make release=1"
# To make a debug build, call "make"
# To make a 32-bit build on 64-bit OS, pass the addm32=1 flag
# To build with clang, you need to add disableasm=1 flag
#
###################################################
#
# Macros
#
# allow user to override compiler
# if no compiler is specified make specifies cc
ifeq ($(CC),cc)
CC = /usr/bin/g++
endif
all: MCServer/MCServer
###################################################
# Set the variables used for compiling, based on the build mode requested:
# CC_OPTIONS ... options for the C code compiler
# CXX_OPTIONS ... options for the C++ code compiler
# LNK_OPTIONS ... options for the linker
# LNK_LIBS ... libraries to link in
# -- according to http://stackoverflow.com/questions/6183899/undefined-reference-to-dlopen, libs must come after all sources
# BUILDDIR ... folder where the intermediate object files are built
ifeq ($(release),1)
################
# release build - fastest run-time, no gdb support
################
CC_OPTIONS = -O3 -DNDEBUG -DLUA_USE_DLOPEN
CXX_OPTIONS = -O3 -DNDEBUG -DLUA_USE_DLOPEN
LNK_OPTIONS = -pthread -O3
BUILDDIR = build/release/
else
ifeq ($(profile),1)
################
# profile build - a release build with symbols and profiling engine built in
################
CC_OPTIONS = -g -ggdb -O3 -pg -DNDEBUG -DLUA_USE_DLOPEN
CXX_OPTIONS = -g -ggdb -O3 -pg -DNDEBUG -DLUA_USE_DLOPEN
LNK_OPTIONS = -pthread -ggdb -O3 -pg
BUILDDIR = build/profile/
else
################
# debug build - fully traceable by gdb in C++ code, slowest
# Since C code is used only for supporting libraries (zlib, lua), it is still Ofast-optimized
################
CC_OPTIONS = -ggdb -g -D_DEBUG -O3 -DLUA_USE_DLOPEN
CXX_OPTIONS = -ggdb -g -D_DEBUG -O1 -DLUA_USE_DLOPEN
LNK_OPTIONS = -pthread -g -ggdb -O1
BUILDDIR = build/debug/
endif
endif
##################################################
# Always be warning.
CXX_OPTIONS += -Wall
###################################################
# Fix Crypto++ warnings in clang
ifeq ($(shell $(CXX) --version 2>&1 | grep -i -c "clang"),1)
CC_OPTIONS += -DCRYPTOPP_DISABLE_ASM
CXX_OPTIONS += -DCRYPTOPP_DISABLE_ASM
endif
###################################################
# Set the link libraries based on the OS
# Linux uses libdl
# FreeBSD uses libltdl
# TODO: other OSs?
UNAME := $(shell uname -s)
ifeq ($(UNAME),Linux)
LNK_LIBS = -lstdc++ -ldl -lm
else
LNK_LIBS = -lstdc++ -lltdl
endif
###################################################
# Export all symbols from the executable, so that LuaRocks may bind to Lua routines:
LNK_OPTIONS += -rdynamic
###################################################
# 32-bit build override in 64-bit build environments
ifeq ($(addm32),1)
CC_OPTIONS += -m32
CXX_OPTIONS += -m32
LNK_OPTIONS += -m32
endif
###################################################
# INCLUDE directories for MCServer
INCLUDE = -Isrc\
-Ilib\
-Ilib/jsoncpp/include
###################################################
# Build MCServer
SOURCES := $(shell find src lib '(' -name '*.cpp' -o -name '*.c' ')')
SOURCES := $(filter-out %minigzip.c %lua.c %tolua.c %toluabind.c %LeakFinder.cpp %StackWalker.cpp %example.c,$(SOURCES))
OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES))
OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS))
-include $(patsubst %.o,%.d,$(OBJECTS))
MCServer/MCServer : $(OBJECTS)
$(CC) $(LNK_OPTIONS) $(OBJECTS) $(LNK_LIBS) -o MCServer/MCServer
clean :
rm -rf $(BUILDDIR) MCServer/MCServer
install : MCServer
cp MCServer MCServer
###################################################
# Build the parts of MCServer
#
# options used:
# -x c ... compile as C code
# -c ... compile but do not link
# -MM ... generate a list of includes
$(BUILDDIR)%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CC_OPTIONS) -x c -c $(INCLUDE) $< -o $@
@$(CC) $(CC_OPTIONS) -x c -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
@sed -e "s|.*:|$(BUILDDIR)$*.o:|" < $(patsubst %.o,%.d,$@).tmp > $(patsubst %.o,%.d,$@)
@sed -e 's/.*://' -e 's/\\$$//' < $(patsubst %.o,%.d,$@).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(patsubst %.o,%.d,$@)
@rm -f $(patsubst %.o,%.d,$@).tmp
$(BUILDDIR)%.o: %.cpp
@mkdir -p $(dir $@)
$(CC) $(CXX_OPTIONS) -c $(INCLUDE) $< -o $@
@$(CC) $(CXX_OPTIONS) -MM $(INCLUDE) $< > $(patsubst %.o,%.d,$@)
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d,$@).tmp
@sed -e "s|.*:|$(BUILDDIR)$*.o:|" < $(patsubst %.o,%.d,$@).tmp > $(patsubst %.o,%.d,$@)
@sed -e 's/.*://' -e 's/\\$$//' < $(patsubst %.o,%.d,$@).tmp | fmt -1 | sed -e 's/^ *//' -e 's/$$/:/' >> $(patsubst %.o,%.d,$@)
@rm -f $(patsubst %.o,%.d,$@).tmp

View File

@ -337,6 +337,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath="..\lib\tolua++\src\bin\tolua.c"
>
</File>
<File
RelativePath="..\lib\tolua++\src\lib\tolua_event.c"
>

View File

@ -0,0 +1,14 @@
cmake_minimum_required (VERSION 2.6)
project (cryptopp)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCRYPTOPP_DISABLE_ASM")
endif()
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB cryptopp_SRC
"*.cpp"
)
add_library(cryptopp ${cryptopp_SRC})

11
lib/expat/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (expat)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB SOURCE
"*.c"
)
add_library(expat ${SOURCE})

View File

@ -0,0 +1,7 @@
cmake_minimum_required (VERSION 2.6)
project (iniFile)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
add_library(iniFile iniFile)

View File

@ -0,0 +1,13 @@
cmake_minimum_required (VERSION 2.6)
project (jsoncpp)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB SOURCE
"src/lib_json/*.h"
"src/lib_json/*.cpp"
)
add_library(jsoncpp ${SOURCE})

19
lib/lua/CMakeLists.txt Normal file
View File

@ -0,0 +1,19 @@
cmake_minimum_required (VERSION 2.6)
project (lua)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB SOURCE
"src/*.c"
)
if(${STATIC_LUA})
add_library(lua ${SOURCE})
else()
add_library(lua SHARED ${SOURCE})
endif()
if(UNIX)
target_link_libraries(lua m dl)
endif()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,14 @@
cmake_minimum_required (VERSION 2.6)
project (luaexpat)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.c"
)
add_library(luaexpat ${SOURCE})
target_link_libraries(luaexpat expat)

11
lib/md5/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (md5)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB SOURCE
"*.cpp"
)
add_library(md5 ${SOURCE})

14
lib/sqlite/CMakeLists.txt Normal file
View File

@ -0,0 +1,14 @@
cmake_minimum_required (VERSION 2.6)
project (sqlite)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.c"
)
add_library(sqlite ${SOURCE})
target_link_libraries(sqlite dl)

View File

@ -0,0 +1,25 @@
cmake_minimum_required (VERSION 2.6)
project (tolua++)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
include_directories ("${PROJECT_SOURCE_DIR}/include/")
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB LIB_SOURCE
"src/lib/*.c"
)
file(GLOB BIN_SOURCE
"src/bin/*.c"
)
add_executable(tolua ${BIN_SOURCE})
add_library(tolualib ${LIB_SOURCE})
#m is the standard math librarys
if(UNIX)
target_link_libraries(tolua m)
endif()
target_link_libraries(tolua lua tolualib)

View File

@ -1,5 +1,338 @@
# makefile for tolua hierarchy
# CMAKE generated file: DO NOT EDIT!
# Generated by "Unix Makefiles" Generator, CMake Version 2.8
# Default target executed when no arguments are given to make.
default_target: all
.PHONY : default_target
#=============================================================================
# Special targets provided by cmake.
# Disable implicit rules so canonical targets will work.
.SUFFIXES:
# Remove some rules from gmake that .SUFFIXES does not remove.
SUFFIXES =
.SUFFIXES: .hpux_make_needs_suffix_list
# Suppress display of executed commands.
$(VERBOSE).SILENT:
# A target that is always out of date.
cmake_force:
.PHONY : cmake_force
#=============================================================================
# Set environment variables for the build.
# The shell in which to execute make rules.
SHELL = /bin/sh
# The CMake executable.
CMAKE_COMMAND = /usr/bin/cmake
# The command to remove a file.
RM = /usr/bin/cmake -E remove -f
# The top-level source directory on which CMake was run.
CMAKE_SOURCE_DIR = /home/tycho/MCServer
# The top-level build directory on which CMake was run.
CMAKE_BINARY_DIR = /home/tycho/MCServer
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target edit_cache
edit_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running interactive CMake command-line interface..."
/usr/bin/cmake -i .
.PHONY : edit_cache
# Special rule for the target edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
/usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
.PHONY : rebuild_cache
# Special rule for the target rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
# The main all target
all: cmake_check_build_system
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles /home/tycho/MCServer/lib/tolua++/CMakeFiles/progress.marks
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/all
$(CMAKE_COMMAND) -E cmake_progress_start /home/tycho/MCServer/CMakeFiles 0
.PHONY : all
# The main clean target
clean:
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/clean
.PHONY : clean
# The main clean target
clean/fast: clean
.PHONY : clean/fast
# Prepare targets for installation.
preinstall: all
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/preinstall
.PHONY : preinstall
# Prepare targets for installation.
preinstall/fast:
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/preinstall
.PHONY : preinstall/fast
# clear depends
depend:
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
.PHONY : depend
# Convenience name for target.
lib/tolua++/CMakeFiles/tolua.dir/rule:
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/CMakeFiles/tolua.dir/rule
.PHONY : lib/tolua++/CMakeFiles/tolua.dir/rule
# Convenience name for target.
tolua: lib/tolua++/CMakeFiles/tolua.dir/rule
.PHONY : tolua
# fast build rule for target.
tolua/fast:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/build
.PHONY : tolua/fast
# Convenience name for target.
lib/tolua++/CMakeFiles/tolualib.dir/rule:
cd /home/tycho/MCServer && $(MAKE) -f CMakeFiles/Makefile2 lib/tolua++/CMakeFiles/tolualib.dir/rule
.PHONY : lib/tolua++/CMakeFiles/tolualib.dir/rule
# Convenience name for target.
tolualib: lib/tolua++/CMakeFiles/tolualib.dir/rule
.PHONY : tolualib
# fast build rule for target.
tolualib/fast:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/build
.PHONY : tolualib/fast
src/bin/tolua.o: src/bin/tolua.c.o
.PHONY : src/bin/tolua.o
# target to build an object file
src/bin/tolua.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.o
.PHONY : src/bin/tolua.c.o
src/bin/tolua.i: src/bin/tolua.c.i
.PHONY : src/bin/tolua.i
# target to preprocess a source file
src/bin/tolua.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.i
.PHONY : src/bin/tolua.c.i
src/bin/tolua.s: src/bin/tolua.c.s
.PHONY : src/bin/tolua.s
# target to generate assembly for a file
src/bin/tolua.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/tolua.c.s
.PHONY : src/bin/tolua.c.s
src/bin/toluabind.o: src/bin/toluabind.c.o
.PHONY : src/bin/toluabind.o
# target to build an object file
src/bin/toluabind.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.o
.PHONY : src/bin/toluabind.c.o
src/bin/toluabind.i: src/bin/toluabind.c.i
.PHONY : src/bin/toluabind.i
# target to preprocess a source file
src/bin/toluabind.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.i
.PHONY : src/bin/toluabind.c.i
src/bin/toluabind.s: src/bin/toluabind.c.s
.PHONY : src/bin/toluabind.s
# target to generate assembly for a file
src/bin/toluabind.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolua.dir/build.make lib/tolua++/CMakeFiles/tolua.dir/src/bin/toluabind.c.s
.PHONY : src/bin/toluabind.c.s
src/lib/tolua_event.o: src/lib/tolua_event.c.o
.PHONY : src/lib/tolua_event.o
# target to build an object file
src/lib/tolua_event.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.o
.PHONY : src/lib/tolua_event.c.o
src/lib/tolua_event.i: src/lib/tolua_event.c.i
.PHONY : src/lib/tolua_event.i
# target to preprocess a source file
src/lib/tolua_event.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.i
.PHONY : src/lib/tolua_event.c.i
src/lib/tolua_event.s: src/lib/tolua_event.c.s
.PHONY : src/lib/tolua_event.s
# target to generate assembly for a file
src/lib/tolua_event.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_event.c.s
.PHONY : src/lib/tolua_event.c.s
src/lib/tolua_is.o: src/lib/tolua_is.c.o
.PHONY : src/lib/tolua_is.o
# target to build an object file
src/lib/tolua_is.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.o
.PHONY : src/lib/tolua_is.c.o
src/lib/tolua_is.i: src/lib/tolua_is.c.i
.PHONY : src/lib/tolua_is.i
# target to preprocess a source file
src/lib/tolua_is.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.i
.PHONY : src/lib/tolua_is.c.i
src/lib/tolua_is.s: src/lib/tolua_is.c.s
.PHONY : src/lib/tolua_is.s
# target to generate assembly for a file
src/lib/tolua_is.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_is.c.s
.PHONY : src/lib/tolua_is.c.s
src/lib/tolua_map.o: src/lib/tolua_map.c.o
.PHONY : src/lib/tolua_map.o
# target to build an object file
src/lib/tolua_map.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.o
.PHONY : src/lib/tolua_map.c.o
src/lib/tolua_map.i: src/lib/tolua_map.c.i
.PHONY : src/lib/tolua_map.i
# target to preprocess a source file
src/lib/tolua_map.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.i
.PHONY : src/lib/tolua_map.c.i
src/lib/tolua_map.s: src/lib/tolua_map.c.s
.PHONY : src/lib/tolua_map.s
# target to generate assembly for a file
src/lib/tolua_map.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_map.c.s
.PHONY : src/lib/tolua_map.c.s
src/lib/tolua_push.o: src/lib/tolua_push.c.o
.PHONY : src/lib/tolua_push.o
# target to build an object file
src/lib/tolua_push.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.o
.PHONY : src/lib/tolua_push.c.o
src/lib/tolua_push.i: src/lib/tolua_push.c.i
.PHONY : src/lib/tolua_push.i
# target to preprocess a source file
src/lib/tolua_push.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.i
.PHONY : src/lib/tolua_push.c.i
src/lib/tolua_push.s: src/lib/tolua_push.c.s
.PHONY : src/lib/tolua_push.s
# target to generate assembly for a file
src/lib/tolua_push.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_push.c.s
.PHONY : src/lib/tolua_push.c.s
src/lib/tolua_to.o: src/lib/tolua_to.c.o
.PHONY : src/lib/tolua_to.o
# target to build an object file
src/lib/tolua_to.c.o:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.o
.PHONY : src/lib/tolua_to.c.o
src/lib/tolua_to.i: src/lib/tolua_to.c.i
.PHONY : src/lib/tolua_to.i
# target to preprocess a source file
src/lib/tolua_to.c.i:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.i
.PHONY : src/lib/tolua_to.c.i
src/lib/tolua_to.s: src/lib/tolua_to.c.s
.PHONY : src/lib/tolua_to.s
# target to generate assembly for a file
src/lib/tolua_to.c.s:
cd /home/tycho/MCServer && $(MAKE) -f lib/tolua++/CMakeFiles/tolualib.dir/build.make lib/tolua++/CMakeFiles/tolualib.dir/src/lib/tolua_to.c.s
.PHONY : src/lib/tolua_to.c.s
# Help Target
help:
@echo "The following are some of the valid targets for this Makefile:"
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... edit_cache"
@echo "... rebuild_cache"
@echo "... tolua"
@echo "... tolualib"
@echo "... src/bin/tolua.o"
@echo "... src/bin/tolua.i"
@echo "... src/bin/tolua.s"
@echo "... src/bin/toluabind.o"
@echo "... src/bin/toluabind.i"
@echo "... src/bin/toluabind.s"
@echo "... src/lib/tolua_event.o"
@echo "... src/lib/tolua_event.i"
@echo "... src/lib/tolua_event.s"
@echo "... src/lib/tolua_is.o"
@echo "... src/lib/tolua_is.i"
@echo "... src/lib/tolua_is.s"
@echo "... src/lib/tolua_map.o"
@echo "... src/lib/tolua_map.i"
@echo "... src/lib/tolua_map.s"
@echo "... src/lib/tolua_push.o"
@echo "... src/lib/tolua_push.i"
@echo "... src/lib/tolua_push.s"
@echo "... src/lib/tolua_to.o"
@echo "... src/lib/tolua_to.i"
@echo "... src/lib/tolua_to.s"
.PHONY : help
#=============================================================================
# Special targets to cleanup operation of make.
# Special rule to run CMake to check the build system integrity.
# No rule that depends on this can have commands that come from listfiles
# because they might be regenerated.
cmake_check_build_system:
cd /home/tycho/MCServer && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system
all:
@echo "Makefile is deprecated ;)"
@echo "see INSTALL for details on how to build tolua++"

169
lib/tolua++/src/bin/tolua.c Normal file
View File

@ -0,0 +1,169 @@
/* tolua
** Support code for Lua bindings.
** Written by Waldemar Celes
** TeCGraf/PUC-Rio
** Aug 2003
** $Id:$
*/
/* This code is free software; you can redistribute it and/or modify it.
** The software provided hereunder is on an "as is" basis, and
** the author has no obligation to provide maintenance, support, updates,
** enhancements, or modifications.
*/
#include "../../include/tolua++.h"
#include "../../../lua/src/lua.h"
#include "../../../lua/src/lualib.h"
#include "../../../lua/src/lauxlib.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void help (void)
{
fprintf(stderr,"\n"
"usage: tolua++ [options] input_file\n"
"\n"
"Command line options are:\n"
" -v : print version information.\n"
" -o file : set output file; default is stdout.\n"
" -H file : create include file.\n"
" -n name : set package name; default is input file root name.\n"
" -p : parse only.\n"
" -P : parse and print structure information (for debug).\n"
" -S : disable support for c++ strings.\n"
" -1 : substract 1 to operator[] index (for compatibility with tolua5).\n"
" -L file : run lua file (with dofile()) before doing anything.\n"
" -D : disable automatic exporting of destructors for classes that have\n"
" constructors (for compatibility with tolua5)\n"
" -W : disable warnings for unsupported features (for compatibility\n"
" with tolua5)\n"
" -C : disable cleanup of included lua code (for easier debugging)\n"
" -E value[=value] : add extra values to the luastate\n"
" -t : export a list of types asociates with the C++ typeid name\n"
" -q : don't print warnings to the console\n"
" -h : print this message.\n"
"Should the input file be omitted, stdin is assumed;\n"
"in that case, the package name must be explicitly set.\n\n"
);
}
static void version (void)
{
fprintf(stderr, "%s (written by W. Celes, A. Manzur)\n",TOLUA_VERSION);
}
static void setfield (lua_State* L, int table, char* f, char* v)
{
lua_pushstring(L,f);
lua_pushstring(L,v);
lua_settable(L,table);
}
static void add_extra (lua_State* L, char* value) {
int len;
lua_getglobal(L, "_extra_parameters");
len = luaL_getn(L, -1);
lua_pushstring(L, value);
lua_rawseti(L, -2, len+1);
lua_pop(L, 1);
};
static void error (char* o)
{
fprintf(stderr,"tolua: unknown option '%s'\n",o);
help();
exit(1);
}
int main (int argc, char* argv[])
{
#ifdef LUA_VERSION_NUM /* lua 5.1 */
lua_State* L = luaL_newstate();
luaL_openlibs(L);
#else
lua_State* L = lua_open();
luaopen_base(L);
luaopen_io(L);
luaopen_string(L);
luaopen_table(L);
luaopen_math(L);
luaopen_debug(L);
#endif
lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
if (argc==1)
{
help();
return 0;
}
else
{
int i, t;
lua_newtable(L);
lua_setglobal(L, "_extra_parameters");
lua_newtable(L);
lua_pushvalue(L,-1);
lua_setglobal(L,"flags");
t = lua_gettop(L);
for (i=1; i<argc; ++i)
{
if (*argv[i] == '-')
{
switch (argv[i][1])
{
case 'v': version(); return 0;
case 'h': help(); return 0;
case 'p': setfield(L,t,"p",""); break;
case 'P': setfield(L,t,"P",""); break;
case 'o': setfield(L,t,"o",argv[++i]); break;
case 'n': setfield(L,t,"n",argv[++i]); break;
case 'H': setfield(L,t,"H",argv[++i]); break;
case 'S': setfield(L,t,"S",""); break;
case '1': setfield(L,t,"1",""); break;
case 'L': setfield(L,t,"L",argv[++i]); break;
case 'D': setfield(L,t,"D",""); break;
case 'W': setfield(L,t,"W",""); break;
case 'C': setfield(L,t,"C",""); break;
case 'E': add_extra(L,argv[++i]); break;
case 't': setfield(L,t,"t",""); break;
case 'q': setfield(L,t,"q",""); break;
default: error(argv[i]); break;
}
}
else
{
setfield(L,t,"f",argv[i]);
break;
}
}
lua_pop(L,1);
}
/* #define TOLUA_SCRIPT_RUN */
#ifndef TOLUA_SCRIPT_RUN
{
int tolua_tolua_open (lua_State* L);
tolua_tolua_open(L);
}
#else
{
char* p;
char path[BUFSIZ];
strcpy(path,argv[0]);
p = strrchr(path,'/');
if (p==NULL) p = strrchr(path,'\\');
p = (p==NULL) ? path : p+1;
sprintf(p,"%s","../src/bin/lua/");
lua_pushstring(L,path); lua_setglobal(L,"path");
strcat(path,"all.lua");
lua_dofile(L,path);
}
#endif
return 0;
}

View File

@ -0,0 +1,31 @@
$lfile "src/bin/lua/compat-5.1.lua"
$lfile "src/bin/lua/compat.lua"
$lfile "src/bin/lua/basic.lua"
$lfile "src/bin/lua/feature.lua"
$lfile "src/bin/lua/verbatim.lua"
$lfile "src/bin/lua/code.lua"
$lfile "src/bin/lua/typedef.lua"
$lfile "src/bin/lua/container.lua"
$lfile "src/bin/lua/package.lua"
$lfile "src/bin/lua/module.lua"
$lfile "src/bin/lua/namespace.lua"
$lfile "src/bin/lua/define.lua"
$lfile "src/bin/lua/enumerate.lua"
$lfile "src/bin/lua/declaration.lua"
$lfile "src/bin/lua/variable.lua"
$lfile "src/bin/lua/array.lua"
$lfile "src/bin/lua/function.lua"
$lfile "src/bin/lua/operator.lua"
$lfile "src/bin/lua/template_class.lua"
$lfile "src/bin/lua/class.lua"
$lfile "src/bin/lua/clean.lua"
$lfile "src/bin/lua/doit.lua"
$[
local err,msg = pcall(doit)
if not err then
local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)")
tolua_error(msg,label)
print(debug.traceback())
end
$]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
/*
** Lua binding: tolua
** Generated automatically by tolua++-1.0.92 on Sun Feb 15 22:29:48 2009.
*/
/* Exported function */
TOLUA_API int tolua_tolua_open (lua_State* tolua_S);

11
lib/zlib/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (zlib)
include_directories ("${PROJECT_SOURCE_DIR}/../../src/")
file(GLOB SOURCE
"*.c"
)
add_library(zlib ${SOURCE})

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
/*
** Lua binding: AllToLua
** Generated automatically by tolua++-1.0.92 on 12/18/13 16:09:11.
*/
/* Exported function */
TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S);

View File

@ -0,0 +1,19 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
ADD_CUSTOM_COMMAND(
#add any new generated bindings here
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Bindings.cpp ${CMAKE_CURRENT_BINARY_DIR}/Bindings.h
#command execuded to regerate bindings
COMMAND tolua -L virtual_method_hooks.lua -o Bindings.cpp -H Bindings.h AllToLua.pkg
#add any new generation dependencies here
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/virtual_method_hooks.lua ${CMAKE_CURRENT_SOURCE_DIR}/AllToLua.pkg tolua
)
#add cpp files here
add_library(Bindings PluginManager LuaState WebPlugin Bindings ManualBindings LuaWindow Plugin PluginLua WebPlugin)
target_link_libraries(Bindings lua sqlite tolualib)

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(BlockEntities ${SOURCE})

11
src/Blocks/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(Blocks ${SOURCE})

83
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,83 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
endif()
include_directories (SYSTEM "${PROJECT_SOURCE_DIR}/../lib/")
include_directories (SYSTEM "${PROJECT_SOURCE_DIR}/../lib/jsoncpp/include")
set(FOLDERS OSSupport HTTPServer Bindings Items Blocks Protocol Generating)
set(FOLDERS ${FOLDERS} WorldStorage Mobs Entities Simulator UI BlockEntities)
if(NOT WIN32)
foreach(folder ${FOLDERS})
add_subdirectory(${folder})
endforeach(folder)
file(GLOB SOURCE
"*.cpp"
)
else()
function(includefolder PATH)
FILE(GLOB FOLDER_FILES
"${PATH}/*.cpp"
"${PATH}/*.h"
)
source_group("${PATH}" FILES ${FOLDER_FILES})
endfunction(includefolder)
foreach(folder ${FOLDERS})
includefolder(${folder})
endforeach(folder)
file(GLOB_RECURSE SOURCE
"*.cpp"
"*.h"
)
include_directories("${PROJECT_SOURCE_DIR}")
source_group("" FILES ${SOURCE})
#precompiledheaders
file(GLOB_RECURSE HEADERS
"*.h"
)
foreach(header ${HEADERS})
set(FLAGS "/Yu ${header} /Yc ${header}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${FLAGS}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${FLAGS}")
set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_PROFILE} ${FLAGS}")
set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${FLAGS}")
endforeach()
endif()
list(REMOVE_ITEM SOURCE "${PROJECT_SOURCE_DIR}/StackWalker.cpp" "${PROJECT_SOURCE_DIR}/LeakFinder.cpp")
if(UNIX)
set(EXECUTABLE ../MCServer/MCServer)
else()
set(EXECUTABLE MCServer)
endif()
add_executable(${EXECUTABLE} ${SOURCE})
if(NOT WIN32)
target_link_libraries(${EXECUTABLE} OSSupport HTTPServer Bindings Items Blocks)
target_link_libraries(${EXECUTABLE} Protocol Generating WorldStorage)
target_link_libraries(${EXECUTABLE} Mobs Entities Simulator UI BlockEntities)
endif()
target_link_libraries(${EXECUTABLE} md5 luaexpat iniFile jsoncpp cryptopp zlib lua)

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(Entities ${SOURCE})

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(Generating ${SOURCE})

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(HTTPServer ${SOURCE})

7
src/Items/CMakeLists.txt Normal file
View File

@ -0,0 +1,7 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
add_library(Items ItemHandler)

11
src/Mobs/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(Mobs ${SOURCE})

View File

@ -0,0 +1,14 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(OSSupport ${SOURCE})
if(UNIX)
target_link_libraries(OSSupport pthread)
endif()

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(Protocol ${SOURCE})

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(Simulator ${SOURCE})

11
src/UI/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(UI ${SOURCE})

View File

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
project (MCServer)
include_directories ("${PROJECT_SOURCE_DIR}/../")
file(GLOB SOURCE
"*.cpp"
)
add_library(WorldStorage ${SOURCE})