Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2015-12-25 15:37:07 +01:00
commit 86a903c96e
8 changed files with 107 additions and 52 deletions

View file

@ -220,41 +220,15 @@ IF(WITH_QT5)
FIND_PACKAGE(Qt5LinguistTools) FIND_PACKAGE(Qt5LinguistTools)
FIND_PACKAGE(Qt5Network) FIND_PACKAGE(Qt5Network)
SET(QT_LIBRARIES Qt5::Widgets Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Xml)
IF(QT_STATIC) IF(QT_STATIC)
ADD_DEFINITIONS(-DQT_STATICPLUGIN) ADD_DEFINITIONS(-DQT_STATICPLUGIN)
# Core SET(QT_LIBRARIES Qt5::Widgets)
IF(APPLE)
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${PCRE_LIBRARY}
${FOUNDATION_FRAMEWORK}
${CARBON_FRAMEWORK}
${SECURITY_FRAMEWORK})
ENDIF()
# Network
FIND_PACKAGE(OpenSSL REQUIRED)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${WINSDK_LIBRARY_DIR}/Crypt32.lib
${WINSDK_LIBRARY_DIR}/WS2_32.Lib)
ENDIF()
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY})
# Gui # Gui
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Gui Qt5::OpenGL)
ADD_QT_LIBRARY(PrintSupport) ADD_QT_LIBRARY(PrintSupport)
ADD_QT_LIBRARY(PlatformSupport)
IF(WIN32) IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES} SET(QT_LIBRARIES ${QT_LIBRARIES}
@ -284,17 +258,21 @@ IF(WITH_QT5)
ADD_QT_PLUGIN(printsupport cocoaprintersupport) ADD_QT_PLUGIN(printsupport cocoaprintersupport)
ADD_QT_PLUGIN(platforms qcocoa) ADD_QT_PLUGIN(platforms qcocoa)
ELSE() ELSE()
FIND_LIBRARY(OPENGL_LIBRARY GL) ADD_QT_PLUGIN(platforms qxcb)
ADD_QT_PLUGIN(xcbglintegrations qxcb-glx-integration)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENGL_LIBRARY}) ADD_QT_LIBRARY(XcbQpa)
ADD_QT_LIBRARY(PlatformSupport)
SET(QT_LIBRARIES ${QT_LIBRARIES} -lX11-xcb -lXi -lSM -lICE -lxcb)
SET(QT_LIBRARIES ${QT_LIBRARIES} "${QT_LIBRARY_DIR}/libxcb-static.a")
SET(QT_LIBRARIES ${QT_LIBRARIES} -lfontconfig)
ADD_QT_LIBRARY(DBus)
ENDIF() ENDIF()
ADD_QT_PLUGIN(imageformats qgif) ADD_QT_PLUGIN(imageformats qgif)
ADD_QT_PLUGIN(imageformats qicns) ADD_QT_PLUGIN(imageformats qicns)
ADD_QT_PLUGIN(imageformats qico) ADD_QT_PLUGIN(imageformats qico)
ADD_QT_PLUGIN(imageformats qjpeg) ADD_QT_PLUGIN(imageformats qjpeg)
ADD_QT_PLUGIN(imageformats qmng)
ADD_QT_PLUGIN(imageformats qwebp)
# harfbuzz is needed since Qt 5.3 # harfbuzz is needed since Qt 5.3
IF(UNIX) IF(UNIX)
@ -316,6 +294,25 @@ IF(WITH_QT5)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB}) SET(QT_LIBRARIES ${QT_LIBRARIES} ${FREETYPE_LIB})
ENDIF() ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PNG_LIBRARIES} ${JPEG_LIBRARY})
# Network
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Network Qt5::Xml)
FIND_PACKAGE(OpenSSL REQUIRED)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${OPENSSL_LIBRARIES} ${ZLIB_LIBRARIES})
IF(WIN32)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${WINSDK_LIBRARY_DIR}/Crypt32.lib
${WINSDK_LIBRARY_DIR}/WS2_32.Lib)
ENDIF()
# Core
SET(QT_LIBRARIES ${QT_LIBRARIES} Qt5::Core)
# pcre is needed since Qt 5.5 # pcre is needed since Qt 5.5
IF(UNIX) IF(UNIX)
SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a") SET(PCRE_LIB "${QT_LIBRARY_DIR}/libqtpcre.a")
@ -326,7 +323,23 @@ IF(WITH_QT5)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB}) SET(QT_LIBRARIES ${QT_LIBRARIES} ${PCRE_LIB})
ENDIF() ENDIF()
ADD_QT_PLUGIN(accessible qtaccessiblewidgets) IF(APPLE)
FIND_LIBRARY(PCRE_LIBRARY pcre16 pcre)
FIND_LIBRARY(FOUNDATION_FRAMEWORK Foundation)
FIND_LIBRARY(CARBON_FRAMEWORK Carbon)
FIND_LIBRARY(SECURITY_FRAMEWORK Security)
SET(QT_LIBRARIES ${QT_LIBRARIES}
${PCRE_LIBRARY}
${FOUNDATION_FRAMEWORK}
${CARBON_FRAMEWORK}
${SECURITY_FRAMEWORK})
ELSEIF(UNIX)
SET(QT_LIBRARIES ${QT_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} -ldl)
ENDIF()
ELSE()
SET(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Gui Qt5::OpenGL Qt5::Core)
ENDIF() ENDIF()
ELSE() ELSE()
MESSAGE(WARNING "Unable to find Qt 5") MESSAGE(WARNING "Unable to find Qt 5")

View file

@ -145,13 +145,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
# Special Qt 5 cases
IF(GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB")
# Hack to define missing QT_NO_DEBUG with Qt 5.2 # Hack to define missing QT_NO_DEBUG with Qt 5.2
IF(USE_QT5 AND _UPPER_BUILD STREQUAL "RELEASE") IF(_UPPER_BUILD STREQUAL "RELEASE")
LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG") LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
ENDIF() ENDIF()
# Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIE # Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIE
IF(Qt5_POSITION_INDEPENDENT_CODE AND GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB") IF(Qt5_POSITION_INDEPENDENT_CODE)
SET(_USE_PIE ON) SET(_USE_PIE ON)
ENDIF() ENDIF()
@ -159,6 +161,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}") LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}") LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}")
ENDIF() ENDIF()
ENDIF()
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}") LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")

View file

@ -349,6 +349,9 @@ std::string formatThousands(const std::string& s);
/// The program will be launched in the current directory /// The program will be launched in the current directory
bool launchProgram (const std::string &programName, const std::string &arguments, bool log = true); bool launchProgram (const std::string &programName, const std::string &arguments, bool log = true);
/// This function executes a program and returns output as a string
std::string getCommandOutput(const std::string &command);
/// This function kills a program using his pid (on unix, it uses the kill() POSIX function) /// This function kills a program using his pid (on unix, it uses the kill() POSIX function)
bool killProgram(uint32 pid); bool killProgram(uint32 pid);

View file

@ -5,8 +5,11 @@ IF(NOT WIN32)
FIND_LIBRARY(CARBON NAMES Carbon) FIND_LIBRARY(CARBON NAMES Carbon)
FIND_LIBRARY(COCOA NAMES Cocoa) FIND_LIBRARY(COCOA NAMES Cocoa)
ELSE() ELSE()
SET(OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
SET(CMAKE_FIND_LIBRARY_SUFFIXES .so)
FIND_PACKAGE(X11) FIND_PACKAGE(X11)
FIND_PACKAGE(XF86VidMode) FIND_PACKAGE(XF86VidMode)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_CMAKE_FIND_LIBRARY_SUFFIXES})
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -71,12 +74,12 @@ IF(UNIX AND NOT APPLE)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xext_LIB}) TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${X11_Xext_LIB})
ENDIF() ENDIF()
# libraries needed to be linked while linking to static X11 libraries # libraries needed to be linked while linking to static X11 libraries
FIND_LIBRARY(XCB_LIBRARY # FIND_LIBRARY(XCB_LIBRARY
NAMES xcb # NAMES xcb
HINTS ${X11_LIB_SEARCH_PATH}) # HINTS ${X11_LIB_SEARCH_PATH})
IF(XCB_LIBRARY) # IF(XCB_LIBRARY)
TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XCB_LIBRARY}) # TARGET_LINK_LIBRARIES(${NLDRV_OGL_LIB} ${XCB_LIBRARY})
ENDIF() # ENDIF()
ENDIF() ENDIF()
IF(WITH_PCH) IF(WITH_PCH)

View file

@ -2058,6 +2058,12 @@ bool CDriverGL::getModes(std::vector<GfxMode> &modes)
#elif defined (NL_OS_UNIX) #elif defined (NL_OS_UNIX)
if (!_dpy)
{
nlwarning("3D: Unable to list modes because Display is NULL, did you forget to call init() ?");
return false;
}
bool found = false; bool found = false;
int screen = DefaultScreen(_dpy); int screen = DefaultScreen(_dpy);

View file

@ -23,6 +23,10 @@
# include <ShellAPI.h> # include <ShellAPI.h>
# include <io.h> # include <io.h>
# include <tchar.h> # include <tchar.h>
#define popen _popen
#define pclose _pclose
#elif defined NL_OS_MAC #elif defined NL_OS_MAC
# include <ApplicationServices/ApplicationServices.h> # include <ApplicationServices/ApplicationServices.h>
#elif defined NL_OS_UNIX #elif defined NL_OS_UNIX
@ -32,6 +36,8 @@
# include <sched.h> # include <sched.h>
#endif #endif
#define MAX_LINE_WIDTH 256
#include "nel/misc/command.h" #include "nel/misc/command.h"
#include "nel/misc/path.h" #include "nel/misc/path.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
@ -840,6 +846,25 @@ bool launchProgram(const std::string &programName, const std::string &arguments,
} }
std::string getCommandOutput(const std::string &command)
{
FILE *pipe = popen(command.c_str(), "r");
if (!pipe) return "";
char buffer[MAX_LINE_WIDTH];
std::string result;
while (!feof(pipe))
{
if (fgets(buffer, MAX_LINE_WIDTH, pipe) != NULL) result += buffer;
}
pclose(pipe);
return result;
}
/* /*
* Display the bits (with 0 and 1) composing a byte (from right to left) * Display the bits (with 0 and 1) composing a byte (from right to left)
*/ */

View file

@ -31,6 +31,7 @@
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin) Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)
#elif defined(Q_OS_UNIX) #elif defined(Q_OS_UNIX)
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
Q_IMPORT_PLUGIN(QXcbGlxIntegrationPlugin)
#endif #endif
#endif #endif

View file

@ -145,6 +145,7 @@ void CSystem::GatherOpenGLInfo()
try try
{ {
NL3D::IDriver *driver = NL3D::CDRU::createGlDriver(); NL3D::IDriver *driver = NL3D::CDRU::createGlDriver();
driver->init(0);
GetVideoModes( openglInfo.modes, driver ); GetVideoModes( openglInfo.modes, driver );
driver->release(); driver->release();
} }
@ -161,7 +162,7 @@ void CSystem::GetVideoModes( std::vector< CVideoMode > &dst, NL3D::IDriver *driv
for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr ) for( std::vector< NL3D::GfxMode >::iterator itr = modes.begin(); itr != modes.end(); ++itr )
{ {
if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth == 32 ) && ( itr->Frequency >= 60 ) ) if( ( itr->Width >= 800 ) && ( itr->Height >= 600 ) && ( itr->Depth >= 16 ) )
{ {
CVideoMode mode; CVideoMode mode;
mode.depth = itr->Depth; mode.depth = itr->Depth;