Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Commit

Permalink
Fix Linux compilation
Browse files Browse the repository at this point in the history
 - Map between Qt package names and pkg-config names; fixes mitsuba-renderer#32
 - thread.cpp: pthreads needed an additional parameter, my bad
  • Loading branch information
amyspark committed Oct 10, 2017
1 parent 46650b7 commit 4c72da2
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
65 changes: 34 additions & 31 deletions data/scons/qt5.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# coding: utf8
"""SCons.Tool.qt
Tool-specific initialization for Qt.
Expand Down Expand Up @@ -389,48 +389,50 @@ def recursiveFiles(basepath, path) :
def enable_modules(self, modules, debug=False, crosscompiling=False) :
import sys

validModules = [
'QtCore',
'QtGui',
'QtWidgets',
'QtOpenGL',
'Qt3Support',
'QtAssistant', # deprecated
'QtAssistantClient',
'QtScript',
'QtDBus',
'QtSql',
'QtSvg',
# https://askubuntu.com/questions/508503/whats-the-development-package-for-qt5-in-14-04

# Dictionary changes between MacOS/Windows names and pkg-config names
validModules = {
'QtCore': 'Qt5Core',
'QtGui': 'Qt5Gui',
'QtWidgets': 'Qt5Widgets',
'QtOpenGL': 'Qt5OpenGL',
# 'Qt3Support': 'Qt3Support', # removed in Qt5
# 'QtAssistant': 'QtAssistant', # deprecated in Qt5
# 'QtAssistantClient': 'QtAssistantClient', # deprecated in Qt5
# 'QtDBus': 'Qt5DBus', # unused
# 'QtSql': 'Qt5Sql', # unused
# 'QtSvg': 'Qt5Svg', # unused
# The next modules have not been tested yet so, please
# maybe they require additional work on non Linux platforms
'QtNetwork',
'QtTest',
'QtXml',
'QtXmlPatterns',
'QtUiTools',
'QtDesigner',
'QtDesignerComponents',
'QtWebKit',
'QtHelp',
'QtScript',
'QtScriptTools',
'QtMultimedia',
]
'QtNetwork': 'Qt5Network',
# 'QtTest': 'Qt5Test', # unused
'QtXml': 'Qt5Xml',
'QtXmlPatterns': 'Qt5XmlPatterns',
# 'QtUiTools': 'Qt5UiTools', # unused
# 'QtDesigner' : 'Qt5Designer', # unused
'QtDesignerComponents' : 'Qt5DesignerComponents', # unused
# 'QtWebKit': 'Qt5WebKit', # unused
# 'QtHelp': 'Qt5Help', # unused
# 'QtScript': 'Qt5Script', # unused
# 'QtScriptTools': 'Qt5ScriptTools', # unused
# 'QtMultimedia': 'Qt5Multimedia', # unused
}
pclessModules = [
# in qt <= 4.3 designer and designerComponents are pcless, on qt5.4 they are not, so removed.
# 'QtDesigner',
# 'QtDesignerComponents',
]
staticModules = [
'QtUiTools',
]
staticModules = {
# 'QtUiTools': 'Qt5UiTools', # unused
}
invalidModules=[]
for module in modules:
if module not in validModules :
invalidModules.append(module)
if invalidModules :
raise Exception("Modules %s are not Qt5 modules. Valid Qt5 modules are: %s"% (
str(invalidModules),str(validModules)))
str(invalidModules),str(validModules.keys())))

moduleDefines = {
'QtScript' : ['QT_SCRIPT_LIB'],
Expand Down Expand Up @@ -464,7 +466,8 @@ def enable_modules(self, modules, debug=False, crosscompiling=False) :
pcmodules.remove("QtAssistant")
pcmodules.append("QtAssistantClient")
if sys.platform.startswith('linux'):
self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules))
pkgconfigmodules = [validModules[module]+debugSuffix for module in modules if module not in pclessModules]
self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pkgconfigmodules))
elif sys.platform == 'darwin':
for module in pcmodules:
#self.AppendUnique(CPPPATH="$QTDIR/frameworks/%s.framework/Versions/5/Headers" % module)
Expand Down
4 changes: 3 additions & 1 deletion src/libcore/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,9 @@ void Thread::initializeOpenMP(size_t threadCount) {
}
const std::string threadName = "Mitsuba: " + thread->getName();

#if defined(__LINUX__) || defined(__OSX__)
#if defined(__LINUX__)
pthread_setname_np(pthread_self(), threadName.c_str());
#elif defined(__OSX__)
pthread_setname_np(threadName.c_str());
#elif defined(__WINDOWS__)
SetThreadName(threadName.c_str());
Expand Down

0 comments on commit 4c72da2

Please sign in to comment.