Merge pull request #367 from Aesylwinn/LibIssues

Refine CMake scripts and fix g++ 5 build
sol2-server-rewrite
David Cernat 7 years ago committed by GitHub
commit 45d3b24c17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -140,6 +140,16 @@ endif()
find_package(RakNet REQUIRED) find_package(RakNet REQUIRED)
include_directories(${RakNet_INCLUDES}) include_directories(${RakNet_INCLUDES})
if (BUILD_OPENMW_MP OR BUILD_MASTER)
find_package(LuaJit REQUIRED)
find_package(Sol2 REQUIRED)
include_directories(${LuaJit_INCLUDE_DIRS} ${Sol2_INCLUDE_DIRS})
endif()
if (BUILD_MASTER)
find_package(OpenSSL REQUIRED)
include_directories(${OpenSSL_INCLUDE_DIRS})
endif()
# Dependencies # Dependencies
if (USE_QT) if (USE_QT)
message(STATUS "Using Qt${DESIRED_QT_VERSION}") message(STATUS "Using Qt${DESIRED_QT_VERSION}")

@ -3,15 +3,12 @@ project(masterserver)
#set(CMAKE_CXX_STANDARD 14) #set(CMAKE_CXX_STANDARD 14)
add_definitions(-std=gnu++14) add_definitions(-std=gnu++14)
find_package(LuaJit REQUIRED) include_directories("./")
find_package(OpenSSL REQUIRED)
include_directories("./" ${LUAJIT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol ${OPENSSL_INCLUDE_DIR})
set(SOURCE_FILES main.cpp MasterServer.cpp MasterServer.hpp RestServer.cpp RestServer.hpp AdminRest.cpp) set(SOURCE_FILES main.cpp MasterServer.cpp MasterServer.hpp RestServer.cpp RestServer.hpp AdminRest.cpp)
add_executable(masterserver ${SOURCE_FILES}) add_executable(masterserver ${SOURCE_FILES})
target_link_libraries(masterserver ${RakNet_LIBRARY} ${LUAJIT_LIBRARY} ${OPENSSL_LIBRARIES} components) target_link_libraries(masterserver ${RakNet_LIBRARY} ${LuaJit_LIBRARIES} ${OPENSSL_LIBRARIES} components)
option(BUILD_MASTER_TEST "build master server test program" OFF) option(BUILD_MASTER_TEST "build master server test program" OFF)

@ -9,7 +9,7 @@
#include <chrono> #include <chrono>
#include <RakPeerInterface.h> #include <RakPeerInterface.h>
#include <components/openmw-mp/Master/MasterData.hpp> #include <components/openmw-mp/Master/MasterData.hpp>
#include <extern/sol/sol.hpp> #include <sol.hpp>
#include <mutex> #include <mutex>
class MasterServer class MasterServer

@ -1,7 +1,7 @@
#include <iostream> #include <iostream>
#include <Kbhit.h> #include <Kbhit.h>
#include <RakSleep.h> #include <RakSleep.h>
#include <extern/sol/sol.hpp> #include <sol.hpp>
#include "MasterServer.hpp" #include "MasterServer.hpp"
#include "RestServer.hpp" #include "RestServer.hpp"
#include "AdminRest.hpp" #include "AdminRest.hpp"

@ -16,13 +16,7 @@ endif(ENABLE_BREAKPAD)
find_package(LuaJit REQUIRED)
set(LuaScript_Headers ${LUA_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol/sol.hpp)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_LUA") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_LUA")
include_directories(${LUA_INCLUDE_DIR} ${LUAJIT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol)
# local files # local files
set(SERVER set(SERVER
@ -145,8 +139,7 @@ target_link_libraries(tes3mp-server
#${Boost_PROGRAM_OPTIONS_LIBRARY} #${Boost_PROGRAM_OPTIONS_LIBRARY}
${RakNet_LIBRARY} ${RakNet_LIBRARY}
components components
${LUA_LIBRARIES} ${LuaJit_LIBRARIES}
${LUAJIT_LIBRARY}
${Breakpad_Library} ${Breakpad_Library}
) )

@ -227,9 +227,9 @@ void DedicatedActor::playSound()
bool DedicatedActor::hasItem(std::string refId, int charge) bool DedicatedActor::hasItem(std::string refId, int charge)
{ {
for (const auto &ptr : ptr.getClass().getInventoryStore(ptr)) for (const auto &item : ptr.getClass().getInventoryStore(ptr))
{ {
if (::Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), refId) && ptr.getCellRef().getCharge() == charge) if (::Misc::StringUtils::ciEqual(item.getCellRef().getRefId(), refId) && item.getCellRef().getCharge() == charge)
return true; return true;
} }
@ -238,9 +238,9 @@ bool DedicatedActor::hasItem(std::string refId, int charge)
void DedicatedActor::equipItem(std::string refId, int charge) void DedicatedActor::equipItem(std::string refId, int charge)
{ {
for (const auto &ptr : ptr.getClass().getInventoryStore(ptr)) for (const auto &item : ptr.getClass().getInventoryStore(ptr))
{ {
if (::Misc::StringUtils::ciEqual(ptr.getCellRef().getRefId(), refId) && ptr.getCellRef().getCharge() == charge) if (::Misc::StringUtils::ciEqual(item.getCellRef().getRefId(), refId) && item.getCellRef().getCharge() == charge)
{ {
std::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr); std::shared_ptr<MWWorld::Action> action = ptr.getClass().use(ptr);
action->execute(this->ptr); action->execute(this->ptr);

@ -1,22 +1,14 @@
include(LibFindMacros) # Once found, defines:
# LuaJit_FOUND
# Use pkg-config to get hints about paths # LuaJit_INCLUDE_DIRS
libfind_pkg_check_modules(LUAJIT_PKGCONF luajit) # LuaJit_LIBRARIES
find_path(LUAJIT_INCLUDE_DIR include(LibFindMacros)
NAMES luajit.h
PATHS ${LUAJIT_PKGCONF_INCLUDE_DIRS}
)
find_library(LUAJIT_LIBRARY libfind_pkg_detect(LuaJit luajit
NAMES luajit-5.1 luajit FIND_PATH luajit.h
PATHS ${LUAJIT_PKGCONF_LIBRARY_DIRS} FIND_LIBRARY NAMES luajit-5.1 luajit
) )
set(LUAJIT_PROCESS_INCLUDES LUAJIT_INCLUDE_DIR)
set(LUAJIT_PROCESS_LIBS LUAJIT_LIBRARY)
libfind_process(LuaJit) libfind_process(LuaJit)
set(LUA_LIBRARY LUAJIT_LIBRARY)
set(LUA_INCLUDE_DIR LUAJIT_INCLUDE_DIR)

@ -0,0 +1,11 @@
# Once found, defines:
# Sol2_FOUND
# Sol2_INCLUDE_DIRS
include(LibFindMacros)
libfind_pkg_detect(Sol2 sol2
FIND_PATH sol.hpp
)
libfind_process(Sol2)

@ -207,7 +207,7 @@ add_component_dir (fallback
set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui set (ESM_UI ${CMAKE_SOURCE_DIR}/files/ui/contentselector.ui
) )
IF(BUILD_OPENMW OR BUILD_OPENCS) IF(BUILD_OPENMW OR BUILD_OPENCS OR BUILD_BROWSER)
if (USE_QT) if (USE_QT)
add_component_qt_dir (contentselector add_component_qt_dir (contentselector
model/modelitem model/esmfile model/modelitem model/esmfile
@ -234,7 +234,7 @@ if (USE_QT)
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES}) QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
endif() endif()
endif() endif()
ENDIF(BUILD_OPENMW OR BUILD_OPENCS) ENDIF(BUILD_OPENMW OR BUILD_OPENCS OR BUILD_BROWSER)
if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE) if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)

@ -8,6 +8,7 @@
#include <string> #include <string>
#include <memory> #include <memory>
#include <unordered_map> #include <unordered_map>
#include <utility>
#define BPP_INIT(packet_id) packetID = packet_id; strPacketID = #packet_id; className = typeid(this).name(); avoidReading = false; #define BPP_INIT(packet_id) packetID = packet_id; strPacketID = #packet_id; className = typeid(this).name(); avoidReading = false;
@ -38,7 +39,7 @@ public:
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " + throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
processor->className + " and " + p.second->className); processor->className + " and " + p.second->className);
} }
processors.insert(typename processors_t::value_type(processor->GetPacketID(), std::move(processor))); processors.emplace(processor->GetPacketID(), std::unique_ptr<Proccessor>(processor));
} }
protected: protected:
unsigned char packetID; unsigned char packetID;

Loading…
Cancel
Save