forked from opentibiabr/otservbr-global-archived
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update build and add several tools and improvements (opentibiabr#611)
- Updated appveyor with the new log library and also added a zip files with all artifacts. - Updated travis to build release and debug versons, and also changed the ubuntu version to bionic to use new gcc, also added the new log library. - Improved cmake file to enable more warnings, to have a release and debug version, and to generate the documentation when enabled. - Updated docker files to install the new log library. - Added new account and players to docker test server. Changed god account password to 'god' - Update all files headers to insert the Copyright. - Update all .h header files to use the Google Style. - Fixed all 'shadow' warning about variables with the same name. Signed-off-by: Renato Foot <[email protected]>
- Loading branch information
1 parent
3301344
commit 4896943
Showing
184 changed files
with
3,805 additions
and
782 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,118 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
# https://gitlab.kitware.com/cmake/cmake/issues/18403 | ||
set(CMAKE_DISABLE_SOURCE_CHANGES ON) | ||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) | ||
|
||
project(tfs) | ||
|
||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
include(cotire) | ||
|
||
add_compile_options(-Wall -Werror -pipe -fvisibility=hidden) | ||
|
||
set(CMAKE_CXX_FLAGS_PERFORMANCE "${CMAKE_CXX_FLAGS_RELEASE} -march=native") | ||
|
||
# GCC is fairly aggressive about it: enabling strict aliasing will cause it to think that pointers that are "obviously" equivalent to a human (as in, foo *a; bar *b = (bar *) a;) cannot alias, which allows for some very aggressive transformations, but can obviously break non-carefully written code. | ||
if (CMAKE_COMPILER_IS_GNUCXX) | ||
add_compile_options(-fno-strict-aliasing) | ||
endif() | ||
|
||
include(FindCXX11) | ||
include(FindLTO) | ||
# default build type | ||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE "Release") | ||
endif() | ||
|
||
# compile flags | ||
# https://kristerw.blogspot.com/2017/09/useful-gcc-warning-options-not-enabled.html | ||
set(WARNING_FLAGS "-Wall -Werror") | ||
|
||
set(CMAKE_CXX_FLAGS "${WARNING_FLAGS} ${CMAKE_CXX_FLAGS}") | ||
|
||
# cmake .. | ||
set(CMAKE_CXX_FLAGS_RELEASE "${WARNING_FLAGS} -pipe -fvisibility=hidden -march=native -O2") | ||
|
||
# cmake -DCMAKE_BUILD_TYPE=Debug .. | ||
set(CMAKE_CXX_FLAGS_DEBUG "${WARNING_FLAGS} -pipe -O0 -g -Wextra -Wconversion -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wrestrict -Wnull-dereference -Wold-style-cast -Wuseless-cast -Wdouble-promotion -Wshadow -Wformat=2 -Wno-error") | ||
|
||
# Find packages. | ||
find_package(Cotire REQUIRED) | ||
find_package(LTO REQUIRED) | ||
find_package(CXX11 REQUIRED) | ||
find_package(Crypto++ REQUIRED) | ||
find_package(PugiXML REQUIRED) | ||
find_package(MySQL) | ||
find_package(Threads) | ||
find_package(MySQL REQUIRED) | ||
find_package(Threads REQUIRED) | ||
find_package(Spdlog REQUIRED) | ||
find_package(Boost 1.53.0 COMPONENTS system filesystem iostreams REQUIRED) | ||
|
||
# Selects LuaJIT if user defines or auto-detected | ||
if(DEFINED USE_LUAJIT AND NOT USE_LUAJIT) | ||
set(FORCE_LUAJIT ${USE_LUAJIT}) | ||
set(FORCE_LUAJIT ${USE_LUAJIT}) | ||
else() | ||
find_package(LuaJIT) | ||
set(FORCE_LUAJIT ${LuaJIT_FOUND}) | ||
find_package(LuaJIT) | ||
set(FORCE_LUAJIT ${LuaJIT_FOUND}) | ||
endif() | ||
option(USE_LUAJIT "Use LuaJIT" ${FORCE_LUAJIT}) | ||
|
||
if(FORCE_LUAJIT) | ||
if(APPLE) | ||
set(CMAKE_EXE_LINKER_FLAGS "-pagezero_size 10000 -image_base 100000000") | ||
endif() | ||
if(APPLE) | ||
set(CMAKE_EXE_LINKER_FLAGS "-pagezero_size 10000 -image_base 100000000") | ||
endif() | ||
else() | ||
find_package(Lua REQUIRED) | ||
find_package(Lua REQUIRED) | ||
endif() | ||
|
||
find_package(Boost 1.53.0 COMPONENTS system filesystem iostreams REQUIRED) | ||
|
||
add_subdirectory(src) | ||
add_executable(tfs ${tfs_SRC}) | ||
|
||
include_directories(${MYSQL_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PUGIXML_INCLUDE_DIR} ${Crypto++_INCLUDE_DIR}) | ||
target_link_libraries(tfs ${MYSQL_CLIENT_LIBS} ${LUA_LIBRARIES} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${PUGIXML_LIBRARIES} ${Crypto++_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) | ||
# cmake -DBUILD_DOC=ON .. | ||
option(BUILD_DOC "Build documentation" OFF) | ||
if(BUILD_DOC) | ||
|
||
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc) | ||
|
||
find_package(Doxygen) | ||
if (DOXYGEN_FOUND) | ||
# set input and output files | ||
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in) | ||
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) | ||
|
||
# request to configure the file | ||
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) | ||
|
||
add_custom_target( doc_doxygen ALL | ||
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
COMMENT "Generating API documentation with Doxygen" | ||
VERBATIM ) | ||
|
||
else (DOXYGEN_FOUND) | ||
message("Doxygen need to be installed to generate the doxygen documentation") | ||
endif (DOXYGEN_FOUND) | ||
|
||
find_program(LDOC_EXECUTABLE ldoc FALSE) | ||
if(NOT LDOC_EXECUTABLE) | ||
find_program(LDOC_EXECUTABLE ldoc.lua FALSE) | ||
endif() | ||
if (LDOC_EXECUTABLE) | ||
# set input and output files | ||
set(LDOC_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/config.ld.in) | ||
set(LDOC_OUT ${CMAKE_CURRENT_BINARY_DIR}/config.ld) | ||
|
||
# request to configure the file | ||
configure_file(${LDOC_IN} ${LDOC_OUT} @ONLY) | ||
# execute_process(COMMAND sh -c "${LDOC_EXECUTABLE} .") | ||
add_custom_target( doc_ldoc ALL | ||
COMMAND ${LDOC_EXECUTABLE} . | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} | ||
COMMENT "Generating API documentation with Ldoc") | ||
else (LDOC_EXECUTABLE) | ||
message("Ldoc need to be installed to generate the ldoc documentation") | ||
endif (LDOC_EXECUTABLE) | ||
|
||
endif (BUILD_DOC) | ||
|
||
include_directories(SYSTEM ${MYSQL_INCLUDE_DIR} ${LUA_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${PUGIXML_INCLUDE_DIR} ${Crypto++_INCLUDE_DIR} ${spdlog_INCLUDE_DIR}) | ||
|
||
target_link_libraries(tfs ${MYSQL_CLIENT_LIBS} ${LUA_LIBRARIES} ${Boost_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${PUGIXML_LIBRARIES} ${Crypto++_LIBRARIES} ${Spdlog_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) | ||
|
||
set_target_properties(tfs PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "src/otpch.h") | ||
set_target_properties(tfs PROPERTIES COTIRE_ADD_UNITY_BUILD FALSE) | ||
|
||
cotire(tfs) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Locate Spdlog library | ||
# This module defines | ||
# Spdlog_FOUND | ||
# Spdlog_INCLUDE_DIR | ||
# Spdlog_LIBRARIES | ||
|
||
find_path(Spdlog_INCLUDE_DIR NAMES cryptopp/cryptlib.h) | ||
find_library(Spdlog_LIBRARIES NAMES cryptopp libcryptopp) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Spdlog DEFAULT_MSG Spdlog_INCLUDE_DIR Spdlog_LIBRARIES) | ||
|
||
mark_as_advanced(Spdlog_INCLUDE_DIR Spdlog_LIBRARIES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,20 @@ | ||
UPDATE accounts SET password = '356a192b7913b04c54574d18c28d46e6395428ab' WHERE id = 1; | ||
UPDATE players SET account_id = 1 WHERE id = 6; | ||
-- | ||
-- Account teste/teste | ||
-- | ||
|
||
INSERT INTO `accounts` | ||
(`id`, `name`, `password`, `type`) VALUES | ||
(2, 'test', 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3', 1); | ||
|
||
INSERT INTO `players` | ||
(`id`, `name`, `group_id`, `account_id`, `level`, `vocation`, `health`, `healthmax`, `experience`, `lookbody`, `lookfeet`, `lookhead`, `looklegs`, `looktype`, `mana`, `manamax`, `town_id`, `conditions`, `cap`, `sex`) VALUES | ||
(2, 'Rook Sample', 1, 2, 1, 0, 150, 150, 0, 106, 95, 78, 116, 128, 5, 5, 6, '', 400, 0), | ||
(3, 'Sorcerer Sample', 1, 2, 8, 1, 185, 185, 4200, 106, 95, 78, 116, 128, 40, 40, 2, '', 470, 1), | ||
(4, 'Druid Sample', 1, 2, 8, 2, 185, 185, 4200, 106, 95, 78, 116, 128, 40, 40, 2, '', 470, 1), | ||
(5, 'Paladin Sample', 1, 2, 8, 3, 185, 185, 4200, 106, 95, 78, 116, 128, 40, 40, 2, '', 470, 1), | ||
(6, 'Knight Sample', 1, 2, 8, 4, 185, 185, 4200, 106, 95, 78, 116, 128, 40, 40, 2, '', 470, 1), | ||
(7, 'Rook', 1, 2, 1, 0, 150, 150, 0, 106, 95, 78, 116, 128, 5, 5, 6, '', 400, 0), | ||
(8, 'Sorcerer', 1, 2, 500, 1, 2645, 2645, 2058474, 106, 95, 78, 116, 128, 14800, 14800, 2, '', 5390, 1), | ||
(9, 'Druid', 1, 2, 500, 2, 2645, 2645, 2058474, 106, 95, 78, 116, 128, 14800, 14800, 2, '', 5390, 1), | ||
(10, 'Paladin', 1, 2, 500, 3, 5105, 5105, 2058474, 106, 95, 78, 116, 128, 7420, 7420, 2, '', 10310, 1), | ||
(11, 'Knight', 1, 2, 500, 4, 7565, 7565, 2058474, 106, 95, 78, 116, 128, 2500, 2500, 2, '', 12770, 1); |
Oops, something went wrong.