fixed compilation on msvc 2017

metadata
Wenzel Jakob 2017-07-30 11:15:10 -07:00
parent 6d7d66175c
commit 6b68f4df03
16 changed files with 407 additions and 865 deletions

View File

@ -60,9 +60,9 @@ if sys.platform == 'win32':
if '.dll' in plugin.__str__(): if '.dll' in plugin.__str__():
installTargets += env.Install(os.path.join(distDir, 'plugins'), plugin) installTargets += env.Install(os.path.join(distDir, 'plugins'), plugin)
compilerType = 'vc' + env['MSVC_VERSION'].replace('.', '') compilerType = 'vc141'
archType = 'x64' if 'WIN64' in env['CXXFLAGS'] else 'i386' archType = 'x64' if 'WIN64' in env['CXXFLAGS'] else 'i386'
dllprefix = '#dependencies/lib/%s_%s' % (archType, compilerType[:-1]) dllprefix = '#dependencies/lib'
if hasCollada: if hasCollada:
install(distDir, ['converter/mtsimport.exe']) install(distDir, ['converter/mtsimport.exe'])
@ -80,22 +80,18 @@ if sys.platform == 'win32':
[ ('#' + os.path.join(includeDir, fname)) for fname in entry[2] ]) [ ('#' + os.path.join(includeDir, fname)) for fname in entry[2] ])
for ver in hasPython: for ver in hasPython:
installAs(os.path.join(distDir, 'python/'+ver+'/mitsuba.pyd'), 'libpython/mitsuba_python' + ver + '.dll') installAs(os.path.join(distDir, 'python/'+ver+'/mitsuba.pyd'), 'libpython/mitsuba_python' + ver + '.dll')
install(distDir, ['Iex.dll', 'Half.dll','IlmThread.dll', 'Imath.dll','IlmImf.dll','zlib.dll', install(distDir, ['Iex.dll', 'Half.dll','IlmThread.dll', 'Imath.dll','IlmImf.dll','zlib1.dll',
'libpng16.dll', 'jpeg62.dll', 'xerces-c_3_1.dll', 'glew32mx.dll', 'libfftw-3.3.dll'], 'libpng16.dll', 'jpeg.dll', 'xerces-c_3_1.dll', 'glew32mx.dll', 'libfftw3-3.dll'],
prefix=dllprefix) prefix=dllprefix)
install(distDir, ['libcollada14dom24.dll'], dllprefix) for boostlib in ['python27', 'python35', 'python36', 'system', 'filesystem', 'chrono', 'thread']:
for boostlib in ['python27', 'python32', 'python33', 'python34', 'system', 'filesystem', 'chrono', 'thread']: install(distDir, ['boost_%s-%s-mt-1_64.dll' % (boostlib, compilerType)], dllprefix)
install(distDir, ['boost_%s-%s-mt-1_53.dll' % (boostlib, compilerType)], dllprefix)
installTargets += env.Install(distDir, '#data/windows/README.txt') installTargets += env.Install(distDir, '#data/windows/README.txt')
if 'REDIST_PATH' in env:
install(distDir, ['libmmd.dll', 'libiomp5md.dll', 'svml_dispmd.dll'], prefix = env['REDIST_PATH'])
if hasQt: if hasQt:
install(distDir, ['mtsgui/mtsgui.exe']) install(distDir, ['mtsgui/mtsgui.exe'])
install(distDir, ['QtCore5.dll', 'QtGui5.dll', 'QtWidgets5.dll', 'QtXml5.dll', install(distDir, ['Qt5Core.dll', 'Qt5Gui.dll', 'Qt5Widgets.dll', 'Qt5Xml.dll',
'QtNetwork5.dll', 'QtOpenGL5.dll', 'QtXmlPatterns5.dll'], prefix = env['QT5_LIBPATH']) 'Qt5Network.dll', 'Qt5OpenGL.dll', 'Qt5XmlPatterns.dll'], prefix = env['QT5_LIBPATH'])
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
for i in plugins: for i in plugins:
plugin = env.Install(os.path.join(distDir, 'plugins'), i) plugin = env.Install(os.path.join(distDir, 'plugins'), i)

View File

@ -1,35 +0,0 @@
import os, sys
BUILDDIR = '#build/release'
DISTDIR = '#dist'
CXX = 'icpc'
CC = 'icc'
CXXFLAGS = ['-O3', '-Wall', '-g', '-pipe', '-O3', '-ipo', '-no-prec-div', '-xSSE3', '-fp-model', 'fast=2', '-openmp', '-mfpmath=sse', '-march=nocona', '-fno-math-errno', '-fomit-frame-pointer', '-DMTS_DEBUG', '-DSINGLE_PRECISION', '-DSPECTRUM_SAMPLES=3', '-DMTS_SSE', '-DMTS_HAS_COHERENT_RT', '-fopenmp', '-fvisibility=hidden', '-std=c++0x', '-wd2928', '-Qoption,cpp,--rvalue_ctor_is_not_copy_ctor']
LINKFLAGS = []
SHLINKFLAGS = ['-rdynamic', '-shared', '-fPIC', '-lstdc++']
BASEINCLUDE = ['#include']
BASELIB = ['dl', 'pthread', 'iomp5']
EIGENINCLUDE = ['/usr/include/eigen3']
OEXRINCLUDE = ['/usr/include/OpenEXR']
OEXRLIB = ['Half', 'IlmImf', 'z']
PNGLIB = ['png']
JPEGLIB = ['jpeg']
XERCESINCLUDE = []
XERCESLIB = ['xerces-c']
GLLIB = ['GL', 'GLU', 'GLEWmx', 'Xxf86vm', 'X11']
GLFLAGS = ['-DGLEW_MX']
BOOSTLIB = ['boost_system', 'boost_filesystem', 'boost_thread']
COLLADAINCLUDE = ['/usr/include/collada-dom', '/usr/include/collada-dom/1.4']
COLLADALIB = ['collada14dom', 'xml2']
FFTWLIB = ['fftw3_threads', 'fftw3']
# The following runs a helper script to search for installed Python
# packages that have a Boost Python library of matching version.
# A Mitsuba binding library will be compiled for each such pair.
# Alternatively, you could also specify the paths and libraries manually
# using the variables PYTHON27INCLUDE, PYTHON27LIB, PYTHON27LIBDIR etc.
import sys, os
sys.path.append(os.path.abspath('../data/scons'))
from detect_python import detect_python
locals().update(detect_python())

View File

@ -1,39 +0,0 @@
BUILDDIR = '#build/release'
DISTDIR = '#dist'
CXX = 'icl'
CC = 'icl'
LINK = 'xilink'
CXXFLAGS = ['/nologo', '/O3', '/Qipo', '/QxSSE2', '/QaxSSE3,SSE4.2', '/fp:fast=2', '/D', 'WIN32', '/W3', '/Qdiag-disable:803' ,'/Qdiag-disable:2415', '/Qdiag-disable:2586', '/EHsc', '/GS-', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'OPENEXR_DLL', '/D', 'NDEBUG', '/Qopenmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86'
MSVC_VERSION = '10.0'
INTEL_COMPILER = True
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/MACHINE:X86', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/NODEFAULTLIB:LIBCMT', '/MANIFEST', '/Qdiag-disable:11024']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/i386_vc10']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc100-mt-1_53', 'boost_filesystem-vc100-mt-1_53', 'boost_thread-vc100-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc100-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc100-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc100-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc100-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/i386_vc10'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,37 +0,0 @@
BUILDDIR = '#build/debug'
DISTDIR = '#dist'
CXX = 'cl'
CC = 'cl'
CXXFLAGS = ['/nologo', '/Od', '/Z7', '/fp:fast', '/arch:SSE2', '/D', 'WIN32', '/W3', '/EHsc', '/GS-', '/GL', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'DEBUG', '/D', 'OPENEXR_DLL', '/openmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86'
MSVC_VERSION = '10.0'
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/DEBUG', '/MACHINE:X86', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/LTCG', '/NODEFAULTLIB:LIBCMT', '/MANIFEST']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/i386_vc10']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc100-mt-1_53', 'boost_filesystem-vc100-mt-1_53', 'boost_thread-vc100-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc100-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc100-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc100-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc100-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/i386_vc10'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,40 +0,0 @@
BUILDDIR = '#build/release'
DISTDIR = '#dist'
CXX = 'cl'
CC = 'cl'
# /O2=optimize for speed, global optimizations, intrinsic functions, favor fast code, frame pointer omission
# /EHsc=C++ exceptions, /fp:fast=Enable reasonable FP optimizations, /GS-=No buffer security checks, /GL=whole program optimizations
# To include debug information add '/Z7' to CXXFLAGS and '/DEBUG' to LINKFLAGS
CXXFLAGS = ['/nologo', '/O2', '/fp:fast', '/arch:SSE2', '/D', 'WIN32', '/W3', '/EHsc', '/GS-', '/GL', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'NDEBUG', '/D', 'OPENEXR_DLL', '/openmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86'
MSVC_VERSION = '10.0'
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/MACHINE:X86', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/LTCG', '/NODEFAULTLIB:LIBCMT', '/MANIFEST']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/i386_vc10']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc100-mt-1_53', 'boost_filesystem-vc100-mt-1_53', 'boost_thread-vc100-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc100-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc100-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc100-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc100-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/i386_vc10'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,39 +0,0 @@
BUILDDIR = '#build/release'
DISTDIR = '#dist'
CXX = 'icl'
CC = 'icl'
LINK = 'xilink'
CXXFLAGS = ['/nologo', '/O3', '/Qipo', '/QxSSE2', '/QaxSSE3,SSE4.2', '/fp:fast=2', '/D', 'WIN32', '/D', 'WIN64', '/W3', '/Qdiag-disable:803' ,'/Qdiag-disable:2415', '/Qdiag-disable:2586', '/EHsc', '/GS-', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'OPENEXR_DLL', '/D', 'NDEBUG', '/Qopenmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86_64'
MSVC_VERSION = '10.0'
INTEL_COMPILER = True
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/MACHINE:X64', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/NODEFAULTLIB:LIBCMT', '/MANIFEST', '/Qdiag-disable:11024']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/x64_vc10']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc100-mt-1_53', 'boost_filesystem-vc100-mt-1_53', 'boost_thread-vc100-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc100-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc100-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc100-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc100-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/x64_vc10'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,37 +0,0 @@
BUILDDIR = '#build/debug'
DISTDIR = '#dist'
CXX = 'cl'
CC = 'cl'
CXXFLAGS = ['/nologo', '/Od', '/Z7', '/fp:fast', '/D', 'WIN32', '/D', 'WIN64', '/W3', '/EHsc', '/GS-', '/GL', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'DEBUG', '/D', 'OPENEXR_DLL', '/openmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86_64'
MSVC_VERSION = '10.0'
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/DEBUG', '/MACHINE:X64', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/LTCG', '/NODEFAULTLIB:LIBCMT', '/MANIFEST']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/x64_vc10']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc100-mt-1_53', 'boost_filesystem-vc100-mt-1_53', 'boost_thread-vc100-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc100-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc100-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc100-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc100-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/x64_vc10'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,40 +0,0 @@
BUILDDIR = '#build/release'
DISTDIR = '#dist'
CXX = 'cl'
CC = 'cl'
# /O2=optimize for speed, global optimizations, intrinsic functions, favor fast code, frame pointer omission
# /EHsc=C++ exceptions, /fp:fast=Enable reasonable FP optimizations, /GS-=No buffer security checks, /GL=whole program optimizations
# To include debug information add '/Z7' to CXXFLAGS and '/DEBUG' to LINKFLAGS
CXXFLAGS = ['/nologo', '/O2', '/fp:fast', '/D', 'WIN32', '/D', 'WIN64', '/W3', '/EHsc', '/GS-', '/GL', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'NDEBUG', '/D', 'OPENEXR_DLL', '/openmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86_64'
MSVC_VERSION = '10.0'
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/MACHINE:X64', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/LTCG', '/NODEFAULTLIB:LIBCMT', '/MANIFEST']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/x64_vc10']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc100-mt-1_53', 'boost_filesystem-vc100-mt-1_53', 'boost_thread-vc100-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc100-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc100-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc100-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc100-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/x64_vc10'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,37 +0,0 @@
BUILDDIR = '#build/debug'
DISTDIR = '#dist'
CXX = 'cl'
CC = 'cl'
CXXFLAGS = ['/nologo', '/Od', '/Z7', '/fp:fast', '/D', 'WIN32', '/D', 'WIN64', '/W3', '/EHsc', '/GS-', '/GL', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'DEBUG', '/D', 'OPENEXR_DLL', '/openmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86_64'
MSVC_VERSION = '12.0'
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/DEBUG', '/MACHINE:X64', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/LTCG', '/NODEFAULTLIB:LIBCMT', '/MANIFEST']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/x64_vc12']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc120-mt-1_53', 'boost_filesystem-vc120-mt-1_53', 'boost_thread-vc120-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc120-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc120-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc120-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc120-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/x64_vc12'
FFTWLIB = ['libfftw-3.3']

View File

@ -1,40 +0,0 @@
BUILDDIR = '#build/release'
DISTDIR = '#dist'
CXX = 'cl'
CC = 'cl'
# /O2=optimize for speed, global optimizations, intrinsic functions, favor fast code, frame pointer omission
# /EHsc=C++ exceptions, /fp:fast=Enable reasonable FP optimizations, /GS-=No buffer security checks, /GL=whole program optimizations
# To include debug information add '/Z7' to CXXFLAGS and '/DEBUG' to LINKFLAGS
CXXFLAGS = ['/nologo', '/O2', '/fp:fast', '/D', 'WIN32', '/D', 'WIN64', '/W3', '/EHsc', '/GS-', '/GL', '/MD', '/D', 'MTS_DEBUG', '/D', 'SINGLE_PRECISION', '/D', 'SPECTRUM_SAMPLES=3', '/D', 'MTS_SSE', '/D', 'MTS_HAS_COHERENT_RT', '/D', '_CONSOLE', '/D', 'NDEBUG', '/D', 'OPENEXR_DLL', '/openmp']
SHCXXFLAGS = CXXFLAGS
TARGET_ARCH = 'x86_64'
MSVC_VERSION = '12.0'
LINKFLAGS = ['/nologo', '/SUBSYSTEM:CONSOLE', '/MACHINE:X64', '/FIXED:NO', '/OPT:REF', '/OPT:ICF', '/LTCG', '/NODEFAULTLIB:LIBCMT', '/MANIFEST']
BASEINCLUDE = ['#include', '#dependencies/include']
BASELIB = ['msvcrt', 'ws2_32', 'Half']
BASELIBDIR = ['#dependencies/lib/x64_vc12']
OEXRINCLUDE = ['#dependencies/include/openexr']
OEXRLIB = ['IlmImf', 'IlmThread', 'Iex', 'zlib']
BOOSTLIB = ['boost_system-vc120-mt-1_53', 'boost_filesystem-vc120-mt-1_53', 'boost_thread-vc120-mt-1_53']
COLLADAINCLUDE = ['#dependencies/include/collada-dom', '#dependencies/include/collada-dom/1.4']
COLLADALIB = ['libcollada14dom24']
XERCESLIB = ['xerces-c_3']
PNGLIB = ['libpng16']
JPEGLIB = ['jpeg']
GLLIB = ['opengl32', 'glu32', 'glew32mx', 'gdi32', 'user32']
GLFLAGS = ['/D', 'GLEW_MX']
SHLIBPREFIX = 'lib'
SHLIBSUFFIX = '.dll'
LIBSUFFIX = '.lib'
PROGSUFFIX = '.exe'
PYTHON27LIB = ['boost_python27-vc120-mt-1_53', 'python27']
PYTHON27INCLUDE = ['#dependencies/include/python27']
PYTHON32LIB = ['boost_python32-vc120-mt-1_53', 'python32']
PYTHON32INCLUDE = ['#dependencies/include/python32']
PYTHON33LIB = ['boost_python33-vc120-mt-1_53', 'python33']
PYTHON33INCLUDE = ['#dependencies/include/python33']
PYTHON34LIB = ['boost_python34-vc120-mt-1_53', 'python34']
PYTHON34INCLUDE = ['#dependencies/include/python34']
QTINCLUDE = ['#dependencies/qt/include']
QTDIR = '#dependencies/qt/x64_vc12'
FFTWLIB = ['libfftw-3.3']

View File

@ -45,24 +45,24 @@ import SCons.Tool
import SCons.Util import SCons.Util
class ToolQtWarning(SCons.Warnings.Warning): class ToolQtWarning(SCons.Warnings.Warning):
pass pass
class GeneratedMocFileNotIncluded(ToolQtWarning): class GeneratedMocFileNotIncluded(ToolQtWarning):
pass pass
class QtdirNotFound(ToolQtWarning): class QtdirNotFound(ToolQtWarning):
pass pass
SCons.Warnings.enableWarningClass(ToolQtWarning) SCons.Warnings.enableWarningClass(ToolQtWarning)
qrcinclude_re = re.compile(r'<file>([^<]*)</file>', re.M) qrcinclude_re = re.compile(r'<file>([^<]*)</file>', re.M)
def transformToWinePath(path) : def transformToWinePath(path) :
return os.popen('winepath -w "%s"'%path).read().strip().replace('\\','/') return os.popen('winepath -w "%s"'%path).read().strip().replace('\\','/')
header_extensions = [".h", ".hxx", ".hpp", ".hh"] header_extensions = [".h", ".hxx", ".hpp", ".hh"]
if SCons.Util.case_sensitive_suffixes('.h', '.H'): if SCons.Util.case_sensitive_suffixes('.h', '.H'):
header_extensions.append('.H') header_extensions.append('.H')
# TODO: The following two lines will work when integrated back to SCons # TODO: The following two lines will work when integrated back to SCons
# TODO: Meanwhile the third line will do the work # TODO: Meanwhile the third line will do the work
#cplusplus = __import__('c++', globals(), locals(), []) #cplusplus = __import__('c++', globals(), locals(), [])
@ -70,433 +70,427 @@ if SCons.Util.case_sensitive_suffixes('.h', '.H'):
cxx_suffixes = [".c", ".cxx", ".cpp", ".cc"] cxx_suffixes = [".c", ".cxx", ".cpp", ".cc"]
def checkMocIncluded(target, source, env): def checkMocIncluded(target, source, env):
moc = target[0] moc = target[0]
cpp = source[0] cpp = source[0]
# looks like cpp.includes is cleared before the build stage :-( # looks like cpp.includes is cleared before the build stage :-(
# not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/ # not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/
path = SCons.Defaults.CScan.path_function(env, moc.cwd) path = SCons.Defaults.CScan.path_function(env, moc.cwd)
includes = SCons.Defaults.CScan(cpp, env, path) includes = SCons.Defaults.CScan(cpp, env, path)
if not moc in includes: if not moc in includes:
SCons.Warnings.warn( SCons.Warnings.warn(
GeneratedMocFileNotIncluded, GeneratedMocFileNotIncluded,
"Generated moc file '%s' is not included by '%s'" % "Generated moc file '%s' is not included by '%s'" %
(str(moc), str(cpp))) (str(moc), str(cpp)))
def find_file(filename, paths, node_factory): def find_file(filename, paths, node_factory):
for dir in paths: for dir in paths:
node = node_factory(filename, dir) node = node_factory(filename, dir)
if node.rexists(): if node.rexists():
return node return node
return None return None
class _Automoc: class _Automoc:
""" """
Callable class, which works as an emitter for Programs, SharedLibraries and Callable class, which works as an emitter for Programs, SharedLibraries and
StaticLibraries. StaticLibraries.
""" """
def __init__(self, objBuilderName): def __init__(self, objBuilderName):
self.objBuilderName = objBuilderName self.objBuilderName = objBuilderName
def __call__(self, target, source, env): def __call__(self, target, source, env):
""" """
Smart autoscan function. Gets the list of objects for the Program Smart autoscan function. Gets the list of objects for the Program
or Lib. Adds objects and builders for the special qt files. or Lib. Adds objects and builders for the special qt files.
""" """
try: try:
if int(env.subst('$QT5_AUTOSCAN')) == 0: if int(env.subst('$QT5_AUTOSCAN')) == 0:
return target, source return target, source
except ValueError: except ValueError:
pass pass
try: try:
debug = int(env.subst('$QT5_DEBUG')) debug = int(env.subst('$QT5_DEBUG'))
except ValueError: except ValueError:
debug = 0 debug = 0
# some shortcuts used in the scanner # some shortcuts used in the scanner
splitext = SCons.Util.splitext splitext = SCons.Util.splitext
objBuilder = getattr(env, self.objBuilderName) objBuilder = getattr(env, self.objBuilderName)
# some regular expressions: # some regular expressions:
# Q_OBJECT detection # Q_OBJECT detection
q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]') q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
# cxx and c comment 'eater' # cxx and c comment 'eater'
#comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)') #comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)')
# CW: something must be wrong with the regexp. See also bug #998222 # CW: something must be wrong with the regexp. See also bug #998222
# CURRENTLY THERE IS NO TEST CASE FOR THAT # CURRENTLY THERE IS NO TEST CASE FOR THAT
# The following is kind of hacky to get builders working properly (FIXME) # The following is kind of hacky to get builders working properly (FIXME)
objBuilderEnv = objBuilder.env objBuilderEnv = objBuilder.env
objBuilder.env = env objBuilder.env = env
mocBuilderEnv = env.Moc5.env mocBuilderEnv = env.Moc5.env
env.Moc5.env = env env.Moc5.env = env
# make a deep copy for the result; MocH objects will be appended # make a deep copy for the result; MocH objects will be appended
out_sources = source[:] out_sources = source[:]
for obj in source: for obj in source:
if isinstance(obj,basestring): # big kludge! if isinstance(obj,basestring): # big kludge!
print "scons: qt5: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj) print "scons: qt5: '%s' MAYBE USING AN OLD SCONS VERSION AND NOT CONVERTED TO 'File'. Discarded." % str(obj)
continue continue
if not obj.has_builder(): if not obj.has_builder():
# binary obj file provided # binary obj file provided
if debug: if debug:
print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj) print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj)
continue continue
cpp = obj.sources[0] cpp = obj.sources[0]
if not splitext(str(cpp))[1] in cxx_suffixes: if not splitext(str(cpp))[1] in cxx_suffixes:
if debug: if debug:
print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp) print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp)
# c or fortran source # c or fortran source
continue continue
#cpp_contents = comment.sub('', cpp.get_contents()) #cpp_contents = comment.sub('', cpp.get_contents())
try: try:
cpp_contents = cpp.get_contents() cpp_contents = cpp.get_contents()
except: continue # may be an still not generated source except: continue # may be an still not generated source
h=None h=None
for h_ext in header_extensions: for h_ext in header_extensions:
# try to find the header file in the corresponding source # try to find the header file in the corresponding source
# directory # directory
hname = splitext(cpp.name)[0] + h_ext hname = splitext(cpp.name)[0] + h_ext
h = find_file(hname, (cpp.get_dir(),), env.File) h = find_file(hname, (cpp.get_dir(),), env.File)
if h: if h:
if debug: if debug:
print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp)) print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))
#h_contents = comment.sub('', h.get_contents()) #h_contents = comment.sub('', h.get_contents())
h_contents = h.get_contents() h_contents = h.get_contents()
break break
if not h and debug: if not h and debug:
print "scons: qt: no header for '%s'." % (str(cpp)) print "scons: qt: no header for '%s'." % (str(cpp))
if h and q_object_search.search(h_contents): if h and q_object_search.search(h_contents):
# h file with the Q_OBJECT macro found -> add moc_cpp # h file with the Q_OBJECT macro found -> add moc_cpp
moc_cpp = env.Moc5(h) moc_cpp = env.Moc5(h)
moc_o = objBuilder(moc_cpp) moc_o = objBuilder(moc_cpp)
out_sources.append(moc_o) out_sources.append(moc_o)
#moc_cpp.target_scanner = SCons.Defaults.CScan #moc_cpp.target_scanner = SCons.Defaults.CScan
if debug: if debug:
print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp)) print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp))
if cpp and q_object_search.search(cpp_contents): if cpp and q_object_search.search(cpp_contents):
# cpp file with Q_OBJECT macro found -> add moc # cpp file with Q_OBJECT macro found -> add moc
# (to be included in cpp) # (to be included in cpp)
moc = env.Moc5(cpp) moc = env.Moc5(cpp)
env.Ignore(moc, moc) env.Ignore(moc, moc)
if debug: if debug:
print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc)) print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc))
#moc.source_scanner = SCons.Defaults.CScan #moc.source_scanner = SCons.Defaults.CScan
# restore the original env attributes (FIXME) # restore the original env attributes (FIXME)
objBuilder.env = objBuilderEnv objBuilder.env = objBuilderEnv
env.Moc5.env = mocBuilderEnv env.Moc5.env = mocBuilderEnv
return (target, out_sources) return (target, out_sources)
AutomocShared = _Automoc('SharedObject') AutomocShared = _Automoc('SharedObject')
AutomocStatic = _Automoc('StaticObject') AutomocStatic = _Automoc('StaticObject')
def _detect(env): def _detect(env):
"""Not really safe, but fast method to detect the QT library""" """Not really safe, but fast method to detect the QT library"""
try: return env['QTDIR'] try: return env['QTDIR']
except KeyError: pass except KeyError: pass
try: return os.environ['QTDIR'] try: return os.environ['QTDIR']
except KeyError: pass except KeyError: pass
moc = env.WhereIs('moc-qt5') or env.WhereIs('moc5') or env.WhereIs('moc') moc = env.WhereIs('moc-qt5') or env.WhereIs('moc5') or env.WhereIs('moc')
if moc: if moc:
QTDIR = os.path.dirname(os.path.dirname(moc)) QTDIR = os.path.dirname(os.path.dirname(moc))
# SCons.Warnings.warn( # SCons.Warnings.warn(
# QtdirNotFound, # QtdirNotFound,
# "QTDIR variable is not defined, using moc executable as a hint (QTDIR=%s)" % QTDIR) # "QTDIR variable is not defined, using moc executable as a hint (QTDIR=%s)" % QTDIR)
return QTDIR return QTDIR
raise SCons.Errors.StopError( raise SCons.Errors.StopError(
QtdirNotFound, QtdirNotFound,
"Could not detect Qt 5 installation") "Could not detect Qt 5 installation")
return None return None
def generate(env): def generate(env):
"""Add Builders and construction variables for qt to an Environment.""" """Add Builders and construction variables for qt to an Environment."""
def locateQt5Command(env, command, qtdir) : def locateQt5Command(env, command, qtdir) :
suffixes = [ suffixes = [
'-qt5', '-qt5',
'-qt5.exe', '-qt5.exe',
'5', '5',
'5.exe', '5.exe',
'', '',
'.exe', '.exe',
] ]
triedPaths = [] triedPaths = []
for suffix in suffixes : for suffix in suffixes :
fullpath = os.path.join(qtdir,'bin',command + suffix) fullpath = os.path.join(qtdir,'bin',command + suffix)
if os.access(fullpath, os.X_OK) : if os.access(fullpath, os.X_OK) :
return fullpath return fullpath
triedPaths.append(fullpath) triedPaths.append(fullpath)
fullpath = env.Detect([command+'-qt5', command+'5', command]) fullpath = env.Detect([command+'-qt5', command+'5', command])
if not (fullpath is None) : return fullpath if not (fullpath is None) : return fullpath
raise Exception("Qt5 command '" + command + "' not found. Tried: " + ', '.join(triedPaths)) raise Exception("Qt5 command '" + command + "' not found. Tried: " + ', '.join(triedPaths))
CLVar = SCons.Util.CLVar CLVar = SCons.Util.CLVar
Action = SCons.Action.Action Action = SCons.Action.Action
Builder = SCons.Builder.Builder Builder = SCons.Builder.Builder
splitext = SCons.Util.splitext splitext = SCons.Util.splitext
env['QTDIR'] = env.GetBuildPath(_detect(env)) env['QTDIR'] = env.GetBuildPath(_detect(env))
# TODO: 'Replace' should be 'SetDefault' # TODO: 'Replace' should be 'SetDefault'
# env.SetDefault( # env.SetDefault(
env.Replace( env.Replace(
QTDIR = _detect(env), QTDIR = _detect(env),
QT5_BINPATH = os.path.join('$QTDIR', 'bin'), QT5_BINPATH = os.path.join('$QTDIR', 'bin'),
QT5_LIBPATH = os.path.join('$QTDIR', 'lib'), QT5_LIBPATH = os.path.join('$QTDIR', 'lib'),
# TODO: This is not reliable to QTDIR value changes but needed in order to support '-qt5' variants # TODO: This is not reliable to QTDIR value changes but needed in order to support '-qt5' variants
QT5_MOC = locateQt5Command(env,'moc', env['QTDIR']), QT5_MOC = locateQt5Command(env,'moc', env['QTDIR']),
QT5_UIC = locateQt5Command(env,'uic', env['QTDIR']), QT5_UIC = locateQt5Command(env,'uic', env['QTDIR']),
QT5_RCC = locateQt5Command(env,'rcc', env['QTDIR']), QT5_RCC = locateQt5Command(env,'rcc', env['QTDIR']),
QT5_LUPDATE = locateQt5Command(env,'lupdate', env['QTDIR']), QT5_LUPDATE = locateQt5Command(env,'lupdate', env['QTDIR']),
QT5_LRELEASE = locateQt5Command(env,'lrelease', env['QTDIR']), QT5_LRELEASE = locateQt5Command(env,'lrelease', env['QTDIR']),
QT5_AUTOSCAN = 1, # Should the qt tool try to figure out, which sources are to be moc'ed? QT5_AUTOSCAN = 1, # Should the qt tool try to figure out, which sources are to be moc'ed?
# Some QT specific flags. I don't expect someone wants to # Some QT specific flags. I don't expect someone wants to
# manipulate those ... # manipulate those ...
QT5_UICFLAGS = CLVar(''), QT5_UICFLAGS = CLVar(''),
QT5_MOCFROMHFLAGS = CLVar(''), QT5_MOCFROMHFLAGS = CLVar(''),
QT5_MOCFROMCXXFLAGS = CLVar('-i'), QT5_MOCFROMCXXFLAGS = CLVar('-i'),
QT5_QRCFLAGS = '', QT5_QRCFLAGS = '',
# suffixes/prefixes for the headers / sources to generate # suffixes/prefixes for the headers / sources to generate
QT5_UISUFFIX = '.ui', QT5_UISUFFIX = '.ui',
QT5_UICDECLPREFIX = 'ui_', QT5_UICDECLPREFIX = 'ui_',
QT5_UICDECLSUFFIX = '.h', QT5_UICDECLSUFFIX = '.h',
QT5_MOCINCPREFIX = '-I', QT5_MOCINCPREFIX = '-I',
QT5_MOCHPREFIX = 'moc_', QT5_MOCHPREFIX = 'moc_',
QT5_MOCHSUFFIX = '$CXXFILESUFFIX', QT5_MOCHSUFFIX = '$CXXFILESUFFIX',
QT5_MOCCXXPREFIX = '', QT5_MOCCXXPREFIX = '',
QT5_MOCCXXSUFFIX = '.moc', QT5_MOCCXXSUFFIX = '.moc',
QT5_QRCSUFFIX = '.qrc', QT5_QRCSUFFIX = '.qrc',
QT5_QRCCXXSUFFIX = '$CXXFILESUFFIX', QT5_QRCCXXSUFFIX = '$CXXFILESUFFIX',
QT5_QRCCXXPREFIX = 'qrc_', QT5_QRCCXXPREFIX = 'qrc_',
QT5_MOCCPPPATH = [], QT5_MOCCPPPATH = [],
QT5_MOCINCFLAGS = '$( ${_concat(QT5_MOCINCPREFIX, QT5_MOCCPPPATH, INCSUFFIX, __env__, RDirs)} $)', QT5_MOCINCFLAGS = '$( ${_concat(QT5_MOCINCPREFIX, QT5_MOCCPPPATH, INCSUFFIX, __env__, RDirs)} $)',
# Commands for the qt support ... # Commands for the qt support ...
QT5_UICCOM = '"$QT5_UIC" $QT5_UICFLAGS -o $TARGET $SOURCE', QT5_UICCOM = '"$QT5_UIC" $QT5_UICFLAGS -o $TARGET $SOURCE',
QT5_MOCFROMHCOM = '"$QT5_MOC" $QT5_MOCFROMHFLAGS $QT5_MOCINCFLAGS -o $TARGET $SOURCE', QT5_MOCFROMHCOM = '"$QT5_MOC" $QT5_MOCFROMHFLAGS $QT5_MOCINCFLAGS -o $TARGET $SOURCE',
QT5_MOCFROMCXXCOM = [ QT5_MOCFROMCXXCOM = [
'$QT5_MOC $QT5_MOCFROMCXXFLAGS $QT5_MOCINCFLAGS -o $TARGET $SOURCE', '$QT5_MOC $QT5_MOCFROMCXXFLAGS $QT5_MOCINCFLAGS -o $TARGET $SOURCE',
Action(checkMocIncluded,None)], Action(checkMocIncluded,None)],
QT5_LUPDATECOM = '"$QT5_LUPDATE" $SOURCE -ts $TARGET', QT5_LUPDATECOM = '"$QT5_LUPDATE" $SOURCE -ts $TARGET',
QT5_LRELEASECOM = '"$QT5_LRELEASE" $SOURCE', QT5_LRELEASECOM = '"$QT5_LRELEASE" $SOURCE',
QT5_RCCCOM = '"$QT5_RCC" $QT5_QRCFLAGS $SOURCE -o $TARGET', QT5_RCCCOM = '"$QT5_RCC" $QT5_QRCFLAGS $SOURCE -o $TARGET',
) )
# Translation builder # Translation builder
tsbuilder = Builder( tsbuilder = Builder(
action = SCons.Action.Action('$QT5_LUPDATECOM'), #,'$QT5_LUPDATECOMSTR'), action = SCons.Action.Action('$QT5_LUPDATECOM'), #,'$QT5_LUPDATECOMSTR'),
multi=1 multi=1
) )
env.Append( BUILDERS = { 'Ts': tsbuilder } ) env.Append( BUILDERS = { 'Ts': tsbuilder } )
qmbuilder = Builder( qmbuilder = Builder(
action = SCons.Action.Action('$QT5_LRELEASECOM'),# , '$QT5_LRELEASECOMSTR'), action = SCons.Action.Action('$QT5_LRELEASECOM'),# , '$QT5_LRELEASECOMSTR'),
src_suffix = '.ts', src_suffix = '.ts',
suffix = '.qm', suffix = '.qm',
single_source = True single_source = True
) )
env.Append( BUILDERS = { 'Qm': qmbuilder } ) env.Append( BUILDERS = { 'Qm': qmbuilder } )
# Resource builder # Resource builder
def scanResources(node, env, path, arg): def scanResources(node, env, path, arg):
# I've being careful on providing names relative to the qrc file # I've being careful on providing names relative to the qrc file
# If that was not needed that code could be simplified a lot # If that was not needed that code could be simplified a lot
def recursiveFiles(basepath, path) : def recursiveFiles(basepath, path) :
result = [] result = []
for item in os.listdir(os.path.join(basepath, path)) : for item in os.listdir(os.path.join(basepath, path)) :
itemPath = os.path.join(path, item) itemPath = os.path.join(path, item)
if os.path.isdir(os.path.join(basepath, itemPath)) : if os.path.isdir(os.path.join(basepath, itemPath)) :
result += recursiveFiles(basepath, itemPath) result += recursiveFiles(basepath, itemPath)
else: else:
result.append(itemPath) result.append(itemPath)
return result return result
contents = node.get_contents() contents = node.get_contents()
includes = qrcinclude_re.findall(contents) includes = qrcinclude_re.findall(contents)
qrcpath = os.path.dirname(node.path) qrcpath = os.path.dirname(node.path)
dirs = [included for included in includes if os.path.isdir(os.path.join(qrcpath,included))] dirs = [included for included in includes if os.path.isdir(os.path.join(qrcpath,included))]
# dirs need to include files recursively # dirs need to include files recursively
for dir in dirs : for dir in dirs :
includes.remove(dir) includes.remove(dir)
includes+=recursiveFiles(qrcpath,dir) includes+=recursiveFiles(qrcpath,dir)
return includes return includes
qrcscanner = SCons.Scanner.Scanner(name = 'qrcfile', qrcscanner = SCons.Scanner.Scanner(name = 'qrcfile',
function = scanResources, function = scanResources,
argument = None, argument = None,
skeys = ['.qrc']) skeys = ['.qrc'])
qrcbuilder = Builder( qrcbuilder = Builder(
action = SCons.Action.Action('$QT5_RCCCOM', '$QT5_RCCCOMSTR'), action = SCons.Action.Action('$QT5_RCCCOM', '$QT5_RCCCOMSTR'),
source_scanner = qrcscanner, source_scanner = qrcscanner,
src_suffix = '$QT5_QRCSUFFIX', src_suffix = '$QT5_QRCSUFFIX',
suffix = '$QT5_QRCCXXSUFFIX', suffix = '$QT5_QRCCXXSUFFIX',
prefix = '$QT5_QRCCXXPREFIX', prefix = '$QT5_QRCCXXPREFIX',
single_source = True single_source = True
) )
env.Append( BUILDERS = { 'Qrc': qrcbuilder } ) env.Append( BUILDERS = { 'Qrc': qrcbuilder } )
# Interface builder # Interface builder
uic5builder = Builder( uic5builder = Builder(
action = SCons.Action.Action('$QT5_UICCOM', '$QT5_UICCOMSTR'), action = SCons.Action.Action('$QT5_UICCOM', '$QT5_UICCOMSTR'),
src_suffix='$QT5_UISUFFIX', src_suffix='$QT5_UISUFFIX',
suffix='$QT5_UICDECLSUFFIX', suffix='$QT5_UICDECLSUFFIX',
prefix='$QT5_UICDECLPREFIX', prefix='$QT5_UICDECLPREFIX',
single_source = True single_source = True
#TODO: Consider the uiscanner on new scons version #TODO: Consider the uiscanner on new scons version
) )
env['BUILDERS']['Uic5'] = uic5builder env['BUILDERS']['Uic5'] = uic5builder
# Metaobject builder # Metaobject builder
mocBld = Builder(action={}, prefix={}, suffix={}) mocBld = Builder(action={}, prefix={}, suffix={})
for h in header_extensions: for h in header_extensions:
act = SCons.Action.Action('$QT5_MOCFROMHCOM', '$QT5_MOCFROMHCOMSTR') act = SCons.Action.Action('$QT5_MOCFROMHCOM', '$QT5_MOCFROMHCOMSTR')
mocBld.add_action(h, act) mocBld.add_action(h, act)
mocBld.prefix[h] = '$QT5_MOCHPREFIX' mocBld.prefix[h] = '$QT5_MOCHPREFIX'
mocBld.suffix[h] = '$QT5_MOCHSUFFIX' mocBld.suffix[h] = '$QT5_MOCHSUFFIX'
for cxx in cxx_suffixes: for cxx in cxx_suffixes:
act = SCons.Action.Action('$QT5_MOCFROMCXXCOM', '$QT5_MOCFROMCXXCOMSTR') act = SCons.Action.Action('$QT5_MOCFROMCXXCOM', '$QT5_MOCFROMCXXCOMSTR')
mocBld.add_action(cxx, act) mocBld.add_action(cxx, act)
mocBld.prefix[cxx] = '$QT5_MOCCXXPREFIX' mocBld.prefix[cxx] = '$QT5_MOCCXXPREFIX'
mocBld.suffix[cxx] = '$QT5_MOCCXXSUFFIX' mocBld.suffix[cxx] = '$QT5_MOCCXXSUFFIX'
env['BUILDERS']['Moc5'] = mocBld env['BUILDERS']['Moc5'] = mocBld
# er... no idea what that was for # er... no idea what that was for
static_obj, shared_obj = SCons.Tool.createObjBuilders(env) static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
static_obj.src_builder.append('Uic5') static_obj.src_builder.append('Uic5')
shared_obj.src_builder.append('Uic5') shared_obj.src_builder.append('Uic5')
# We use the emitters of Program / StaticLibrary / SharedLibrary # We use the emitters of Program / StaticLibrary / SharedLibrary
# to scan for moc'able files # to scan for moc'able files
# We can't refer to the builders directly, we have to fetch them # We can't refer to the builders directly, we have to fetch them
# as Environment attributes because that sets them up to be called # as Environment attributes because that sets them up to be called
# correctly later by our emitter. # correctly later by our emitter.
env.AppendUnique(PROGEMITTER =[AutomocStatic], env.AppendUnique(PROGEMITTER =[AutomocStatic],
SHLIBEMITTER=[AutomocShared], SHLIBEMITTER=[AutomocShared],
LIBEMITTER =[AutomocStatic], LIBEMITTER =[AutomocStatic],
) )
# TODO: Does dbusxml2cpp need an adapter # TODO: Does dbusxml2cpp need an adapter
env.AddMethod(enable_modules, "EnableQt5Modules") env.AddMethod(enable_modules, "EnableQt5Modules")
def enable_modules(self, modules, debug=False, crosscompiling=False) : def enable_modules(self, modules, debug=False, crosscompiling=False) :
import sys import sys
validModules = [ validModules = [
'QtCore', 'QtCore',
'QtGui', 'QtGui',
'QtWidgets', 'QtWidgets',
'QtOpenGL', 'QtOpenGL',
'Qt3Support', 'Qt3Support',
'QtAssistant', # deprecated 'QtAssistant', # deprecated
'QtAssistantClient', 'QtAssistantClient',
'QtScript', 'QtScript',
'QtDBus', 'QtDBus',
'QtSql', 'QtSql',
'QtSvg', 'QtSvg',
# The next modules have not been tested yet so, please # The next modules have not been tested yet so, please
# maybe they require additional work on non Linux platforms # maybe they require additional work on non Linux platforms
'QtNetwork', 'QtNetwork',
'QtTest', 'QtTest',
'QtXml', 'QtXml',
'QtXmlPatterns', 'QtXmlPatterns',
'QtUiTools', 'QtUiTools',
'QtDesigner', 'QtDesigner',
'QtDesignerComponents', 'QtDesignerComponents',
'QtWebKit', 'QtWebKit',
'QtHelp', 'QtHelp',
'QtScript', 'QtScript',
'QtScriptTools', 'QtScriptTools',
'QtMultimedia', 'QtMultimedia',
] ]
pclessModules = [ pclessModules = [
# in qt <= 4.3 designer and designerComponents are pcless, on qt5.4 they are not, so removed. # in qt <= 4.3 designer and designerComponents are pcless, on qt5.4 they are not, so removed.
# 'QtDesigner', # 'QtDesigner',
# 'QtDesignerComponents', # 'QtDesignerComponents',
] ]
staticModules = [ staticModules = [
'QtUiTools', 'QtUiTools',
] ]
invalidModules=[] invalidModules=[]
for module in modules: for module in modules:
if module not in validModules : if module not in validModules :
invalidModules.append(module) invalidModules.append(module)
if invalidModules : if invalidModules :
raise Exception("Modules %s are not Qt5 modules. Valid Qt5 modules are: %s"% ( raise Exception("Modules %s are not Qt5 modules. Valid Qt5 modules are: %s"% (
str(invalidModules),str(validModules))) str(invalidModules),str(validModules)))
moduleDefines = { moduleDefines = {
'QtScript' : ['QT_SCRIPT_LIB'], 'QtScript' : ['QT_SCRIPT_LIB'],
'QtSvg' : ['QT_SVG_LIB'], 'QtSvg' : ['QT_SVG_LIB'],
'Qt3Support' : ['QT_QT3SUPPORT_LIB','QT3_SUPPORT'], 'Qt3Support' : ['QT_QT3SUPPORT_LIB','QT3_SUPPORT'],
'QtSql' : ['QT_SQL_LIB'], 'QtSql' : ['QT_SQL_LIB'],
'QtXml' : ['QT_XML_LIB'], 'QtXml' : ['QT_XML_LIB'],
'QtOpenGL' : ['QT_OPENGL_LIB'], 'QtOpenGL' : ['QT_OPENGL_LIB'],
'QtGui' : ['QT_GUI_LIB'], 'QtGui' : ['QT_GUI_LIB'],
'QtWidgets' : ['QT_WIDGETS_LIB'], 'QtWidgets' : ['QT_WIDGETS_LIB'],
'QtNetwork' : ['QT_NETWORK_LIB'], 'QtNetwork' : ['QT_NETWORK_LIB'],
'QtCore' : ['QT_CORE_LIB'], 'QtCore' : ['QT_CORE_LIB'],
} }
for module in modules : for module in modules :
try : self.AppendUnique(CPPDEFINES=moduleDefines[module]) try : self.AppendUnique(CPPDEFINES=moduleDefines[module])
except: pass except: pass
debugSuffix = '' debugSuffix = ''
if (sys.platform=='darwin' or sys.platform.startswith('linux2')) and not crosscompiling : if (sys.platform=='darwin' or sys.platform.startswith('linux2')) and not crosscompiling :
if debug : debugSuffix = '_debug' if debug : debugSuffix = '_debug'
for module in modules : for module in modules :
if module not in pclessModules : continue if module not in pclessModules : continue
self.AppendUnique(LIBS=[module+debugSuffix]) self.AppendUnique(LIBS=[module+debugSuffix])
self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")]) self.AppendUnique(LIBPATH=[os.path.join("$QTDIR","lib")])
self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5")]) self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5")])
self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5",module)]) self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5",module)])
pcmodules = [module+debugSuffix for module in modules if module not in pclessModules ] pcmodules = [module+debugSuffix for module in modules if module not in pclessModules ]
if 'QtDBus' in pcmodules: if 'QtDBus' in pcmodules:
self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5","QtDBus")]) self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5","QtDBus")])
if "QtAssistant" in pcmodules: if "QtAssistant" in pcmodules:
self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5","QtAssistant")]) self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","qt5","QtAssistant")])
pcmodules.remove("QtAssistant") pcmodules.remove("QtAssistant")
pcmodules.append("QtAssistantClient") pcmodules.append("QtAssistantClient")
if sys.platform.startswith('linux'): if sys.platform.startswith('linux'):
self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules)) self.ParseConfig('pkg-config %s --libs --cflags'% ' '.join(pcmodules))
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
for module in pcmodules: for module in pcmodules:
#self.AppendUnique(CPPPATH="$QTDIR/frameworks/%s.framework/Versions/5/Headers" % module) #self.AppendUnique(CPPPATH="$QTDIR/frameworks/%s.framework/Versions/5/Headers" % module)
self.Append(LINKFLAGS=['-framework', module]) self.Append(LINKFLAGS=['-framework', module])
self["QT5_MOCCPPPATH"] = self["CPPPATH"] self["QT5_MOCCPPPATH"] = self["CPPPATH"]
return return
if sys.platform == "win32" or crosscompiling : if sys.platform == "win32" or crosscompiling :
if crosscompiling: modules_libs = [m[:2]+'5'+m[2:] for m in modules]
transformedQtdir = transformToWinePath(self['QTDIR']) if crosscompiling:
self['QT5_MOC'] = "QTDIR=%s %s"%( transformedQtdir, self['QT5_MOC']) transformedQtdir = transformToWinePath(self['QTDIR'])
self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include")]) self['QT5_MOC'] = "QTDIR=%s %s"%( transformedQtdir, self['QT5_MOC'])
try: modules.remove("QtDBus") self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include")])
except: pass self.AppendUnique(LIBS=[lib for lib in modules_libs if lib not in staticModules])
if debug : debugSuffix = 'd' self.PrependUnique(LIBS=[lib for lib in modules_libs if lib in staticModules])
if "QtAssistant" in modules: if 'QtOpenGL' in modules:
self.AppendUnique(CPPPATH=[os.path.join("$QTDIR","include","QtAssistant")]) self.AppendUnique(LIBS=['opengl32'])
modules.remove("QtAssistant") self.AppendUnique(CPPPATH=[ '$QTDIR/include/'])
modules.append("QtAssistantClient") self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module for module in modules])
self.AppendUnique(LIBS=[lib+'5'+debugSuffix for lib in modules if lib not in staticModules]) if crosscompiling :
self.PrependUnique(LIBS=[lib+debugSuffix for lib in modules if lib in staticModules]) self["QT5_MOCCPPPATH"] = [
if 'QtOpenGL' in modules: path.replace('$QTDIR', transformedQtdir)
self.AppendUnique(LIBS=['opengl32']) for path in self['CPPPATH'] ]
self.AppendUnique(CPPPATH=[ '$QTDIR/include/']) else :
self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module for module in modules]) self["QT5_MOCCPPPATH"] = self["CPPPATH"]
if crosscompiling : self.AppendUnique(LIBPATH=[os.path.join('$QTDIR','lib')])
self["QT5_MOCCPPPATH"] = [ return
path.replace('$QTDIR', transformedQtdir)
for path in self['CPPPATH'] ]
else :
self["QT5_MOCCPPPATH"] = self["CPPPATH"]
self.AppendUnique(LIBPATH=[os.path.join('$QTDIR','lib')])
return
def exists(env): def exists(env):
return _detect(env) return _detect(env)

View File

@ -18,11 +18,6 @@
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#pragma once #pragma once
#ifndef _GETOPT_H
#ifndef __need_getopt
# define _GETOPT_H 1
#endif
#if !defined(MTS_EXPORT_CORE) #if !defined(MTS_EXPORT_CORE)
#if MTS_BUILD_MODULE == MTS_MODULE_CORE #if MTS_BUILD_MODULE == MTS_MODULE_CORE
@ -134,27 +129,23 @@ struct option
/* Many other libraries have conflicting prototypes for getopt, with /* Many other libraries have conflicting prototypes for getopt, with
differences in the consts, in stdlib.h. To avoid compilation differences in the consts, in stdlib.h. To avoid compilation
errors, only prototype getopt for the GNU C library. */ errors, only prototype getopt for the GNU C library. */
extern MTS_EXPORT_CORE int getopt (int __argc, char *const *__argv, const char *__shortopts); extern MTS_EXPORT_CORE int getopt (int argc, char *const *argv, const char *shortopts);
# ifndef __need_getopt # ifndef need_getopt
extern MTS_EXPORT_CORE int getopt_long (int __argc, char *const *__argv, const char *__shortopts, extern MTS_EXPORT_CORE int getopt_long (int argc, char *const *argv, const char *shortopts,
const struct option *__longopts, int *__longind); const struct option *longopts, int *longind);
extern MTS_EXPORT_CORE int getopt_long_only (int __argc, char *const *__argv, extern MTS_EXPORT_CORE int getopt_long_only (int argc, char *const *argv,
const char *__shortopts, const char *shortopts,
const struct option *__longopts, int *__longind); const struct option *longopts, int *longind);
/* Internal only. Users should not call this directly. */ /* Internal only. Users should not call this directly. */
extern MTS_EXPORT_CORE int _getopt_internal (int __argc, char *const *__argv, extern MTS_EXPORT_CORE int _getopt_internal (int argc, char *const *argv,
const char *__shortopts, const char *shortopts,
const struct option *__longopts, int *__longind, const struct option *longopts, int *longind,
int __long_only); int long_only);
# endif # endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* Make sure we later can get all the definitions and declarations. */
#undef __need_getopt
#endif /* getopt.h */

View File

@ -22,6 +22,10 @@
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#if defined(__MSVC__)
# include <intrin.h>
#endif
MTS_NAMESPACE_BEGIN MTS_NAMESPACE_BEGIN
/*! \addtogroup libcore /*! \addtogroup libcore

View File

@ -35,15 +35,10 @@ if hasQt:
del qtEnv['LINKFLAGS'][index] del qtEnv['LINKFLAGS'][index]
qtEnv.Append(CXXFLAGS=['/D', '_WINDOWS', '/D', 'MTS_CUSTOM_QTMAIN', '/D', 'MTSGUI_STATIC_QFILEDIALOG=1']) qtEnv.Append(CXXFLAGS=['/D', '_WINDOWS', '/D', 'MTS_CUSTOM_QTMAIN', '/D', 'MTSGUI_STATIC_QFILEDIALOG=1'])
qtEnv.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS']) qtEnv.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
if hasBreakpad: qtEnv.Append(LIBS=['qtmain', 'shell32'])
qtEnv.Append(CPPPATH=['#dependencies/include/breakpad'])
qtEnv.Append(LIBS=['breakpad_common', 'breakpad_exception_handler', 'breakpad_crash_generation_client',
'breakpad_crash_report_sender', 'wininet'])
elif sys.platform == 'darwin': elif sys.platform == 'darwin':
qtEnv.Append(LINKFLAGS=['-Fdependencies/frameworks', '-framework', qtEnv.Append(LINKFLAGS=['-Fdependencies/frameworks', '-framework',
'BWToolkitFramework', '-framework', 'Security', '-framework', 'CoreFoundation']) 'BWToolkitFramework', '-framework', 'Security', '-framework', 'CoreFoundation'])
if hasBreakpad:
qtEnv.Append(LINKFLAGS=['-framework', 'Breakpad'])
# Qt 4 headers cause a lot of warnings on clang/OSX -- turn them off # Qt 4 headers cause a lot of warnings on clang/OSX -- turn them off
if qtEnv['CXX'] == 'clang++': if qtEnv['CXX'] == 'clang++':
qtEnv.Append(CPPFLAGS=['-Wno-unused-private-field', '-Wno-uninitialized']) qtEnv.Append(CPPFLAGS=['-Wno-unused-private-field', '-Wno-uninitialized'])

View File

@ -179,7 +179,7 @@ protected:
public: public:
QtDevice(QGLWidget *widget) : WGLDevice(NULL), m_widget(widget) { } QtDevice(QGLWidget *widget) : WGLDevice(NULL), m_widget(widget) { }
void init(Device *other = NULL) { void init(Device *other = NULL) {
m_hwnd = m_widget->winId(); m_hwnd = (HWND) m_widget->winId();
m_hdc = wglGetCurrentDC(); m_hdc = wglGetCurrentDC();
} }
#else #else

View File

@ -1,94 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Windows main function of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
** $QT_END_LICENSE$
**
****************************************************************************/
#if defined(MTS_CUSTOM_QTMAIN)
#if !defined(_WIN32)
# error This source file can only be used in Windows builds
#endif
#include <QtCore/QVector>
#include <QtCore/QByteArray>
#include <QtCore/QString>
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
/*
This file contains the code in the qtmain library for Windows.
qtmain contains the Windows startup code and is required for
linking to the Qt DLL.
When a Windows application starts, the WinMain function is
invoked. WinMain calls qWinMain in the Qt DLL/library, which
initializes Qt.
*/
QT_BEGIN_NAMESPACE
extern void qWinMain(HINSTANCE, HINSTANCE, LPSTR, int, int &, QVector<char *> &);
QT_END_NAMESPACE
QT_USE_NAMESPACE
extern "C" int main(int, char **);
/*
WinMain() - Initializes Windows and calls user's startup function main().
NOTE: WinMain() won't be called if the application was linked as a "console"
application.
*/
extern "C"
int APIENTRY WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR /*cmdParamarg*/, int cmdShow)
{
// Work-around problems with wchar_t as a native type
const unsigned short * cmdLineUtf16 =
reinterpret_cast<const unsigned short*> (GetCommandLineW ());
QByteArray cmdParam = QString::fromUtf16 (cmdLineUtf16).toLocal8Bit();
int argc = 0;
QVector<char *> argv(8);
qWinMain(instance, prevInstance, cmdParam.data(), cmdShow, argc, argv);
int result = main(argc, argv.data());
return result;
}
#endif // MTS_CUSTOM_QTMAIN