parent
21ef9e3819
commit
9e8598fb1c
26
.travis.yml
26
.travis.yml
@ -5,13 +5,7 @@ cache: ccache
|
|||||||
os: linux
|
os: linux
|
||||||
dist: bionic
|
dist: bionic
|
||||||
|
|
||||||
# CMake version out of date: update
|
# TODO: add ARM64, PPC, IBM builds when we find CMake for them
|
||||||
# TODO: add ARM64, PPC, SPARC builds when we find CMake for them
|
|
||||||
addons:
|
|
||||||
snaps:
|
|
||||||
- name: cmake
|
|
||||||
confinement: classic
|
|
||||||
channel: latest
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
include:
|
include:
|
||||||
@ -22,7 +16,7 @@ jobs:
|
|||||||
before_install:
|
before_install:
|
||||||
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
||||||
env: &Release
|
env: &Release
|
||||||
- TRAVIS_CUBERITE_BUILD_TYPE=RELEASE
|
- TRAVIS_CUBERITE_BUILD_TYPE=Release
|
||||||
|
|
||||||
- name: "AppleClang - Debug"
|
- name: "AppleClang - Debug"
|
||||||
os: osx
|
os: osx
|
||||||
@ -30,12 +24,14 @@ jobs:
|
|||||||
before_install:
|
before_install:
|
||||||
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
- HOMEBREW_NO_AUTO_UPDATE=1 brew install ccache
|
||||||
env: &Debug
|
env: &Debug
|
||||||
- TRAVIS_CUBERITE_BUILD_TYPE=DEBUG
|
- TRAVIS_CUBERITE_BUILD_TYPE=Debug
|
||||||
|
|
||||||
- name: "Clang 7.0 - Release"
|
- name: "Clang 7.0 - Release"
|
||||||
compiler: clang
|
compiler: clang
|
||||||
before_install: &use-cmake
|
before_install: &use-cmake
|
||||||
- export PATH=/snap/bin/:${PATH}
|
- wget --output-document=${HOME}/CMake http://cmake.org/files/v3.17/cmake-3.17.2-Linux-x86_64.tar.gz
|
||||||
|
- tar --extract --one-top-level=${HOME}/SeeMake --strip-components 1 --file ${HOME}/CMake
|
||||||
|
- export PATH=${HOME}/SeeMake/bin/:${PATH}
|
||||||
env: *Release
|
env: *Release
|
||||||
|
|
||||||
- name: "Clang 7.0 - Debug"
|
- name: "Clang 7.0 - Debug"
|
||||||
@ -43,9 +39,15 @@ jobs:
|
|||||||
before_install: *use-cmake
|
before_install: *use-cmake
|
||||||
env: *Debug
|
env: *Debug
|
||||||
|
|
||||||
- name: "GCC 7.4 - Release, CMake 3.12"
|
- name: "GCC 7.4 - Release, CMake 3.12, No Unity"
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
env: *Release
|
before_install:
|
||||||
|
- wget --output-document=${HOME}/CMake http://cmake.org/files/v3.13/cmake-3.13.0-Linux-x86_64.tar.gz
|
||||||
|
- tar --extract --one-top-level=${HOME}/SeeMake --strip-components 1 --file ${HOME}/CMake
|
||||||
|
- export PATH=${HOME}/SeeMake/bin/:${PATH}
|
||||||
|
env:
|
||||||
|
- TRAVIS_CUBERITE_BUILD_TYPE=Release
|
||||||
|
- TRAVIS_CUBERITE_UNITY_BUILDS=No
|
||||||
|
|
||||||
- name: "GCC 7.4 - Debug"
|
- name: "GCC 7.4 - Debug"
|
||||||
compiler: gcc
|
compiler: gcc
|
||||||
|
14
CMake/Fixups.cmake
Normal file
14
CMake/Fixups.cmake
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# TODO these should be in the submodules
|
||||||
|
# Under Windows, we need Lua as DLL; on *nix we need it linked statically:
|
||||||
|
if (WIN32)
|
||||||
|
target_compile_definitions(lua PUBLIC LUA_BUILD_AS_DLL)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Let Lua use additional checks on its C API. This is only compiled into Debug builds:
|
||||||
|
target_compile_definitions(lua PRIVATE LUA_USE_APICHECK)
|
||||||
|
|
||||||
|
if(NOT MSVC AND "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
|
||||||
|
# mbed TLS uses the frame pointer's register in inline assembly for its bignum implementation:
|
||||||
|
# https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here
|
||||||
|
target_compile_options(mbedcrypto PRIVATE -fomit-frame-pointer)
|
||||||
|
endif()
|
112
CMake/GenerateBindings.cmake
Normal file
112
CMake/GenerateBindings.cmake
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
# Enumerate every Lua-exported class.
|
||||||
|
# Changes to these files will cause binding regen:
|
||||||
|
set(BINDING_DEPENDENCIES
|
||||||
|
Bindings/AllToLua.pkg
|
||||||
|
Bindings/BindingsProcessor.lua
|
||||||
|
Bindings/LuaFunctions.h
|
||||||
|
Bindings/LuaWindow.h
|
||||||
|
Bindings/Plugin.h
|
||||||
|
Bindings/PluginLua.h
|
||||||
|
Bindings/PluginManager.h
|
||||||
|
BiomeDef.h
|
||||||
|
BlockArea.h
|
||||||
|
BlockEntities/BeaconEntity.h
|
||||||
|
BlockEntities/BedEntity.h
|
||||||
|
BlockEntities/BlockEntity.h
|
||||||
|
BlockEntities/BlockEntityWithItems.h
|
||||||
|
BlockEntities/BrewingstandEntity.h
|
||||||
|
BlockEntities/ChestEntity.h
|
||||||
|
BlockEntities/CommandBlockEntity.h
|
||||||
|
BlockEntities/DispenserEntity.h
|
||||||
|
BlockEntities/DropSpenserEntity.h
|
||||||
|
BlockEntities/DropperEntity.h
|
||||||
|
BlockEntities/FurnaceEntity.h
|
||||||
|
BlockEntities/HopperEntity.h
|
||||||
|
BlockEntities/JukeboxEntity.h
|
||||||
|
BlockEntities/MobSpawnerEntity.h
|
||||||
|
BlockEntities/NoteEntity.h
|
||||||
|
BlockEntities/SignEntity.h
|
||||||
|
BlockEntities/MobHeadEntity.h
|
||||||
|
BlockEntities/FlowerPotEntity.h
|
||||||
|
BlockType.h
|
||||||
|
BlockInfo.h
|
||||||
|
BoundingBox.h
|
||||||
|
ChatColor.h
|
||||||
|
ChunkDef.h
|
||||||
|
ClientHandle.h
|
||||||
|
Color.h
|
||||||
|
CompositeChat.h
|
||||||
|
CraftingRecipes.h
|
||||||
|
Cuboid.h
|
||||||
|
Defines.h
|
||||||
|
EffectID.h
|
||||||
|
Enchantments.h
|
||||||
|
Entities/Boat.h
|
||||||
|
Entities/ArrowEntity.h
|
||||||
|
Entities/Entity.h
|
||||||
|
Entities/ExpOrb.h
|
||||||
|
Entities/EntityEffect.h
|
||||||
|
Entities/ExpBottleEntity.h
|
||||||
|
Entities/FallingBlock.h
|
||||||
|
Entities/FireChargeEntity.h
|
||||||
|
Entities/FireworkEntity.h
|
||||||
|
Entities/Floater.h
|
||||||
|
Entities/GhastFireballEntity.h
|
||||||
|
Entities/HangingEntity.h
|
||||||
|
Entities/ItemFrame.h
|
||||||
|
Entities/LeashKnot.h
|
||||||
|
Entities/Pawn.h
|
||||||
|
Entities/Player.h
|
||||||
|
Entities/Painting.h
|
||||||
|
Entities/Pickup.h
|
||||||
|
Entities/ProjectileEntity.h
|
||||||
|
Entities/SplashPotionEntity.h
|
||||||
|
Entities/ThrownEggEntity.h
|
||||||
|
Entities/ThrownEnderPearlEntity.h
|
||||||
|
Entities/ThrownSnowballEntity.h
|
||||||
|
Entities/TNTEntity.h
|
||||||
|
Entities/WitherSkullEntity.h
|
||||||
|
Generating/ChunkDesc.h
|
||||||
|
IniFile.h
|
||||||
|
Inventory.h
|
||||||
|
Item.h
|
||||||
|
ItemGrid.h
|
||||||
|
Map.h
|
||||||
|
MapManager.h
|
||||||
|
Mobs/Monster.h
|
||||||
|
Mobs/MonsterTypes.h
|
||||||
|
OSSupport/File.h
|
||||||
|
Protocol/MojangAPI.h
|
||||||
|
Root.h
|
||||||
|
Scoreboard.h
|
||||||
|
Server.h
|
||||||
|
Statistics.h
|
||||||
|
StringUtils.h
|
||||||
|
UI/Window.h
|
||||||
|
UUID.h
|
||||||
|
Vector3.h
|
||||||
|
WebAdmin.h
|
||||||
|
World.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# List all the files that are generated as part of the Bindings build process:
|
||||||
|
set(BINDING_OUTPUTS
|
||||||
|
Bindings.cpp
|
||||||
|
Bindings.h
|
||||||
|
LuaState_Declaration.inc
|
||||||
|
LuaState_Implementation.cpp
|
||||||
|
LuaState_Typedefs.inc
|
||||||
|
)
|
||||||
|
|
||||||
|
# Make the file paths absolute and pointing to the bindings folder:
|
||||||
|
set(BINDINGS_FOLDER "${PROJECT_SOURCE_DIR}/src/Bindings/")
|
||||||
|
list(TRANSFORM BINDING_OUTPUTS PREPEND ${BINDINGS_FOLDER})
|
||||||
|
list(TRANSFORM BINDING_DEPENDENCIES PREPEND "${PROJECT_SOURCE_DIR}/src/")
|
||||||
|
|
||||||
|
# Generate the bindings:
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${BINDING_OUTPUTS}
|
||||||
|
COMMAND luaexe BindingsProcessor.lua
|
||||||
|
WORKING_DIRECTORY ${BINDINGS_FOLDER}
|
||||||
|
DEPENDS ${BINDING_DEPENDENCIES} luaexe
|
||||||
|
)
|
42
CMake/GroupSources.cmake
Normal file
42
CMake/GroupSources.cmake
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Enable the support for solution folders in MSVC
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
# Put projects into solution folders in MSVC:
|
||||||
|
set_target_properties(
|
||||||
|
event_core_static
|
||||||
|
event_extra_static
|
||||||
|
expat
|
||||||
|
fmt
|
||||||
|
jsoncpp_lib
|
||||||
|
lua
|
||||||
|
luaexpat
|
||||||
|
mbedcrypto
|
||||||
|
mbedtls
|
||||||
|
mbedx509
|
||||||
|
lsqlite
|
||||||
|
sqlite3
|
||||||
|
SQLiteCpp
|
||||||
|
tolualib
|
||||||
|
zlib
|
||||||
|
PROPERTIES FOLDER Libraries
|
||||||
|
)
|
||||||
|
|
||||||
|
# luaproxy not generated on anything else
|
||||||
|
if(WIN32)
|
||||||
|
set_target_properties(
|
||||||
|
luaproxy
|
||||||
|
PROPERTIES FOLDER Support
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${BUILD_TOOLS})
|
||||||
|
set_target_properties(
|
||||||
|
MCADefrag
|
||||||
|
ProtoProxy
|
||||||
|
PROPERTIES FOLDER Tools
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Put all files into one project, separate by the folders:
|
||||||
|
get_property(TARGET_SOURCE_FILES TARGET ${CMAKE_PROJECT_NAME} PROPERTY SOURCES)
|
||||||
|
source_group(TREE "${PROJECT_SOURCE_DIR}/src" FILES ${TARGET_SOURCE_FILES})
|
264
CMakeLists.txt
264
CMakeLists.txt
@ -13,19 +13,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
cmake_minimum_required (VERSION 3.12.4)
|
cmake_minimum_required (VERSION 3.13)
|
||||||
|
project(
|
||||||
|
Cuberite
|
||||||
|
DESCRIPTION "A lightweight, fast and extensible game server for Minecraft"
|
||||||
|
HOMEPAGE_URL "https://cuberite.org"
|
||||||
|
LANGUAGES C CXX
|
||||||
|
)
|
||||||
|
|
||||||
if (POLICY CMP0054)
|
option(BUILD_TOOLS "Sets up additional executables to be built along with the server" OFF)
|
||||||
cmake_policy(SET CMP0054 NEW)
|
option(PRECOMPILE_HEADERS "Enable precompiled headers for faster builds" ON)
|
||||||
endif()
|
option(SELF_TEST "Enables testing code to be built" OFF)
|
||||||
|
option(UNITY_BUILDS "Enables source aggregation for faster builds" ON)
|
||||||
# Without this, the MSVC variable isn't defined for MSVC builds ( https://cmake.org/pipermail/cmake/2011-November/047130.html )
|
|
||||||
enable_language(CXX C)
|
|
||||||
|
|
||||||
# Enable the support for solution folders in MSVC
|
|
||||||
if (MSVC)
|
|
||||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# These env variables are used for configuring Travis CI builds.
|
# These env variables are used for configuring Travis CI builds.
|
||||||
if(DEFINED ENV{TRAVIS_CUBERITE_BUILD_TYPE})
|
if(DEFINED ENV{TRAVIS_CUBERITE_BUILD_TYPE})
|
||||||
@ -93,54 +92,20 @@ else()
|
|||||||
set(BUILD_DATETIME "approx: ${BUILD_DATETIME}")
|
set(BUILD_DATETIME "approx: ${BUILD_DATETIME}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# We need C++11 features, Visual Studio has those from VS2012, but it needs a new platform toolset for those; VS2013 supports them natively:
|
# We need C++17 features
|
||||||
# Adapted from https://web.archive.org/web/https://binglongx.wordpress.com/2013/06/28/set-non-default-platform-toolset-in-cmake/
|
|
||||||
if(MSVC OR MSVC_IDE)
|
|
||||||
if( MSVC_VERSION LESS 1700 ) # VC10- / VS2010-
|
|
||||||
message(FATAL_ERROR "The project requires C++11 features. "
|
|
||||||
"You need at least Visual Studio 11 (Microsoft Visual Studio 2012), "
|
|
||||||
"with Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012).")
|
|
||||||
elseif( MSVC_VERSION EQUAL 1700 ) # VC11 / VS2012
|
|
||||||
message( "VC11: using Microsoft Visual Studio 2012 "
|
|
||||||
"with Microsoft Visual C++ Compiler Nov 2012 CTP (v120_CTP_Nov2012)" )
|
|
||||||
set(CMAKE_GENERATOR_TOOLSET "v120_CTP_Nov2012" CACHE STRING "Platform Toolset" FORCE)
|
|
||||||
else() # VC12+, assuming C++11 supported.
|
|
||||||
endif()
|
|
||||||
else() # GCC or Clang, so get compiler version directly since CMAKE_CXX_COMPILER_VERSION is only available in CMake 2.8.8 and later
|
|
||||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE DUMPED_COMPILER_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
|
|
||||||
# Check for gcc version 4.8 or greater
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND DUMPED_COMPILER_VERSION VERSION_LESS "4.8")
|
|
||||||
message(FATAL_ERROR "You have ${CMAKE_CXX_COMPILER_ID} version ${DUMPED_COMPILER_VERSION}, but at least 4.8 is needed")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Check for clang version 3.4 or greater
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND DUMPED_COMPILER_VERSION VERSION_LESS "3.4")
|
|
||||||
message(FATAL_ERROR "You have ${CMAKE_CXX_COMPILER_ID} version ${DUMPED_COMPILER_VERSION}, but at least 3.4 is needed")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
|
||||||
set(BUILD_TOOLS OFF CACHE BOOL "")
|
# The need for speed (in Release)
|
||||||
set(SELF_TEST OFF CACHE BOOL "")
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT IPO_SUPPORTED)
|
||||||
# Check whether Lua can be used:
|
if(IPO_SUPPORTED)
|
||||||
if (NOT(DISABLE_SYSTEM_LUA))
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
||||||
include(CheckLua.cmake)
|
|
||||||
if(HAS_LUA_INTERPRETER)
|
|
||||||
message(STATUS "Lua has been found in your system and will be used for the build.")
|
|
||||||
set(USE_SYSTEM_LUA 1)
|
|
||||||
else()
|
|
||||||
message(STATUS "Lua has NOT been found in your system, the build will use its own Lua implementation.")
|
|
||||||
unset(USE_SYSTEM_LUA)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(STATUS "System Lua is disabled via CMake command-line parameters. The build will use its own Lua implementation.")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Static CRT
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
|
|
||||||
# This has to be done before any flags have been set up.
|
# This has to be done before any flags have been set up.
|
||||||
if(${BUILD_TOOLS})
|
if(${BUILD_TOOLS})
|
||||||
@ -161,31 +126,6 @@ set_flags()
|
|||||||
set_lib_flags()
|
set_lib_flags()
|
||||||
enable_profile()
|
enable_profile()
|
||||||
|
|
||||||
# Under Windows, we need Lua as DLL; on *nix we need it linked statically:
|
|
||||||
if (WIN32)
|
|
||||||
add_definitions(-DLUA_BUILD_AS_DLL)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# The Expat library is linked in statically, make the source files aware of that:
|
|
||||||
add_definitions(-DXML_STATIC)
|
|
||||||
|
|
||||||
# Let Lua use additional checks on its C API. This is only compiled into Debug builds:
|
|
||||||
add_definitions(-DLUA_USE_APICHECK)
|
|
||||||
|
|
||||||
# Self Test Mode enables extra checks at startup
|
|
||||||
if(${SELF_TEST})
|
|
||||||
add_definitions(-DSELF_TEST)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Build all dependent libraries as static:
|
|
||||||
SET(CMAKE_BUILD_STATIC_LIBRARIES ON)
|
|
||||||
|
|
||||||
####
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
project (Cuberite)
|
|
||||||
|
|
||||||
# Set options for SQLiteCpp, disable all their tests and lints:
|
# Set options for SQLiteCpp, disable all their tests and lints:
|
||||||
set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "Run cpplint.py tool for Google C++ StyleGuide." FORCE)
|
set(SQLITECPP_RUN_CPPLINT OFF CACHE BOOL "Run cpplint.py tool for Google C++ StyleGuide." FORCE)
|
||||||
set(SQLITECPP_RUN_CPPCHECK OFF CACHE BOOL "Run cppcheck C++ static analysis tool." FORCE)
|
set(SQLITECPP_RUN_CPPCHECK OFF CACHE BOOL "Run cppcheck C++ static analysis tool." FORCE)
|
||||||
@ -203,12 +143,14 @@ set(EVENT__DISABLE_REGRESS YES CACHE BOOL "Disable LibEvent regression tests
|
|||||||
set(EVENT__DISABLE_SAMPLES YES CACHE BOOL "Disable LibEvent samples" FORCE)
|
set(EVENT__DISABLE_SAMPLES YES CACHE BOOL "Disable LibEvent samples" FORCE)
|
||||||
set(EVENT__LIBRARY_TYPE "STATIC" CACHE STRING "Use static LibEvent libraries" FORCE)
|
set(EVENT__LIBRARY_TYPE "STATIC" CACHE STRING "Use static LibEvent libraries" FORCE)
|
||||||
|
|
||||||
# Set options for JsonCPP, disabling all of their tests
|
# Set options for JsonCPP, disabling all of their tests:
|
||||||
# Additionally, their library is output to a strange location; make sure the linker knows where to find it
|
|
||||||
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Compile and (for jsoncpp_check) run JsonCpp test executables")
|
set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Compile and (for jsoncpp_check) run JsonCpp test executables")
|
||||||
set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF CACHE BOOL "Automatically run unit-tests as a post build step")
|
set(JSONCPP_WITH_POST_BUILD_UNITTEST OFF CACHE BOOL "Automatically run unit-tests as a post build step")
|
||||||
set(JSONCPP_WITH_PKGCONFIG_SUPPORT OFF CACHE BOOL "Generate and install .pc files")
|
set(JSONCPP_WITH_PKGCONFIG_SUPPORT OFF CACHE BOOL "Generate and install .pc files")
|
||||||
link_directories(lib/jsoncpp/src/lib_json)
|
|
||||||
|
# Set options for mbedtls:
|
||||||
|
set(ENABLE_PROGRAMS OFF CACHE BOOL "Build mbed TLS programs.")
|
||||||
|
set(ENABLE_TESTING OFF CACHE BOOL "Build mbed TLS tests.")
|
||||||
|
|
||||||
# Check that the libraries are present:
|
# Check that the libraries are present:
|
||||||
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/lib/SQLiteCpp/CMakeLists.txt)
|
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/lib/SQLiteCpp/CMakeLists.txt)
|
||||||
@ -251,84 +193,102 @@ if (NOT EXISTS ${PROJECT_SOURCE_DIR}/lib/zlib/CMakeLists.txt)
|
|||||||
message(FATAL_ERROR "zlib is missing in folder lib/zlib. Have you initialized and updated the submodules / downloaded the extra libraries?")
|
message(FATAL_ERROR "zlib is missing in folder lib/zlib. Have you initialized and updated the submodules / downloaded the extra libraries?")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Include all the libraries
|
||||||
|
# We use EXCLUDE_FROM_ALL so that only the explicit dependencies are compiled
|
||||||
|
# (mbedTLS also has test and example programs in their CMakeLists.txt, we don't want those):
|
||||||
# Include all the libraries:
|
add_subdirectory(lib/expat)
|
||||||
add_subdirectory(lib/jsoncpp/ EXCLUDE_FROM_ALL)
|
|
||||||
add_subdirectory(lib/zlib/)
|
|
||||||
add_subdirectory(lib/lua/)
|
|
||||||
add_subdirectory(lib/tolua++/ EXCLUDE_FROM_ALL)
|
|
||||||
add_subdirectory(lib/SQLiteCpp/)
|
|
||||||
add_subdirectory(lib/sqlite/)
|
|
||||||
add_subdirectory(lib/expat/)
|
|
||||||
add_subdirectory(lib/luaexpat/)
|
|
||||||
add_subdirectory(lib/libevent/ EXCLUDE_FROM_ALL)
|
|
||||||
add_subdirectory(lib/fmt)
|
add_subdirectory(lib/fmt)
|
||||||
|
add_subdirectory(lib/jsoncpp EXCLUDE_FROM_ALL)
|
||||||
|
add_subdirectory(lib/libevent EXCLUDE_FROM_ALL)
|
||||||
# Add proper includes for LibEvent's event-config.h header:
|
add_subdirectory(lib/lua)
|
||||||
include_directories(SYSTEM ${LIBEVENT_INCLUDE_DIRS})
|
add_subdirectory(lib/luaexpat)
|
||||||
|
add_subdirectory(lib/mbedtls)
|
||||||
# Prettify jsoncpp_lib name in VS solution explorer
|
add_subdirectory(lib/SQLiteCpp) # SQLiteCpp needs to be included before sqlite so the lsqlite target is available
|
||||||
set_property(TARGET jsoncpp_lib PROPERTY PROJECT_LABEL "jsoncpp")
|
add_subdirectory(lib/sqlite)
|
||||||
# jsoncpp uses these for ccache support, clashing with our method
|
add_subdirectory(lib/tolua++ EXCLUDE_FROM_ALL)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "")
|
add_subdirectory(lib/zlib)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "")
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
add_subdirectory(lib/luaproxy/)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# We use EXCLUDE_FROM_ALL so that only the explicit dependencies are used
|
|
||||||
# (mbedTLS also has test and example programs in their CMakeLists.txt, we don't want those)
|
|
||||||
include(lib/mbedtls.cmake EXCLUDE_FROM_ALL)
|
|
||||||
|
|
||||||
if(NOT MSVC AND "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
|
|
||||||
# mbed TLS uses the frame pointer's register in inline assembly for its bignum implementation:
|
|
||||||
# https://tls.mbed.org/kb/development/arm-thumb-error-r7-cannot-be-used-in-asm-here
|
|
||||||
target_compile_options(mbedcrypto PRIVATE -fomit-frame-pointer)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_exe_flags()
|
set_exe_flags()
|
||||||
|
add_executable(${CMAKE_PROJECT_NAME})
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
|
# Set the startup project to Cuberite, and the debugger dir:
|
||||||
|
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${CMAKE_PROJECT_NAME})
|
||||||
|
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Server")
|
||||||
|
|
||||||
|
# Enable PCH and jumbo builds on supporting CMake:
|
||||||
|
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.16")
|
||||||
|
if (PRECOMPILE_HEADERS)
|
||||||
|
target_precompile_headers(${CMAKE_PROJECT_NAME} PRIVATE src/Globals.h)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (UNITY_BUILDS)
|
||||||
|
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES UNITY_BUILD ON)
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
message(WARNING "Precompiled headers for FASTER BUILDS not enabled, upgrade to CMake 1.16 or newer!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add required includes:
|
||||||
|
target_include_directories(
|
||||||
|
${CMAKE_PROJECT_NAME} SYSTEM PRIVATE
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/lib/libevent/include # TODO: remove when updating libevent
|
||||||
|
lib/libevent/include
|
||||||
|
lib/mbedtls/include
|
||||||
|
lib/TCLAP/include
|
||||||
|
lib # TODO fix files including zlib/x instead of x
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link dependencies as private:
|
||||||
|
target_link_libraries(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
event_core
|
||||||
|
event_extra
|
||||||
|
fmt::fmt
|
||||||
|
jsoncpp_lib
|
||||||
|
lsqlite
|
||||||
|
lua
|
||||||
|
luaexpat
|
||||||
|
mbedtls
|
||||||
|
SQLiteCpp
|
||||||
|
tolualib
|
||||||
|
zlib
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link process information library:
|
||||||
|
if (WIN32)
|
||||||
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Psapi.lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Special case handling for libevent pthreads:
|
||||||
|
if(NOT WIN32)
|
||||||
|
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE event_pthreads_static)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Prettify jsoncpp_lib name in VS solution explorer:
|
||||||
|
set_property(TARGET jsoncpp_lib PROPERTY PROJECT_LABEL "jsoncpp")
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
add_subdirectory(lib/luaproxy)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Selectively disable warnings in the level where the target is created:
|
||||||
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
|
# Generated file has old-style casts, missing prototypes, and deprecated declarations
|
||||||
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp" PROPERTIES COMPILE_OPTIONS -Wno-everything)
|
||||||
|
|
||||||
|
# File failed to follow NHS guidelines on handwashing and has not maintained good hygiene
|
||||||
|
set_source_files_properties("${CMAKE_SOURCE_DIR}/src/IniFile.cpp" PROPERTIES COMPILE_OPTIONS -Wno-header-hygiene)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Self Test Mode enables extra checks at startup
|
||||||
if(${SELF_TEST})
|
if(${SELF_TEST})
|
||||||
message("Tests enabled")
|
message("Tests enabled")
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Put projects into solution folders in MSVC:
|
include("CMake/Fixups.cmake")
|
||||||
if (MSVC)
|
include("CMake/GenerateBindings.cmake")
|
||||||
set_target_properties(
|
include("CMake/GroupSources.cmake")
|
||||||
event_core_static
|
# TODO: include("CMake/SetCompilerFlags.cmake")
|
||||||
event_extra_static
|
|
||||||
expat
|
|
||||||
fmt
|
|
||||||
jsoncpp_lib
|
|
||||||
lua
|
|
||||||
luaexpat
|
|
||||||
mbedcrypto
|
|
||||||
mbedtls
|
|
||||||
mbedx509
|
|
||||||
lsqlite
|
|
||||||
SQLiteCpp
|
|
||||||
tolualib
|
|
||||||
zlib
|
|
||||||
PROPERTIES FOLDER Lib
|
|
||||||
)
|
|
||||||
set_target_properties(
|
|
||||||
luaproxy
|
|
||||||
PROPERTIES FOLDER Support
|
|
||||||
)
|
|
||||||
|
|
||||||
if(${BUILD_TOOLS})
|
|
||||||
set_target_properties(
|
|
||||||
MCADefrag
|
|
||||||
ProtoProxy
|
|
||||||
PROPERTIES FOLDER Tools
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
@ -63,6 +63,14 @@ macro(set_flags)
|
|||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||||
|
|
||||||
|
# Make MSVC generate the PDB files even for the release build
|
||||||
|
# (TODO: have AppVeyor build RelWithDebInfo and remove):
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi")
|
||||||
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
|
||||||
|
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
|
||||||
|
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /DEBUG")
|
||||||
|
|
||||||
# Make build use Unicode:
|
# Make build use Unicode:
|
||||||
add_definitions(-DUNICODE -D_UNICODE)
|
add_definitions(-DUNICODE -D_UNICODE)
|
||||||
elseif(APPLE)
|
elseif(APPLE)
|
||||||
|
@ -21,7 +21,6 @@ function(flatten_files arg1)
|
|||||||
set(${arg1} "${res}" PARENT_SCOPE)
|
set(${arg1} "${res}" PARENT_SCOPE)
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
include(../../lib/mbedtls.cmake)
|
|
||||||
add_subdirectory(../../lib/zlib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/lib/zlib)
|
add_subdirectory(../../lib/zlib ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/lib/zlib)
|
||||||
|
|
||||||
set_exe_flags()
|
set_exe_flags()
|
||||||
|
@ -249,11 +249,6 @@ around it, "(32 KiB)") */
|
|||||||
// Pretty much the same as ASSERT() but stays in Release builds
|
// Pretty much the same as ASSERT() but stays in Release builds
|
||||||
#define VERIFY( x) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
|
#define VERIFY( x) ( !!(x) || ( LOGERROR("Verification failed: %s, file %s, line %i", #x, __FILE__, __LINE__), exit(1), 0))
|
||||||
|
|
||||||
// Same as assert but in all Self test builds
|
|
||||||
#ifdef SELF_TEST
|
|
||||||
#define assert_test(x) ( !!(x) || (assert(!#x), exit(1), 0))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// C++11 has std::shared_ptr in <memory>, included earlier
|
// C++11 has std::shared_ptr in <memory>, included earlier
|
||||||
#define SharedPtr std::shared_ptr
|
#define SharedPtr std::shared_ptr
|
||||||
|
|
||||||
|
@ -9,7 +9,10 @@ ARGS="-header-filter $REGEX -quiet -export-fixes $FIXES_FILE "$@" $REGEX"
|
|||||||
# Generate the compilation database
|
# Generate the compilation database
|
||||||
mkdir -p tidy-build
|
mkdir -p tidy-build
|
||||||
cd tidy-build
|
cd tidy-build
|
||||||
cmake --target Cuberite -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
|
|
||||||
|
# Disable precompiled headers since they aren't generated during linting which causes an error
|
||||||
|
# Disable unity builds since clang-tidy needs the full list of compiled files to check each one
|
||||||
|
cmake --target Cuberite -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DPRECOMPILE_HEADERS=OFF -DUNITY_BUILDS=OFF ..
|
||||||
|
|
||||||
# Ensure LuaState_Typedefs.inc has been generated
|
# Ensure LuaState_Typedefs.inc has been generated
|
||||||
(cd ../src/Bindings && lua BindingsProcessor.lua)
|
(cd ../src/Bindings && lua BindingsProcessor.lua)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 829d549af3a11e24fcb0b99090837dac9a9aae4f
|
Subproject commit 6aec7cf646e9d0e49b0000c3d5b74de9c3222ef2
|
@ -1 +1 @@
|
|||||||
Subproject commit ec3ddcfe41b0544a4551a57439b6b3682fe31479
|
Subproject commit 12cee38782897cfe60a1611615c200c45cd99eaf
|
@ -1 +1 @@
|
|||||||
Subproject commit 75f059124b8e9d3d442d1907344187f15e34e6b6
|
Subproject commit e87c7903718ed7e05cbb614bbc385553987a2d33
|
@ -1 +1 @@
|
|||||||
Subproject commit d2e6a971f4544c55b8e3b25cf96db266971b778f
|
Subproject commit b8cb8889aab726a35c49472228256f7bb1d44388
|
2
lib/lua
2
lib/lua
@ -1 +1 @@
|
|||||||
Subproject commit 6d57f1c3c4face973f0405b2a3c0fb8471a79d92
|
Subproject commit e5942d9d88221dc02b824f5bda0db9876fa92bad
|
@ -1 +1 @@
|
|||||||
Subproject commit bf6adc1f92708600707c0a8603b45a9de9a8fe14
|
Subproject commit 368e2927fcd227bf0af91b3e4b92e740196425cd
|
@ -1 +1 @@
|
|||||||
Subproject commit 9a17fd73198c645c924996c0aee7836f51bcf7bb
|
Subproject commit 01cbf6d5a5ba91dd78d17604865dd3aebe1b5093
|
@ -1 +1 @@
|
|||||||
Subproject commit 4a814cf1759c8a1d0917344397a84c917c74de97
|
Subproject commit 23cd44840dc9405f4f7df34a621a351062359b8d
|
2
lib/zlib
2
lib/zlib
@ -1 +1 @@
|
|||||||
Subproject commit 2ea59173610490eb48e29de44bd6e04324d84995
|
Subproject commit a9c7b30641ed8b86590141a1b4025263bce4c881
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
Bindings.cpp
|
Bindings.cpp
|
||||||
DeprecatedBindings.cpp
|
DeprecatedBindings.cpp
|
||||||
LuaChunkStay.cpp
|
LuaChunkStay.cpp
|
||||||
@ -19,9 +20,7 @@ SET (SRCS
|
|||||||
Plugin.cpp
|
Plugin.cpp
|
||||||
PluginLua.cpp
|
PluginLua.cpp
|
||||||
PluginManager.cpp
|
PluginManager.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
Bindings.h
|
Bindings.h
|
||||||
DeprecatedBindings.h
|
DeprecatedBindings.h
|
||||||
LuaChunkStay.h
|
LuaChunkStay.h
|
||||||
@ -41,133 +40,3 @@ SET (HDRS
|
|||||||
PluginManager.h
|
PluginManager.h
|
||||||
tolua++.h
|
tolua++.h
|
||||||
)
|
)
|
||||||
|
|
||||||
# List all the files that are generated as part of the Bindings build process
|
|
||||||
set (BINDING_OUTPUTS
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Bindings.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/Bindings.h
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Declaration.inc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Implementation.cpp
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/LuaState_Typedefs.inc
|
|
||||||
)
|
|
||||||
|
|
||||||
set(BINDING_DEPENDENCIES
|
|
||||||
../Bindings/AllToLua.pkg
|
|
||||||
../Bindings/BindingsProcessor.lua
|
|
||||||
../Bindings/LuaFunctions.h
|
|
||||||
../Bindings/LuaWindow.h
|
|
||||||
../Bindings/Plugin.h
|
|
||||||
../Bindings/PluginLua.h
|
|
||||||
../Bindings/PluginManager.h
|
|
||||||
../BiomeDef.h
|
|
||||||
../BlockArea.h
|
|
||||||
../BlockEntities/BeaconEntity.h
|
|
||||||
../BlockEntities/BedEntity.h
|
|
||||||
../BlockEntities/BlockEntity.h
|
|
||||||
../BlockEntities/BlockEntityWithItems.h
|
|
||||||
../BlockEntities/BrewingstandEntity.h
|
|
||||||
../BlockEntities/ChestEntity.h
|
|
||||||
../BlockEntities/CommandBlockEntity.h
|
|
||||||
../BlockEntities/DispenserEntity.h
|
|
||||||
../BlockEntities/DropSpenserEntity.h
|
|
||||||
../BlockEntities/DropperEntity.h
|
|
||||||
../BlockEntities/FurnaceEntity.h
|
|
||||||
../BlockEntities/HopperEntity.h
|
|
||||||
../BlockEntities/JukeboxEntity.h
|
|
||||||
../BlockEntities/MobSpawnerEntity.h
|
|
||||||
../BlockEntities/NoteEntity.h
|
|
||||||
../BlockEntities/SignEntity.h
|
|
||||||
../BlockEntities/MobHeadEntity.h
|
|
||||||
../BlockEntities/FlowerPotEntity.h
|
|
||||||
../BlockType.h
|
|
||||||
../BlockInfo.h
|
|
||||||
../BoundingBox.h
|
|
||||||
../ChatColor.h
|
|
||||||
../ChunkDef.h
|
|
||||||
../ClientHandle.h
|
|
||||||
../Color.h
|
|
||||||
../CompositeChat.h
|
|
||||||
../CraftingRecipes.h
|
|
||||||
../Cuboid.h
|
|
||||||
../Defines.h
|
|
||||||
../EffectID.h
|
|
||||||
../Enchantments.h
|
|
||||||
../Entities/Boat.h
|
|
||||||
../Entities/ArrowEntity.h
|
|
||||||
../Entities/Entity.h
|
|
||||||
../Entities/ExpOrb.h
|
|
||||||
../Entities/EntityEffect.h
|
|
||||||
../Entities/ExpBottleEntity.h
|
|
||||||
../Entities/FallingBlock.h
|
|
||||||
../Entities/FireChargeEntity.h
|
|
||||||
../Entities/FireworkEntity.h
|
|
||||||
../Entities/Floater.h
|
|
||||||
../Entities/GhastFireballEntity.h
|
|
||||||
../Entities/HangingEntity.h
|
|
||||||
../Entities/ItemFrame.h
|
|
||||||
../Entities/LeashKnot.h
|
|
||||||
../Entities/Pawn.h
|
|
||||||
../Entities/Player.h
|
|
||||||
../Entities/Painting.h
|
|
||||||
../Entities/Pickup.h
|
|
||||||
../Entities/ProjectileEntity.h
|
|
||||||
../Entities/SplashPotionEntity.h
|
|
||||||
../Entities/ThrownEggEntity.h
|
|
||||||
../Entities/ThrownEnderPearlEntity.h
|
|
||||||
../Entities/ThrownSnowballEntity.h
|
|
||||||
../Entities/TNTEntity.h
|
|
||||||
../Entities/WitherSkullEntity.h
|
|
||||||
../Generating/ChunkDesc.h
|
|
||||||
../IniFile.h
|
|
||||||
../Inventory.h
|
|
||||||
../Item.h
|
|
||||||
../ItemGrid.h
|
|
||||||
../Map.h
|
|
||||||
../MapManager.h
|
|
||||||
../Mobs/Monster.h
|
|
||||||
../Mobs/MonsterTypes.h
|
|
||||||
../OSSupport/File.h
|
|
||||||
../Protocol/MojangAPI.h
|
|
||||||
../Root.h
|
|
||||||
../Scoreboard.h
|
|
||||||
../Server.h
|
|
||||||
../Statistics.h
|
|
||||||
../StringUtils.h
|
|
||||||
../UI/Window.h
|
|
||||||
../UUID.h
|
|
||||||
../Vector3.h
|
|
||||||
../WebAdmin.h
|
|
||||||
../World.h
|
|
||||||
)
|
|
||||||
|
|
||||||
if (NOT MSVC)
|
|
||||||
if (USE_SYSTEM_LUA)
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${BINDING_OUTPUTS}
|
|
||||||
COMMAND lua BindingsProcessor.lua
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
DEPENDS ${BINDING_DEPENDENCIES}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${BINDING_OUTPUTS}
|
|
||||||
COMMAND luaexe BindingsProcessor.lua
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
||||||
DEPENDS ${BINDING_DEPENDENCIES} luaexe
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set_source_files_properties(${BINDING_OUTPUTS} PROPERTIES GENERATED TRUE)
|
|
||||||
|
|
||||||
set_source_files_properties(${CMAKE_SOURCE_DIR}/src/Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS -Wno-error)
|
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
|
||||||
set_source_files_properties(Bindings.cpp PROPERTIES COMPILE_FLAGS
|
|
||||||
"-Wno-old-style-cast -Wno-missing-prototypes -Wno-deprecated-declarations")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Bindings ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Bindings fmt::fmt lua lsqlite tolualib mbedtls HTTPServer SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -19,8 +19,8 @@ local g_ShouldIgnorePkg =
|
|||||||
local g_ShouldIgnoreCMake =
|
local g_ShouldIgnoreCMake =
|
||||||
{
|
{
|
||||||
["tolua"] = true,
|
["tolua"] = true,
|
||||||
["../Bindings/AllToLua.pkg"] = true,
|
["Bindings/AllToLua.pkg"] = true,
|
||||||
["../Bindings/BindingsProcessor.lua"] = true,
|
["Bindings/BindingsProcessor.lua"] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -37,7 +37,17 @@ local function getAllToLuaPkgFiles()
|
|||||||
if (g_ShouldIgnorePkg[a_FileName]) then
|
if (g_ShouldIgnorePkg[a_FileName]) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
a_FileName = a_FileName:gsub("../Bindings/", "") -- Normalize the path
|
|
||||||
|
-- Normalize the path: AllToLua is relative to src\Bindings
|
||||||
|
-- but the CMake dependencies list is relative to src\
|
||||||
|
a_FileName, cnt = a_FileName:gsub("%.%./", "")
|
||||||
|
|
||||||
|
-- If no replacements were done, this entry must point to a file
|
||||||
|
-- inside the Bindings folder; normalize it
|
||||||
|
if cnt == 0 then
|
||||||
|
a_FileName = "Bindings/" .. a_FileName
|
||||||
|
end
|
||||||
|
|
||||||
table.insert(res, a_FileName)
|
table.insert(res, a_FileName)
|
||||||
res[a_FileName] = true
|
res[a_FileName] = true
|
||||||
end
|
end
|
||||||
@ -54,7 +64,7 @@ end
|
|||||||
--- Returns a sorted list of all files listed as dependencies in CMakeLists.txt
|
--- Returns a sorted list of all files listed as dependencies in CMakeLists.txt
|
||||||
-- The returned table has both an array part (list of files) and a dictionary part ("filename" -> true)
|
-- The returned table has both an array part (list of files) and a dictionary part ("filename" -> true)
|
||||||
local function getCMakeListsFiles()
|
local function getCMakeListsFiles()
|
||||||
local f = assert(io.open("CMakeLists.txt", "r"))
|
local f = assert(io.open("../../CMake/GenerateBindings.cmake", "r"))
|
||||||
local contents = f:read("*all")
|
local contents = f:read("*all")
|
||||||
f:close()
|
f:close()
|
||||||
local res = {}
|
local res = {}
|
||||||
@ -69,7 +79,6 @@ local function getCMakeListsFiles()
|
|||||||
if (g_ShouldIgnoreCMake[a_FileName]) then
|
if (g_ShouldIgnoreCMake[a_FileName]) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
a_FileName = a_FileName:gsub("../Bindings/", "") -- Normalize the path
|
|
||||||
table.insert(res, a_FileName)
|
table.insert(res, a_FileName)
|
||||||
res[a_FileName] = true
|
res[a_FileName] = true
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
BeaconEntity.cpp
|
BeaconEntity.cpp
|
||||||
BedEntity.cpp
|
BedEntity.cpp
|
||||||
BlockEntity.cpp
|
BlockEntity.cpp
|
||||||
@ -19,9 +20,7 @@ SET (SRCS
|
|||||||
MobSpawnerEntity.cpp
|
MobSpawnerEntity.cpp
|
||||||
NoteEntity.cpp
|
NoteEntity.cpp
|
||||||
SignEntity.cpp
|
SignEntity.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
BeaconEntity.h
|
BeaconEntity.h
|
||||||
BedEntity.h
|
BedEntity.h
|
||||||
BlockEntity.h
|
BlockEntity.h
|
||||||
@ -42,8 +41,3 @@ SET (HDRS
|
|||||||
NoteEntity.h
|
NoteEntity.h
|
||||||
SignEntity.h
|
SignEntity.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(BlockEntities ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(BlockEntities fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
project (Cuberite)
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
include_directories ("${PROJECT_SOURCE_DIR}/../")
|
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
BlockBed.cpp
|
BlockBed.cpp
|
||||||
BlockDoor.cpp
|
BlockDoor.cpp
|
||||||
BlockHandler.cpp
|
BlockHandler.cpp
|
||||||
BlockPiston.cpp
|
BlockPiston.cpp
|
||||||
ChunkInterface.cpp
|
ChunkInterface.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
BlockAnvil.h
|
BlockAnvil.h
|
||||||
BlockBed.h
|
BlockBed.h
|
||||||
BlockBigFlower.h
|
BlockBigFlower.h
|
||||||
@ -105,8 +101,3 @@ SET (HDRS
|
|||||||
Mixins.h
|
Mixins.h
|
||||||
WorldInterface.h
|
WorldInterface.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Blocks ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Blocks fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,18 +1,8 @@
|
|||||||
project (Cuberite)
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
|
Resources/Cuberite.rc
|
||||||
|
|
||||||
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/")
|
|
||||||
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/jsoncpp/include")
|
|
||||||
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/mbedtls/include")
|
|
||||||
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/libevent/include")
|
|
||||||
|
|
||||||
set(FOLDERS
|
|
||||||
OSSupport HTTP Items Blocks Protocol Generating mbedTLS++ Bindings
|
|
||||||
WorldStorage Mobs Entities Simulator Simulator/IncrementalRedstoneSimulator
|
|
||||||
BlockEntities UI Noise
|
|
||||||
)
|
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
BiomeDef.cpp
|
BiomeDef.cpp
|
||||||
BlockArea.cpp
|
BlockArea.cpp
|
||||||
BlockInfo.cpp
|
BlockInfo.cpp
|
||||||
@ -80,9 +70,7 @@ SET (SRCS
|
|||||||
WebAdmin.cpp
|
WebAdmin.cpp
|
||||||
World.cpp
|
World.cpp
|
||||||
main.cpp
|
main.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
AllocationPool.h
|
AllocationPool.h
|
||||||
BiomeDef.h
|
BiomeDef.h
|
||||||
BlockArea.h
|
BlockArea.h
|
||||||
@ -169,156 +157,33 @@ SET (HDRS
|
|||||||
XMLParser.h
|
XMLParser.h
|
||||||
)
|
)
|
||||||
|
|
||||||
file(WRITE "${CMAKE_BINARY_DIR}/include/Globals.h"
|
set(FOLDERS
|
||||||
"/* This file allows Globals.h to be included with an absolute path */\n#include \"${PROJECT_SOURCE_DIR}/Globals.h\"\n")
|
OSSupport HTTP Items Blocks Protocol Generating mbedTLS++ Bindings
|
||||||
|
WorldStorage Mobs Entities Simulator Simulator/IncrementalRedstoneSimulator
|
||||||
|
BlockEntities UI Noise
|
||||||
|
)
|
||||||
|
|
||||||
include_directories("${CMAKE_BINARY_DIR}/include")
|
# Add all child source directories:
|
||||||
include_directories (SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/../lib/TCLAP/include")
|
foreach(folder ${FOLDERS})
|
||||||
|
add_subdirectory(${folder})
|
||||||
|
endforeach(folder)
|
||||||
|
|
||||||
|
file(WRITE "${CMAKE_BINARY_DIR}/include/Globals.h"
|
||||||
|
"/* This file allows Globals.h to be included with an absolute path */\n#include \"${PROJECT_SOURCE_DIR}/src/Globals.h\"\n")
|
||||||
|
|
||||||
configure_file("BuildInfo.h.cmake" "${CMAKE_BINARY_DIR}/include/BuildInfo.h")
|
configure_file("BuildInfo.h.cmake" "${CMAKE_BINARY_DIR}/include/BuildInfo.h")
|
||||||
|
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}/include/")
|
||||||
|
|
||||||
if (NOT MSVC)
|
# Generate AllFiles.lst for CheckBasicStyle.lua
|
||||||
# Bindings need to reference other folders, so they are done here instead
|
get_target_property(ALL_FILES ${CMAKE_PROJECT_NAME} SOURCES)
|
||||||
# lib dependencies are not included
|
foreach(FILE ${ALL_FILES})
|
||||||
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/../lib/mbedtls/include")
|
# target_sources converts to absolute but CheckBasicStyle expects relative
|
||||||
|
file(RELATIVE_PATH RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" ${FILE})
|
||||||
|
|
||||||
foreach(folder ${FOLDERS})
|
# Convert CMake list into newline-delimited string
|
||||||
add_subdirectory(${folder})
|
set(ALL_FILES_AS_LINES "${ALL_FILES_AS_LINES}${RELATIVE}\n")
|
||||||
endforeach(folder)
|
|
||||||
|
|
||||||
get_directory_property(BINDING_DEPENDENCIES DIRECTORY "Bindings" DEFINITION BINDING_DEPENDENCIES)
|
|
||||||
|
|
||||||
#clear file
|
|
||||||
file(WRITE ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/BindingDependencies.txt)
|
|
||||||
foreach(dependency ${BINDING_DEPENDENCIES})
|
|
||||||
#write each dependency on a seperate line
|
|
||||||
file(APPEND ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/BindingDependencies.txt "${dependency}\n")
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "Bindings.cpp Bindings.h")
|
|
||||||
|
|
||||||
list(APPEND SOURCE "${SRCS}")
|
|
||||||
list(APPEND SOURCE "${HDRS}")
|
|
||||||
|
|
||||||
# If building a windows version, but not using MSVC, add the resources directly to the makefile:
|
|
||||||
if (WIN32)
|
|
||||||
list(APPEND SOURCE "Resources/Cuberite.rc")
|
|
||||||
endif()
|
|
||||||
else ()
|
|
||||||
# MSVC-specific handling: Put all files into one project, separate by the folders:
|
|
||||||
|
|
||||||
source_group(Bindings FILES "Bindings/Bindings.cpp" "Bindings/Bindings.h")
|
|
||||||
|
|
||||||
# Add all subfolders as solution-folders:
|
|
||||||
function(includefolder PATH)
|
|
||||||
FILE(GLOB FOLDER_FILES
|
|
||||||
"${PATH}/*.cpp"
|
|
||||||
"${PATH}/*.h"
|
|
||||||
"${PATH}/*.rc"
|
|
||||||
"${PATH}/*.pkg"
|
|
||||||
)
|
|
||||||
string(REPLACE "/" "\\" PROJECT_PATH ${PATH})
|
|
||||||
source_group("${PROJECT_PATH}" FILES ${FOLDER_FILES})
|
|
||||||
endfunction(includefolder)
|
|
||||||
|
|
||||||
foreach(folder ${FOLDERS})
|
|
||||||
add_subdirectory(${folder})
|
|
||||||
includefolder(${folder})
|
|
||||||
|
|
||||||
# Get all source files in this folder:
|
|
||||||
get_directory_property(FOLDER_SRCS DIRECTORY ${folder} DEFINITION SRCS)
|
|
||||||
foreach (src ${FOLDER_SRCS})
|
|
||||||
list(APPEND SOURCE "${folder}/${src}")
|
|
||||||
endforeach(src)
|
|
||||||
|
|
||||||
# Get all headers in this folder:
|
|
||||||
get_directory_property(FOLDER_HDRS DIRECTORY ${folder} DEFINITION HDRS)
|
|
||||||
foreach (hdr ${FOLDER_HDRS})
|
|
||||||
list(APPEND SOURCE "${folder}/${hdr}")
|
|
||||||
endforeach(hdr)
|
|
||||||
|
|
||||||
# Include this folder's CMakeLists.txt in the project:
|
|
||||||
list(APPEND SOURCE "${folder}/CMakeLists.txt")
|
|
||||||
source_group("${folder}" FILES "${folder}/CMakeLists.txt")
|
|
||||||
endforeach(folder)
|
|
||||||
|
|
||||||
list(APPEND SOURCE "${SRCS}")
|
|
||||||
list(APPEND SOURCE "${HDRS}")
|
|
||||||
list(APPEND SOURCE "Bindings/AllToLua.pkg")
|
|
||||||
|
|
||||||
includefolder("Resources")
|
|
||||||
source_group("" FILES ${SOURCE})
|
|
||||||
|
|
||||||
# Precompiled headers (1st part)
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(
|
|
||||||
Globals.cpp PROPERTIES COMPILE_FLAGS "/Yc\"Globals.h\""
|
|
||||||
)
|
|
||||||
# CMake cannot "remove" the precompiled header flags, so we use a dummy precompiled header compatible with just this one file:
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(
|
|
||||||
Bindings/Bindings.cpp PROPERTIES COMPILE_FLAGS "/Yc\"string.h\" /Fp\"$(IntDir)/Bindings.pch\""
|
|
||||||
)
|
|
||||||
list(APPEND SOURCE "Resources/Cuberite.rc")
|
|
||||||
|
|
||||||
# Make MSVC generate the PDB files even for the release build:
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi")
|
|
||||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Zi")
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /DEBUG")
|
|
||||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /DEBUG")
|
|
||||||
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /DEBUG")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Generate a list of all source files:
|
|
||||||
set(ALLFILES "${SRCS}" "${HDRS}")
|
|
||||||
foreach(folder ${FOLDERS})
|
|
||||||
get_directory_property(FOLDER_SRCS DIRECTORY ${folder} DEFINITION SRCS)
|
|
||||||
foreach (src ${FOLDER_SRCS})
|
|
||||||
list(APPEND ALLFILES "${folder}/${src}")
|
|
||||||
endforeach(src)
|
|
||||||
|
|
||||||
get_directory_property(FOLDER_HDRS DIRECTORY ${folder} DEFINITION HDRS)
|
|
||||||
foreach (hdr ${FOLDER_HDRS})
|
|
||||||
list(APPEND ALLFILES "${folder}/${hdr}")
|
|
||||||
endforeach(hdr)
|
|
||||||
endforeach(folder)
|
|
||||||
foreach(arg ${ALLFILES})
|
|
||||||
set(ALLFILESLINES "${ALLFILESLINES}${arg}\n")
|
|
||||||
endforeach()
|
endforeach()
|
||||||
FILE(WRITE "AllFiles.lst" "${ALLFILESLINES}")
|
file(WRITE AllFiles.lst "${ALL_FILES_AS_LINES}")
|
||||||
|
|
||||||
if (MSVC)
|
|
||||||
get_directory_property(BINDING_OUTPUTS DIRECTORY "Bindings" DEFINITION BINDING_OUTPUTS)
|
|
||||||
get_directory_property(BINDING_DEPENDENCIES DIRECTORY "Bindings" DEFINITION BINDING_DEPENDENCIES)
|
|
||||||
|
|
||||||
# The paths in BINDING_DEPENDENCIES are relative to the Bindings folder, convert them relative to this folder:
|
|
||||||
foreach (dep ${BINDING_DEPENDENCIES})
|
|
||||||
list (APPEND BINDINGS_DEPENDENCIES "Bindings/${dep}")
|
|
||||||
endforeach(dep)
|
|
||||||
|
|
||||||
if (USE_SYSTEM_LUA)
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${BINDING_OUTPUTS}
|
|
||||||
COMMAND lua BindingsProcessor.lua
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/
|
|
||||||
DEPENDS ${BINDINGS_DEPENDENCIES}
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
ADD_CUSTOM_COMMAND(
|
|
||||||
OUTPUT ${BINDING_OUTPUTS}
|
|
||||||
|
|
||||||
# Regenerate bindings:
|
|
||||||
COMMAND luaexe BindingsProcessor.lua
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Bindings/
|
|
||||||
DEPENDS ${BINDINGS_DEPENDENCIES} luaexe
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE})
|
|
||||||
|
|
||||||
# Output the executable into the $/Server folder, so that it has access to external resources:
|
# Output the executable into the $/Server folder, so that it has access to external resources:
|
||||||
SET_TARGET_PROPERTIES(${CMAKE_PROJECT_NAME} PROPERTIES
|
SET_TARGET_PROPERTIES(${CMAKE_PROJECT_NAME} PROPERTIES
|
||||||
@ -402,45 +267,6 @@ make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/../CONTRIBUTORS"
|
|||||||
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE" "${CMAKE_BINARY_DIR}/Server/LICENSE")
|
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/../LICENSE" "${CMAKE_BINARY_DIR}/Server/LICENSE")
|
||||||
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/../Server/Install/ThirdPartyLicenses" "${CMAKE_BINARY_DIR}/Server/ThirdPartyLicenses")
|
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/../Server/Install/ThirdPartyLicenses" "${CMAKE_BINARY_DIR}/Server/ThirdPartyLicenses")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Precompiled headers (2nd part)
|
|
||||||
if (MSVC)
|
|
||||||
SET_TARGET_PROPERTIES(
|
|
||||||
${CMAKE_PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/Yu\"Globals.h\""
|
|
||||||
OBJECT_DEPENDS "$(IntDir)/$(TargetName.pch)"
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
if (NOT MSVC)
|
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME}
|
|
||||||
OSSupport HTTPServer Bindings Items Blocks Noise
|
|
||||||
Protocol Generating WorldStorage
|
|
||||||
Mobs Entities Simulator IncrementalRedstoneSimulator
|
|
||||||
BlockEntities UI mbedTLS++
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME} expat tolualib ws2_32.lib Psapi.lib)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
|
||||||
add_flags_lnk(-L/usr/local/lib)
|
|
||||||
add_flags_lnk(-L/usr/ports/devel)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(${CMAKE_PROJECT_NAME} luaexpat jsoncpp_lib mbedtls zlib lsqlite lua SQLiteCpp event_core event_extra fmt::fmt)
|
|
||||||
|
|
||||||
# Create a folder for Bindings' documentation:
|
# Create a folder for Bindings' documentation:
|
||||||
FILE(MAKE_DIRECTORY "Bindings/docs")
|
FILE(MAKE_DIRECTORY "Bindings/docs")
|
||||||
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/Bindings/docs" "${CMAKE_BINARY_DIR}/Server/BindingsDocs")
|
make_symlink("${CMAKE_CURRENT_SOURCE_DIR}/Bindings/docs" "${CMAKE_BINARY_DIR}/Server/BindingsDocs")
|
||||||
|
|
||||||
|
|
||||||
# For MSVC, set the startup project to Cuberite, and the debugger dir:
|
|
||||||
if (MSVC)
|
|
||||||
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${CMAKE_PROJECT_NAME})
|
|
||||||
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/Server")
|
|
||||||
endif()
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
ArrowEntity.cpp
|
ArrowEntity.cpp
|
||||||
Boat.cpp
|
Boat.cpp
|
||||||
EnderCrystal.cpp
|
EnderCrystal.cpp
|
||||||
@ -26,9 +27,8 @@ SET (SRCS
|
|||||||
ThrownEggEntity.cpp
|
ThrownEggEntity.cpp
|
||||||
ThrownEnderPearlEntity.cpp
|
ThrownEnderPearlEntity.cpp
|
||||||
ThrownSnowballEntity.cpp
|
ThrownSnowballEntity.cpp
|
||||||
WitherSkullEntity.cpp)
|
WitherSkullEntity.cpp
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
ArrowEntity.h
|
ArrowEntity.h
|
||||||
Boat.h
|
Boat.h
|
||||||
EnderCrystal.h
|
EnderCrystal.h
|
||||||
@ -55,9 +55,5 @@ SET (HDRS
|
|||||||
ThrownEggEntity.h
|
ThrownEggEntity.h
|
||||||
ThrownEnderPearlEntity.h
|
ThrownEnderPearlEntity.h
|
||||||
ThrownSnowballEntity.h
|
ThrownSnowballEntity.h
|
||||||
WitherSkullEntity.h)
|
WitherSkullEntity.h
|
||||||
|
)
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Entities ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Entities fmt::fmt WorldStorage SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
BioGen.cpp
|
BioGen.cpp
|
||||||
Caves.cpp
|
Caves.cpp
|
||||||
ChunkDesc.cpp
|
ChunkDesc.cpp
|
||||||
@ -29,9 +30,7 @@ SET (SRCS
|
|||||||
VerticalLimit.cpp
|
VerticalLimit.cpp
|
||||||
VerticalStrategy.cpp
|
VerticalStrategy.cpp
|
||||||
VillageGen.cpp
|
VillageGen.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
BioGen.h
|
BioGen.h
|
||||||
Caves.h
|
Caves.h
|
||||||
ChunkDesc.h
|
ChunkDesc.h
|
||||||
@ -66,8 +65,3 @@ SET (HDRS
|
|||||||
VerticalStrategy.h
|
VerticalStrategy.h
|
||||||
VillageGen.h
|
VillageGen.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Generating ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Generating fmt::fmt OSSupport Blocks Bindings)
|
|
||||||
endif()
|
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
#include "ComposableGenerator.h"
|
#include "ComposableGenerator.h"
|
||||||
#include "../Noise/Noise.h"
|
#include "../Noise/Noise.h"
|
||||||
#include "../ProbabDistrib.h"
|
#include "../ProbabDistrib.h"
|
||||||
|
@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Compiler-dependent stuff:
|
// Compiler-dependent stuff:
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
// Disable some warnings that we don't care about:
|
// Disable some warnings that we don't care about:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
EnvelopeParser.cpp
|
EnvelopeParser.cpp
|
||||||
HTTPFormParser.cpp
|
HTTPFormParser.cpp
|
||||||
HTTPMessage.cpp
|
HTTPMessage.cpp
|
||||||
@ -12,9 +13,7 @@ SET (SRCS
|
|||||||
TransferEncodingParser.cpp
|
TransferEncodingParser.cpp
|
||||||
UrlClient.cpp
|
UrlClient.cpp
|
||||||
UrlParser.cpp
|
UrlParser.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
EnvelopeParser.h
|
EnvelopeParser.h
|
||||||
HTTPFormParser.h
|
HTTPFormParser.h
|
||||||
HTTPMessage.h
|
HTTPMessage.h
|
||||||
@ -28,8 +27,3 @@ SET (HDRS
|
|||||||
UrlClient.h
|
UrlClient.h
|
||||||
UrlParser.h
|
UrlParser.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(HTTPServer ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(HTTPServer fmt::fmt)
|
|
||||||
endif()
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
ItemHandler.cpp
|
ItemHandler.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
ItemArmor.h
|
ItemArmor.h
|
||||||
ItemAxe.h
|
ItemAxe.h
|
||||||
ItemBed.h
|
ItemBed.h
|
||||||
@ -62,8 +61,3 @@ SET (HDRS
|
|||||||
ItemSword.h
|
ItemSword.h
|
||||||
ItemThrowable.h
|
ItemThrowable.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Items ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Items fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -26,6 +26,13 @@ Regular upscaling takes two arrays and "moves" the input from src to dst; src is
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Linearly interpolates values in the array between the equidistant anchor points (upscales).
|
Linearly interpolates values in the array between the equidistant anchor points (upscales).
|
||||||
Works in-place (input is already present at the correct output coords)
|
Works in-place (input is already present at the correct output coords)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
AggressiveMonster.cpp
|
AggressiveMonster.cpp
|
||||||
Bat.cpp
|
Bat.cpp
|
||||||
Blaze.cpp
|
Blaze.cpp
|
||||||
@ -37,9 +38,8 @@ SET (SRCS
|
|||||||
Wolf.cpp
|
Wolf.cpp
|
||||||
Zombie.cpp
|
Zombie.cpp
|
||||||
ZombiePigman.cpp
|
ZombiePigman.cpp
|
||||||
ZombieVillager.cpp)
|
ZombieVillager.cpp
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
AggressiveMonster.h
|
AggressiveMonster.h
|
||||||
Bat.h
|
Bat.h
|
||||||
Blaze.h
|
Blaze.h
|
||||||
@ -80,9 +80,5 @@ SET (HDRS
|
|||||||
Wolf.h
|
Wolf.h
|
||||||
Zombie.h
|
Zombie.h
|
||||||
ZombiePigman.h
|
ZombiePigman.h
|
||||||
ZombieVillager.h)
|
ZombieVillager.h
|
||||||
|
)
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Mobs ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Mobs fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,16 +1,10 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
Noise.cpp
|
Noise.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
InterpolNoise.h
|
InterpolNoise.h
|
||||||
Noise.h
|
Noise.h
|
||||||
OctavedNoise.h
|
OctavedNoise.h
|
||||||
RidgedNoise.h
|
RidgedNoise.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Noise ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Noise fmt::fmt OSSupport)
|
|
||||||
endif()
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
CriticalSection.cpp
|
CriticalSection.cpp
|
||||||
Errors.cpp
|
Errors.cpp
|
||||||
Event.cpp
|
Event.cpp
|
||||||
@ -16,9 +17,7 @@ SET (SRCS
|
|||||||
TCPLinkImpl.cpp
|
TCPLinkImpl.cpp
|
||||||
UDPEndpointImpl.cpp
|
UDPEndpointImpl.cpp
|
||||||
WinStackWalker.cpp
|
WinStackWalker.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
AtomicUniquePtr.h
|
AtomicUniquePtr.h
|
||||||
CriticalSection.h
|
CriticalSection.h
|
||||||
Errors.h
|
Errors.h
|
||||||
@ -40,11 +39,3 @@ SET (HDRS
|
|||||||
WinStackWalker.h
|
WinStackWalker.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(OSSupport ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(OSSupport fmt::fmt)
|
|
||||||
|
|
||||||
if(NOT WIN32)
|
|
||||||
target_link_libraries(OSSupport event_pthreads_static)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
include_directories (SYSTEM "../../lib/jsoncpp/include")
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
Authenticator.cpp
|
Authenticator.cpp
|
||||||
ChunkDataSerializer.cpp
|
ChunkDataSerializer.cpp
|
||||||
ForgeHandshake.cpp
|
ForgeHandshake.cpp
|
||||||
@ -14,9 +14,7 @@ SET (SRCS
|
|||||||
Protocol_1_13.cpp
|
Protocol_1_13.cpp
|
||||||
ProtocolPalettes.cpp
|
ProtocolPalettes.cpp
|
||||||
ProtocolRecognizer.cpp
|
ProtocolRecognizer.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
Authenticator.h
|
Authenticator.h
|
||||||
ChunkDataSerializer.h
|
ChunkDataSerializer.h
|
||||||
ForgeHandshake.h
|
ForgeHandshake.h
|
||||||
@ -32,8 +30,3 @@ SET (HDRS
|
|||||||
ProtocolPalettes.h
|
ProtocolPalettes.h
|
||||||
ProtocolRecognizer.h
|
ProtocolRecognizer.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT MSVC)
|
|
||||||
add_library(Protocol ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Protocol fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
DelayedFluidSimulator.cpp
|
DelayedFluidSimulator.cpp
|
||||||
FireSimulator.cpp
|
FireSimulator.cpp
|
||||||
FloodyFluidSimulator.cpp
|
FloodyFluidSimulator.cpp
|
||||||
@ -9,9 +10,7 @@ SET (SRCS
|
|||||||
SimulatorManager.cpp
|
SimulatorManager.cpp
|
||||||
VanillaFluidSimulator.cpp
|
VanillaFluidSimulator.cpp
|
||||||
VaporizeFluidSimulator.cpp
|
VaporizeFluidSimulator.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
DelayedFluidSimulator.h
|
DelayedFluidSimulator.h
|
||||||
FireSimulator.h
|
FireSimulator.h
|
||||||
FloodyFluidSimulator.h
|
FloodyFluidSimulator.h
|
||||||
@ -25,8 +24,3 @@ SET (HDRS
|
|||||||
VanillaFluidSimulator.h
|
VanillaFluidSimulator.h
|
||||||
VaporizeFluidSimulator.h
|
VaporizeFluidSimulator.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(Simulator ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(Simulator fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
set (SRCS
|
|
||||||
IncrementalRedstoneSimulator.cpp
|
IncrementalRedstoneSimulator.cpp
|
||||||
)
|
|
||||||
|
|
||||||
set (HDRS
|
|
||||||
CommandBlockHandler.h
|
CommandBlockHandler.h
|
||||||
DoorHandler.h
|
DoorHandler.h
|
||||||
DropSpenserHandler.h
|
DropSpenserHandler.h
|
||||||
@ -29,9 +28,3 @@ set (HDRS
|
|||||||
PoweredRailHandler.h
|
PoweredRailHandler.h
|
||||||
PressurePlateHandler.h
|
PressurePlateHandler.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(IncrementalRedstoneSimulator ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(IncrementalRedstoneSimulator fmt::fmt)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
SlotArea.cpp
|
SlotArea.cpp
|
||||||
Window.cpp
|
Window.cpp
|
||||||
AnvilWindow.cpp
|
AnvilWindow.cpp
|
||||||
@ -13,9 +14,8 @@ SET (SRCS
|
|||||||
FurnaceWindow.cpp
|
FurnaceWindow.cpp
|
||||||
HopperWindow.cpp
|
HopperWindow.cpp
|
||||||
HorseWindow.cpp
|
HorseWindow.cpp
|
||||||
InventoryWindow.cpp)
|
InventoryWindow.cpp
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
SlotArea.h
|
SlotArea.h
|
||||||
Window.h
|
Window.h
|
||||||
AnvilWindow.h
|
AnvilWindow.h
|
||||||
@ -31,9 +31,5 @@ SET (HDRS
|
|||||||
HorseWindow.h
|
HorseWindow.h
|
||||||
InventoryWindow.h
|
InventoryWindow.h
|
||||||
MinecartWithChestWindow.h
|
MinecartWithChestWindow.h
|
||||||
WindowOwner.h)
|
WindowOwner.h
|
||||||
|
)
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(UI ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(UI fmt::fmt SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
SET (SRCS
|
|
||||||
EnchantmentSerializer.cpp
|
EnchantmentSerializer.cpp
|
||||||
FastNBT.cpp
|
FastNBT.cpp
|
||||||
FireworksSerializer.cpp
|
FireworksSerializer.cpp
|
||||||
@ -10,9 +11,7 @@ SET (SRCS
|
|||||||
StatSerializer.cpp
|
StatSerializer.cpp
|
||||||
WSSAnvil.cpp
|
WSSAnvil.cpp
|
||||||
WorldStorage.cpp
|
WorldStorage.cpp
|
||||||
)
|
|
||||||
|
|
||||||
SET (HDRS
|
|
||||||
EnchantmentSerializer.h
|
EnchantmentSerializer.h
|
||||||
FastNBT.h
|
FastNBT.h
|
||||||
FireworksSerializer.h
|
FireworksSerializer.h
|
||||||
@ -24,8 +23,3 @@ SET (HDRS
|
|||||||
WSSAnvil.h
|
WSSAnvil.h
|
||||||
WorldStorage.h
|
WorldStorage.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(WorldStorage ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(WorldStorage fmt::fmt OSSupport SQLiteCpp)
|
|
||||||
endif()
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
target_sources(
|
||||||
|
${CMAKE_PROJECT_NAME} PRIVATE
|
||||||
|
|
||||||
set(SRCS
|
|
||||||
AesCfb128Decryptor.cpp
|
AesCfb128Decryptor.cpp
|
||||||
AesCfb128Encryptor.cpp
|
AesCfb128Encryptor.cpp
|
||||||
BlockingSslClientSocket.cpp
|
BlockingSslClientSocket.cpp
|
||||||
@ -13,9 +14,7 @@ set(SRCS
|
|||||||
SslConfig.cpp
|
SslConfig.cpp
|
||||||
SslContext.cpp
|
SslContext.cpp
|
||||||
X509Cert.cpp
|
X509Cert.cpp
|
||||||
)
|
|
||||||
|
|
||||||
set(HDRS
|
|
||||||
AesCfb128Decryptor.h
|
AesCfb128Decryptor.h
|
||||||
AesCfb128Encryptor.h
|
AesCfb128Encryptor.h
|
||||||
BlockingSslClientSocket.h
|
BlockingSslClientSocket.h
|
||||||
@ -31,8 +30,3 @@ set(HDRS
|
|||||||
Sha1Checksum.h
|
Sha1Checksum.h
|
||||||
X509Cert.h
|
X509Cert.h
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT MSVC)
|
|
||||||
add_library(mbedTLS++ ${SRCS} ${HDRS})
|
|
||||||
target_link_libraries(mbedTLS++ fmt::fmt mbedtls)
|
|
||||||
endif()
|
|
||||||
|
@ -1,14 +1,6 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
find_package(Threads REQUIRED)
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Define individual test executables:
|
# Define individual test executables:
|
||||||
|
|
||||||
# BlockStateTest: Verify that the BlockState class works as intended:
|
# BlockStateTest: Verify that the BlockState class works as intended:
|
||||||
@ -41,7 +33,7 @@ add_executable(BlockTypeRegistryTest
|
|||||||
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(BlockTypeRegistryTest fmt::fmt)
|
target_link_libraries(BlockTypeRegistryTest fmt::fmt Threads::Threads)
|
||||||
|
|
||||||
# PalettedBlockAreaTest: Verify that the PalettedBlockArea class works as intended:
|
# PalettedBlockAreaTest: Verify that the PalettedBlockArea class works as intended:
|
||||||
add_executable(PalettedBlockAreaTest
|
add_executable(PalettedBlockAreaTest
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/BoundingBox.cpp
|
${CMAKE_SOURCE_DIR}/src/BoundingBox.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.cpp
|
${CMAKE_SOURCE_DIR}/src/OSSupport/StackTrace.cpp
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/ByteBuffer.cpp
|
${CMAKE_SOURCE_DIR}/src/ByteBuffer.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
enable_testing()
|
|
||||||
|
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE")
|
if (CMAKE_BUILD_TYPE STREQUAL "COVERAGE")
|
||||||
setup_target_for_coverage("${PROJECT_NAME}_coverage" "ctest" coverage)
|
setup_target_for_coverage("${PROJECT_NAME}_coverage" "ctest" coverage)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
add_compile_definitions(TEST_GLOBALS)
|
||||||
|
|
||||||
add_subdirectory(BlockTypeRegistry)
|
add_subdirectory(BlockTypeRegistry)
|
||||||
add_subdirectory(BoundingBox)
|
add_subdirectory(BoundingBox)
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
add_library(ChunkBuffer ${CMAKE_SOURCE_DIR}/src/ChunkData.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp)
|
add_library(ChunkBuffer ${CMAKE_SOURCE_DIR}/src/ChunkData.cpp ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp)
|
||||||
|
|
||||||
target_link_libraries(ChunkBuffer PUBLIC fmt::fmt)
|
target_link_libraries(ChunkBuffer PUBLIC fmt::fmt)
|
||||||
@ -43,5 +38,5 @@ set_target_properties(
|
|||||||
)
|
)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
ChunkBuffer
|
ChunkBuffer
|
||||||
PROPERTIES FOLDER Lib
|
PROPERTIES FOLDER Tests/Libraries
|
||||||
)
|
)
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/lib/jsoncpp/include)
|
include_directories(${CMAKE_SOURCE_DIR}/lib/jsoncpp/include)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/CompositeChat.cpp
|
${CMAKE_SOURCE_DIR}/src/CompositeChat.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/JsonUtils.cpp
|
${CMAKE_SOURCE_DIR}/src/JsonUtils.cpp
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/FastRandom.cpp
|
${CMAKE_SOURCE_DIR}/src/FastRandom.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
||||||
@ -148,8 +143,8 @@ set (STUBS
|
|||||||
|
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
add_flags_cxx("-Wno-error=global-constructors")
|
add_compile_options("-Wno-error=global-constructors")
|
||||||
add_flags_cxx("-Wno-error=switch-enum")
|
add_compile_options("-Wno-error=switch-enum")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/libevent/include)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/libevent/include)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
# Create a single HTTP library that contains all the HTTP code:
|
# Create a single HTTP library that contains all the HTTP code:
|
||||||
set (HTTP_SRCS
|
set (HTTP_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/HTTP/EnvelopeParser.cpp
|
${CMAKE_SOURCE_DIR}/src/HTTP/EnvelopeParser.cpp
|
||||||
@ -104,5 +99,5 @@ set_target_properties(
|
|||||||
)
|
)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
HTTP
|
HTTP
|
||||||
PROPERTIES FOLDER Lib
|
PROPERTIES FOLDER Tests/Libraries
|
||||||
)
|
)
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
||||||
@ -75,8 +71,8 @@ set (SRCS
|
|||||||
|
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
add_flags_cxx("-Wno-error=global-constructors")
|
add_compile_options("-Wno-error=global-constructors")
|
||||||
add_flags_cxx("-Wno-error=switch-enum")
|
add_compile_options("-Wno-error=switch-enum")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
find_package(Threads REQUIRED)
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
||||||
@ -82,7 +78,7 @@ source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS})
|
|||||||
source_group("Sources" FILES ${SRCS})
|
source_group("Sources" FILES ${SRCS})
|
||||||
source_group("Lua files" FILES Test.lua)
|
source_group("Lua files" FILES Test.lua)
|
||||||
add_executable(LuaThreadStress ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} Test.lua)
|
add_executable(LuaThreadStress ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} Test.lua)
|
||||||
target_link_libraries(LuaThreadStress tolualib zlib fmt::fmt)
|
target_link_libraries(LuaThreadStress tolualib zlib fmt::fmt Threads::Threads)
|
||||||
add_test(NAME LuaThreadStress-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LuaThreadStress)
|
add_test(NAME LuaThreadStress-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LuaThreadStress)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/libevent/include)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/libevent/include)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/mbedtls/include)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
# Create a single Network library that contains all the networking code:
|
# Create a single Network library that contains all the networking code:
|
||||||
set (Network_SRCS
|
set (Network_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
||||||
@ -103,7 +98,7 @@ set_target_properties(
|
|||||||
)
|
)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
Network
|
Network
|
||||||
PROPERTIES FOLDER Lib
|
PROPERTIES FOLDER Tests/Libraries
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,36 +1,29 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
find_package(Threads REQUIRED)
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
# Create a single OSSupport library that contains all the OSSupport code used in the tests:
|
# Create a single OSSupport library that contains all the OSSupport code used in the tests:
|
||||||
# Only needed for Windows; Linux already defines the OSSupport lib
|
set (OSSupport_SRCS
|
||||||
if (WIN32)
|
|
||||||
set (OSSupport_SRCS
|
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/Event.cpp
|
${CMAKE_SOURCE_DIR}/src/OSSupport/Event.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
||||||
)
|
)
|
||||||
set (OSSupport_HDRS
|
set (OSSupport_HDRS
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.h
|
${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.h
|
||||||
${CMAKE_SOURCE_DIR}/src/OSSupport/Event.h
|
${CMAKE_SOURCE_DIR}/src/OSSupport/Event.h
|
||||||
${CMAKE_SOURCE_DIR}/src/StringUtils.h
|
${CMAKE_SOURCE_DIR}/src/StringUtils.h
|
||||||
${CMAKE_SOURCE_DIR}/src/Globals.h
|
${CMAKE_SOURCE_DIR}/src/Globals.h
|
||||||
)
|
)
|
||||||
add_library(OSSupport
|
add_library(OSSupport
|
||||||
${OSSupport_SRCS}
|
${OSSupport_SRCS}
|
||||||
${OSSupport_HDRS}
|
${OSSupport_HDRS}
|
||||||
)
|
)
|
||||||
target_link_libraries(OSSupport PUBLIC fmt::fmt)
|
target_link_libraries(OSSupport PUBLIC fmt::fmt)
|
||||||
endif()
|
|
||||||
|
|
||||||
# Define individual tests:
|
# Define individual tests:
|
||||||
|
|
||||||
# StressEvent: Stress-test the cEvent implementation:
|
# StressEvent: Stress-test the cEvent implementation:
|
||||||
add_executable(StressEvent-exe StressEvent.cpp)
|
add_executable(StressEvent-exe StressEvent.cpp)
|
||||||
target_link_libraries(StressEvent-exe OSSupport fmt::fmt)
|
target_link_libraries(StressEvent-exe OSSupport fmt::fmt Threads::Threads)
|
||||||
add_test(NAME StressEvent-test COMMAND StressEvent-exe)
|
add_test(NAME StressEvent-test COMMAND StressEvent-exe)
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +35,7 @@ set_target_properties(
|
|||||||
)
|
)
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
OSSupport
|
OSSupport
|
||||||
PROPERTIES FOLDER Lib
|
PROPERTIES FOLDER Tests/Libraries
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
include_directories(${CMAKE_SOURCE_DIR}/src/)
|
||||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/lib/)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
add_definitions(-DTEST_GLOBALS=1)
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
${CMAKE_SOURCE_DIR}/src/BiomeDef.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
${CMAKE_SOURCE_DIR}/src/BlockArea.cpp
|
||||||
@ -66,7 +61,7 @@ set (SRCS
|
|||||||
|
|
||||||
|
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
add_flags_cxx("-Wno-error=global-constructors")
|
add_compile_options("-Wno-error=global-constructors")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
cmake_minimum_required(VERSION 3.0.2)
|
|
||||||
enable_testing()
|
|
||||||
|
|
||||||
set (SHARED_SRCS
|
set (SHARED_SRCS
|
||||||
${CMAKE_SOURCE_DIR}/src/UUID.cpp
|
${CMAKE_SOURCE_DIR}/src/UUID.cpp
|
||||||
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
|
||||||
|
@ -8,17 +8,28 @@ export CUBERITE_BUILD_DATETIME=`date`
|
|||||||
|
|
||||||
# Use ccache if available
|
# Use ccache if available
|
||||||
if [ `which ccache` ]; then
|
if [ `which ccache` ]; then
|
||||||
|
# Re-run compile on pre-processed sources on cache miss
|
||||||
|
# "It's slower actually, but clang builds fail without it."
|
||||||
export CCACHE_CPP2=true
|
export CCACHE_CPP2=true
|
||||||
|
|
||||||
|
# Tell CMake of ccache's existence
|
||||||
CACHE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
CACHE_ARGS="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||||
|
|
||||||
echo "Using ccache installed at $(which ccache)"
|
echo "Using ccache installed at $(which ccache)"
|
||||||
ccache --max-size=3G
|
ccache --max-size=3G
|
||||||
ccache -z # Zero statistics
|
ccache -z # Zero statistics
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cmake . -DBUILD_TOOLS=1 -DSELF_TEST=1 ${CACHE_ARGS};
|
# Work around a Clang + ccache issue with failing
|
||||||
|
# builds by disabling precompiled headers
|
||||||
|
cmake . -DBUILD_TOOLS=YES \
|
||||||
|
-DPRECOMPILE_HEADERS=NO \
|
||||||
|
-DUNITY_BUILDS=${TRAVIS_CUBERITE_UNITY_BUILDS-YES} \
|
||||||
|
-DSELF_TEST=YES \
|
||||||
|
${CACHE_ARGS};
|
||||||
|
|
||||||
echo "Building..."
|
echo "Building..."
|
||||||
cmake --build . -j 2
|
cmake --build . --parallel 2;
|
||||||
|
|
||||||
if [ `which ccache` ]; then
|
if [ `which ccache` ]; then
|
||||||
echo "Built with ccache, outputting cache stats..."
|
echo "Built with ccache, outputting cache stats..."
|
||||||
@ -26,8 +37,7 @@ if [ `which ccache` ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Testing..."
|
echo "Testing..."
|
||||||
|
ctest --output-on-failure --parallel 2;
|
||||||
ctest -j 2 -V;
|
|
||||||
|
|
||||||
cd Server/;
|
cd Server/;
|
||||||
touch apiCheckFailed.flag
|
touch apiCheckFailed.flag
|
||||||
|
Loading…
Reference in New Issue
Block a user