Skip to content

Commit

Permalink
Merge pull request supercollider#1334 from bagong/topic/qt5-TimAllAnd…
Browse files Browse the repository at this point in the history
…Cosmetics

Topic/qt5 tim all and cosmetics
(This is a merge of qt52 and timb's qt branch fixes)
  • Loading branch information
scztt committed Mar 12, 2015
2 parents 595b956 + aa1b21a commit 085cab2
Show file tree
Hide file tree
Showing 100 changed files with 5,651 additions and 551 deletions.
26 changes: 16 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,33 @@ before_install:
- ifmac () { if [[ $TRAVIS_OS_NAME == osx ]]; then eval $@; fi; }
- iflin () { if [[ $TRAVIS_OS_NAME == linux ]]; then eval $@; fi; }
- ifmac brew update
- ifmac brew install cmake qt4 || true
- iflin sudo apt-add-repository -y ppa:ubuntu-sdk-team/ppa
- ifmac brew install cmake qt5 || true
#- iflin sudo apt-add-repository -y ppa:ubuntu-sdk-team/ppa
- iflin "curl https://s3-us-west-2.amazonaws.com/supercollider/build-tools/linux/qt-5.3.2.zip -o qt.zip; unzip qt.zip -d $HOME/qt"
- iflin sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- iflin sudo add-apt-repository -y ppa:andykimpe/cmake # backport of cmake 2.8.12
- iflin sudo add-apt-repository -y ppa:ondrej/php5 # libicu-dev 52
- iflin sudo apt-get update
- iflin sudo apt-get install gcc-4.7 g++-4.7 aptitude build-essential libqt4-dev libqtwebkit-dev libjack-dev libsndfile1-dev libasound2-dev libavahi-client-dev libicu-dev libreadline6-dev libfftw3-dev libxt-dev libudev-dev pkg-config cmake=2.8.12.2-3 subversion libstdc++5
- iflin sudo apt-get install libicu-dev=52.1-1+debphp.org~precise+1 gcc-4.7 g++-4.7 aptitude build-essential libjack-dev libsndfile1-dev libasound2-dev libavahi-client-dev libreadline6-dev libfftw3-dev libxt-dev libudev-dev pkg-config cmake=2.8.12.2-3 subversion libstdc++5
- iflin sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.6
- iflin sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.7 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.7
- iflin sudo update-alternatives --auto gcc

before_script:
- mkdir BUILD
- cd BUILD
- ifmac cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=`brew --prefix qt` -DSC_QT=1 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 .. --debug-output
- iflin cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib/x86_64-linux-gnu/qt4/ -DCMAKE_INSTALL_PREFIX:PATH=$PWD/Install -DSC_EL=no .. --debug-output
- export QT_PREFIX=$HOME/qt/gcc_64
- export QT_PLUGIN_PATH=$QT_PREFIX/plugins
- ifmac cmake -DCMAKE_PREFIX_PATH=`brew --prefix qt5` -DSC_QT=1 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.7 .. --debug-output
- iflin cmake -DSC_EL=no -DCMAKE_PREFIX_PATH=$QT_PREFIX -DCMAKE_INSTALL_PREFIX:PATH=$PWD/Install -DCMAKE_BUILD_TYPE=Release -DSC_QT=1 .. --debug-output
# some paths
- ifmac export SCLANG=$TRAVIS_BUILD_DIR/BUILD/Install/SuperCollider/SuperCollider.app/Contents/MacOS/sclang
- iflin export SCLANG=$TRAVIS_BUILD_DIR/BUILD/Install/bin/sclang

script:
script:
- make install

- $TRAVIS_BUILD_DIR/testsuite/sclang/launch_test.py $SCLANG

before_deploy:
# required for github releases
- git fetch --tags
Expand Down Expand Up @@ -60,18 +68,16 @@ deploy:
acl: public_read
on:
condition: $TRAVIS_OS_NAME = osx
repo: supercollider/supercollider
all_branches: true
# github releases - only tags
- provider: releases
api_key:
secure: dT+wMo2ICRxBp0oIw/Iao+mUJLHDNcFtOrRUdU/5jX6ENdtabt2CDX+OJX3/SJNdDuNOaR+R1fr7qypQmxx/sHAuzH3uqYMuMH6z95zRHH8iS0iZgLOVfJ7U/O3EpgNLSqlqkRGwl2nDXqCvUJrnDnsXpEy4pbqQXHX5tzM9cQs=
secure: K3X3Ja+j4iKwb6SOpxebV5acVBl5C8tXoTBWb3bO9iwJjYpzIYFi7Mr5zUIz/0hx8pgyr2eNrWEL/YOOyg7BzfPG7wiSfjDPpsPRYvx4XQslXOivsfljKy/rK4wN1edj5ZK7ydlygBaNkrlxH2JQDjTNvveYr+b6LHrD7N0mWqE=
file: $HOME/artifacts/SC-$COMMIT_NAME.zip
prerelease: true
skip_cleanup: true
on:
condition: $TRAVIS_OS_NAME = osx
repo: supercollider/supercollider
tags: true
all_branches: true

Expand Down
73 changes: 43 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux")
set(LINUX 1)
endif()

if (LINUX)
cmake_minimum_required (VERSION 2.8)
else()
cmake_minimum_required (VERSION 2.8.10)
endif()
cmake_minimum_required (VERSION 2.8.11)

include("SCVersion.txt")
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}")
Expand Down Expand Up @@ -90,16 +86,12 @@ elseif(UNIX)
endif()

if(WIN32)
set_property(DIRECTORY
APPEND
PROPERTY COMPILE_DEFINITIONS SC_WIN32 NOMINMAX _WIN32_WINNT=0x0500)

add_definitions(-DWIN32_LEAN_AND_MEAN)
add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX -D_WIN32_WINNT=0x0500)

# correctly link the static Boost Thread library:
add_definitions(-DBOOST_THREAD_USE_LIB)
#avoid unnecesary autolink
add_definitions(-DBOOST_DATE_TIME_NO_LIB -DBOOST_ALL_NO_LIB)
#avoid unnecesary autolink
add_definitions(-DBOOST_DATE_TIME_NO_LIB -DBOOST_ALL_NO_LIB)

endif()

Expand All @@ -117,13 +109,7 @@ option(SSE2 "Compile with support for SSE2 instructions." ON)

set(AUDIOAPI "default" CACHE STRING "Audio API to use (one of {default,coreaudio,jack,portaudio})")

if(NOT WIN32)
option(LIBSCSYNTH "Compile libscsynth as shared library" OFF)
else()
# libscsynth has unresolved symbols, which are resolved when linked with server executable.
# On Windows, this is not supported for static libraries, so we build dynamic by default.
option(LIBSCSYNTH "Compile libscsynth as shared library" ON)
endif()
option(LIBSCSYNTH "Compile libscsynth as shared library" OFF)

option(INSTALL_HELP "Install help docs and examples along with the software" ON)
option(SC_DOC_RENDER "Pre-render SCDoc documentation. (For putting online, etc)" OFF)
Expand Down Expand Up @@ -204,7 +190,7 @@ else()
endif()

if(SYSTEM_YAMLCPP)
find_package(YamlCpp 0.3 EXACT)
find_package(YamlCpp)
else()
set(YAMLCPP_FOUND OFF)
endif()
Expand Down Expand Up @@ -376,18 +362,38 @@ else()
endif()

if(NOT APPLE)
install(DIRECTORY sounds DESTINATION ${auxresourcesdir})
install(DIRECTORY examples DESTINATION ${auxresourcesdir})
install(DIRECTORY sounds DESTINATION ${auxresourcesdir})
install(DIRECTORY examples DESTINATION ${auxresourcesdir})
elseif(APPLE)
install(DIRECTORY examples DESTINATION ${auxresourcesdir})
endif()

set( AdditionalInstallFiles
README.md
README_OS_X.md
ChangeLog
COPYING
AUTHORS
MOVED_STUFF.txt
)
if (WIN32)
set( AdditionalInstallFiles
README.md
README_WINDOWS.md
ChangeLog
COPYING
AUTHORS
)
elseif(APPLE)
set( AdditionalInstallFiles
README.md
README_OS_X.md
ChangeLog
COPYING
AUTHORS
MOVED_STUFF.txt
)
else()
set( AdditionalInstallFiles
README.md
README_LINUX.md
ChangeLog
COPYING
AUTHORS
)
endif()

install(FILES ${AdditionalInstallFiles} DESTINATION ${auxresourcesdir})

Expand All @@ -399,6 +405,13 @@ if(INSTALL_HELP)
endif()
install( CODE
"EXECUTE_PROCESS(COMMAND ln -shF ${CMAKE_CURRENT_SOURCE_DIR}/HelpSource ${CMAKE_INSTALL_PREFIX}/${auxresourcesdir}/HelpSource )" )
elseif(NOT APPLE)
install(DIRECTORY HelpSource
DESTINATION ${auxresourcesdir}
REGEX ${SCCLASSLIB_EXCLUDE_REGEX} EXCLUDE
PATTERN "*~" EXCLUDE
PATTERN "*#" EXCLUDE
)
endif()
endif()

Expand Down
15 changes: 11 additions & 4 deletions MOVED_STUFF.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
SuperCollider class library, help files, sclang and scsynth
HAS BEEN MOVED into SuperCollider.app/Contents/Resources.
sclang, scsynth and (if available) supernova HAVE BEEN MOVED into
SuperCollider.app/Contents/MacOS.

The SuperCollider class library and help files have been moved into
SuperCollider.app/Contents/Resources.

In previous versions of SuperCollider, these resources lived in the
top folder next to SuperCollider.app. To make a standard self-contained
Expand All @@ -13,18 +16,22 @@ To access them in the Terminal, simply:

$ cd path/to/SuperCollider.app/Contents/Resources

or

$ cd path/to/SuperCollider.app/Contents/MacOS

To have sclang and scsynth available system-wide, you can put wrapper-
scripts into a folder in your PATH, like /usr/local/bin
For sclang:

#!/bin/sh
cd /full/path/to/SuperCollider.app/Contents/Resources
cd /full/path/to/SuperCollider.app/Contents/MacOS
exec ./sclang $*

And for scsynth:

#!/bin/sh
cd /full/path/to/SuperCollider.app/Contents/Resources
cd /full/path/to/SuperCollider.app/Contents/MacOS
exec ./scsynth $*

NOTE: Why not symlinking them instead? Because:
Expand Down
62 changes: 29 additions & 33 deletions QtCollider/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
if(APPLE)
set(required_qt_version 4.8.5)
else()
set(required_qt_version 4.7)
endif()

find_package (Qt4 ${required_qt_version} COMPONENTS QtCore QtGui QtWebKit QtNetwork)

if (NOT QT4_FOUND)
set(FIND_QT_ERROR_MSG "You are trying to compile with Qt GUI support, but a suitable version of Qt or one of its components could not be found:")

if(NOT QT_QTCORE_FOUND)
set(FIND_QT_ERROR_MSG "${FIND_QT_ERROR_MSG}\n-- Missing component: QtCore")
endif()
if(NOT QT_QTGUI_FOUND)
set(FIND_QT_ERROR_MSG "${FIND_QT_ERROR_MSG}\n-- Missing component: QtGui")
endif()
if(NOT QT_QTWEBKIT_FOUND)
set(FIND_QT_ERROR_MSG "${FIND_QT_ERROR_MSG}\n-- Missing component: QtWebKit")
endif()

set(FIND_QT_ERROR_MSG "${FIND_QT_ERROR_MSG}\nPlease either install Qt (version ${required_qt_version} or greater), or compile without Qt GUI support (add -DSC_QT=OFF to the cmake command line).")

message(FATAL_ERROR ${FIND_QT_ERROR_MSG})
cmake_minimum_required(VERSION 2.8.11)

set(required_qt_version 5.2)

find_package(Qt5Core)
find_package(Qt5Widgets)
find_package(Qt5Network)
find_package(Qt5WebKit)
find_package(Qt5WebKitWidgets)
find_package(Qt5PrintSupport)
find_package(Qt5OpenGL)
find_package(Qt5Sensors)
find_package(Qt5Quick)
find_package(Qt5Qml)
find_package(Qt5Sql)
find_package(Qt5Positioning)

set (QT_COLLIDER_LIBS
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Network Qt5::WebKit Qt5::WebKitWidgets Qt5::PrintSupport
Qt5::OpenGL Qt5::Sensors Qt5::Quick Qt5::Qml Qt5::Sql Qt5::Positioning
${MATH_LIBRARY})

if (APPLE)
find_package(Qt5MacExtras)
list(APPEND QT_COLLIDER_LIBS Qt5::MacExtras)
endif()

set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DQC_DEBUG")
Expand Down Expand Up @@ -126,18 +127,15 @@ if(QT_COLLIDER_LANG_CLIENT)
list(APPEND QT_COLLIDER_HDRS ${QT_COLLIDER_DIR}/LanguageClient.h)
list(APPEND QT_COLLIDER_SRCS ${QT_COLLIDER_DIR}/LanguageClient.cpp)
endif()


set( QT_USE_QTWEBKIT TRUE )


include(${QT_USE_FILE})
set( QT_USE_QTWEBKIT TRUE )

qt4_wrap_cpp( QT_COLLIDER_MOC_SRCS ${QT_COLLIDER_HDRS} )
qt4_add_resources( QT_COLLIDER_RCC ${QT_COLLIDER_DIR}/resources.qrc )
qt5_wrap_cpp( QT_COLLIDER_MOC_SRCS ${QT_COLLIDER_HDRS} )
qt5_add_resources( QT_COLLIDER_RCC ${QT_COLLIDER_DIR}/resources.qrc )

if(APPLE)
qt4_wrap_cpp( QT_COLLIDER_OBJ_MOC_SRCS ${QT_COLLIDER_DIR}/widgets/QcQuartzComposerView.h )
qt5_wrap_cpp( QT_COLLIDER_OBJ_MOC_SRCS ${QT_COLLIDER_DIR}/widgets/QcQuartzComposerView.h )
list(APPEND QT_COLLIDER_HDRS ${QT_COLLIDER_DIR}/widgets/QcQuartzComposerView.h )
set( QT_COLLIDER_OBJCPP_SRCS
${QT_COLLIDER_OBJ_MOC_SRCS}
Expand All @@ -159,8 +157,6 @@ list( APPEND QT_COLLIDER_SRCS

add_definitions(-DSC_QT -DQT_COLLIDER_EXPORTING -DQT_NO_KEYWORDS)

set (QT_COLLIDER_LIBS ${QT_LIBRARIES} ${MATH_LIBRARY})

if(APPLE)
list(APPEND QT_COLLIDER_LIBS "-framework Cocoa" )
list(APPEND QT_COLLIDER_LIBS "-framework Quartz" )
Expand Down
15 changes: 12 additions & 3 deletions QtCollider/QWidgetProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
# undef KeyRelease
#endif

#ifdef Q_OS_MAC
# include "./hacks/hacks_mac.hpp"
#endif

using namespace QtCollider;

QAtomicInt QWidgetProxy::_globalEventMask = 0;
Expand Down Expand Up @@ -186,6 +190,10 @@ void QWidgetProxy::bringFrontEvent() {
#ifdef Q_WS_X11
raise_window(QX11Info::display(), w);
#endif

#ifdef Q_OS_MAC
QtCollider::Mac::activateApp();
#endif
}

void QWidgetProxy::setFocusEvent( QtCollider::SetFocusEvent *e ) {
Expand Down Expand Up @@ -251,15 +259,16 @@ bool QWidgetProxy::preProcessEvent( QObject *o, QEvent *e, EventHandlerData &eh,
{
// NOTE We assume that qObject need not be checked here, as we wouldn't get events if
// it wasn't existing
int acquired_globalEventMask = _globalEventMask.load();

switch( eh.type ) {

case QEvent::KeyPress:
return ((_globalEventMask & KeyPress) || eh.enabled)
return ((acquired_globalEventMask & KeyPress) || eh.enabled)
&& interpretKeyEvent( o, e, args );

case QEvent::KeyRelease:
return ((_globalEventMask & KeyRelease) || eh.enabled)
return ((acquired_globalEventMask & KeyRelease) || eh.enabled)
&& interpretKeyEvent( o, e, args );

case QEvent::MouseButtonPress:
Expand Down Expand Up @@ -395,7 +404,7 @@ bool QWidgetProxy::interpretKeyEvent( QObject *o, QEvent *e, QList<QVariant> &ar

QChar character;

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
bool isLetter = key >= Qt::Key_A && key <= Qt::Key_Z;
if (mods & Qt::MetaModifier && isLetter)
{
Expand Down
2 changes: 1 addition & 1 deletion QtCollider/QWidgetProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class QWidgetProxy : public QObjectProxy
public:

static void setGlobalEventEnabled ( GlobalEvent ev, bool b ) {
int mask = _globalEventMask;
int mask = _globalEventMask.load();
if(b)
mask |= ev;
else
Expand Down
4 changes: 2 additions & 2 deletions QtCollider/QcApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include <QKeyEvent>
#include <QIcon>

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
#include "../../common/SC_Apple.hpp"
#endif

Expand Down Expand Up @@ -81,7 +81,7 @@ QcApplication::QcApplication( int & argc, char ** argv )
setWindowIcon(icon);
}

#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
// On Mac, we may need to disable "App Nap", so we aren't put to sleep unexpectedly
SC::Apple::disableAppNap();
#endif
Expand Down
4 changes: 2 additions & 2 deletions QtCollider/QcSignalSpy.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class QcMethodSignalHandler : public QcSignalSpy

qcDebugMsg( 1, QString("SIGNAL: '%1' handled by method '%2'")
.arg( _proxy->object() ?
_proxy->object()->metaObject()->method( _sigId ).signature() :
QString(_proxy->object()->metaObject()->method( _sigId ).methodSignature()) :
"unknown" )
.arg(_handler->name)
);
Expand All @@ -166,7 +166,7 @@ class QcFunctionSignalHandler : public QcSignalSpy

qcDebugMsg( 1, QString("SIGNAL: '%1' handled by a Function")
.arg( _proxy->object() ?
_proxy->object()->metaObject()->method( _sigId ).signature() :
QString(_proxy->object()->metaObject()->method( _sigId ).methodSignature()) :
"unknown" )
);

Expand Down
Loading

0 comments on commit 085cab2

Please sign in to comment.