mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-07 05:15:32 +00:00
Merge pull request #367 from Aesylwinn/LibIssues
Refine CMake scripts and fix g++ 5 build
This commit is contained in:
commit
45d3b24c17
10 changed files with 43 additions and 39 deletions
|
@ -140,6 +140,16 @@ endif()
|
|||
find_package(RakNet REQUIRED)
|
||||
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
|
||||
if (USE_QT)
|
||||
message(STATUS "Using Qt${DESIRED_QT_VERSION}")
|
||||
|
|
|
@ -3,15 +3,12 @@ project(masterserver)
|
|||
#set(CMAKE_CXX_STANDARD 14)
|
||||
add_definitions(-std=gnu++14)
|
||||
|
||||
find_package(LuaJit REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
include_directories("./" ${LUAJIT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol ${OPENSSL_INCLUDE_DIR})
|
||||
include_directories("./")
|
||||
|
||||
set(SOURCE_FILES main.cpp MasterServer.cpp MasterServer.hpp RestServer.cpp RestServer.hpp AdminRest.cpp)
|
||||
|
||||
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)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <chrono>
|
||||
#include <RakPeerInterface.h>
|
||||
#include <components/openmw-mp/Master/MasterData.hpp>
|
||||
#include <extern/sol/sol.hpp>
|
||||
#include <sol.hpp>
|
||||
#include <mutex>
|
||||
|
||||
class MasterServer
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <iostream>
|
||||
#include <Kbhit.h>
|
||||
#include <RakSleep.h>
|
||||
#include <extern/sol/sol.hpp>
|
||||
#include <sol.hpp>
|
||||
#include "MasterServer.hpp"
|
||||
#include "RestServer.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")
|
||||
include_directories(${LUA_INCLUDE_DIR} ${LUAJIT_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/extern/sol)
|
||||
|
||||
|
||||
# local files
|
||||
set(SERVER
|
||||
|
@ -145,8 +139,7 @@ target_link_libraries(tes3mp-server
|
|||
#${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${RakNet_LIBRARY}
|
||||
components
|
||||
${LUA_LIBRARIES}
|
||||
${LUAJIT_LIBRARY}
|
||||
${LuaJit_LIBRARIES}
|
||||
${Breakpad_Library}
|
||||
)
|
||||
|
||||
|
|
|
@ -227,9 +227,9 @@ void DedicatedActor::playSound()
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -238,9 +238,9 @@ bool DedicatedActor::hasItem(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);
|
||||
action->execute(this->ptr);
|
||||
|
|
|
@ -1,22 +1,14 @@
|
|||
# Once found, defines:
|
||||
# LuaJit_FOUND
|
||||
# LuaJit_INCLUDE_DIRS
|
||||
# LuaJit_LIBRARIES
|
||||
|
||||
include(LibFindMacros)
|
||||
|
||||
# Use pkg-config to get hints about paths
|
||||
libfind_pkg_check_modules(LUAJIT_PKGCONF luajit)
|
||||
|
||||
find_path(LUAJIT_INCLUDE_DIR
|
||||
NAMES luajit.h
|
||||
PATHS ${LUAJIT_PKGCONF_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
find_library(LUAJIT_LIBRARY
|
||||
NAMES luajit-5.1 luajit
|
||||
PATHS ${LUAJIT_PKGCONF_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
set(LUAJIT_PROCESS_INCLUDES LUAJIT_INCLUDE_DIR)
|
||||
set(LUAJIT_PROCESS_LIBS LUAJIT_LIBRARY)
|
||||
libfind_pkg_detect(LuaJit luajit
|
||||
FIND_PATH luajit.h
|
||||
FIND_LIBRARY NAMES luajit-5.1 luajit
|
||||
)
|
||||
|
||||
libfind_process(LuaJit)
|
||||
|
||||
set(LUA_LIBRARY LUAJIT_LIBRARY)
|
||||
set(LUA_INCLUDE_DIR LUAJIT_INCLUDE_DIR)
|
11
cmake/FindSol2.cmake
Normal file
11
cmake/FindSol2.cmake
Normal file
|
@ -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
|
||||
)
|
||||
|
||||
IF(BUILD_OPENMW OR BUILD_OPENCS)
|
||||
IF(BUILD_OPENMW OR BUILD_OPENCS OR BUILD_BROWSER)
|
||||
if (USE_QT)
|
||||
add_component_qt_dir (contentselector
|
||||
model/modelitem model/esmfile
|
||||
|
@ -234,7 +234,7 @@ if (USE_QT)
|
|||
QT5_WRAP_CPP(MOC_SRCS ${COMPONENT_MOC_FILES})
|
||||
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_SYSTEM_PROCESSOR}" STREQUAL "x86_64" AND NOT APPLE)
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <string>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#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 " +
|
||||
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:
|
||||
unsigned char packetID;
|
||||
|
|
Loading…
Reference in a new issue