From 7248a5d037adcdd99f1b9cee4e99f47114c7c57b Mon Sep 17 00:00:00 2001 From: Kyle Cooley Date: Fri, 5 Jan 2018 20:25:57 -0500 Subject: [PATCH] Remove some duplication, standardize sol2 header inclusion --- CMakeLists.txt | 10 ++++++++++ apps/master/CMakeLists.txt | 7 ++----- apps/master/MasterServer.hpp | 2 +- apps/master/main.cpp | 2 +- apps/openmw-mp/CMakeLists.txt | 6 ------ components/CMakeLists.txt | 4 ++-- 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cef919a8..fb1e681f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/apps/master/CMakeLists.txt b/apps/master/CMakeLists.txt index 204dfa12c..e92bd7a2b 100644 --- a/apps/master/CMakeLists.txt +++ b/apps/master/CMakeLists.txt @@ -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) diff --git a/apps/master/MasterServer.hpp b/apps/master/MasterServer.hpp index 0d219e3cc..7b093d20c 100644 --- a/apps/master/MasterServer.hpp +++ b/apps/master/MasterServer.hpp @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include class MasterServer diff --git a/apps/master/main.cpp b/apps/master/main.cpp index 938e379a2..aa81f57c6 100644 --- a/apps/master/main.cpp +++ b/apps/master/main.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include "MasterServer.hpp" #include "RestServer.hpp" #include "AdminRest.hpp" diff --git a/apps/openmw-mp/CMakeLists.txt b/apps/openmw-mp/CMakeLists.txt index ec0280b0e..fc92445a8 100644 --- a/apps/openmw-mp/CMakeLists.txt +++ b/apps/openmw-mp/CMakeLists.txt @@ -16,13 +16,7 @@ endif(ENABLE_BREAKPAD) -find_package(LuaJit REQUIRED) -find_package(Sol2 REQUIRED) - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_LUA") -include_directories(${LuaJit_INCLUDE_DIR} ${Sol2_INCLUDE_DIR}) - # local files set(SERVER diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt index 85491274f..cbb77bec3 100644 --- a/components/CMakeLists.txt +++ b/components/CMakeLists.txt @@ -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)