From: <hep...@us...> - 2010-01-09 05:26:00
|
Revision: 1123 http://qterm.svn.sourceforge.net/qterm/?rev=1123&view=rev Author: hephooey Date: 2010-01-09 05:25:48 +0000 (Sat, 09 Jan 2010) Log Message: ----------- Check if we have Qt Bindings Modified Paths: -------------- trunk/qterm-qt4/src/CMakeLists.txt Added Paths: ----------- trunk/qterm-qt4/cmake/FindQtScriptQtBindings.cmake trunk/qterm-qt4/cmake/bindingstest/ trunk/qterm-qt4/cmake/bindingstest/CMakeLists.txt trunk/qterm-qt4/cmake/bindingstest/QtScriptBindingsTest.cpp Added: trunk/qterm-qt4/cmake/FindQtScriptQtBindings.cmake =================================================================== --- trunk/qterm-qt4/cmake/FindQtScriptQtBindings.cmake (rev 0) +++ trunk/qterm-qt4/cmake/FindQtScriptQtBindings.cmake 2010-01-09 05:25:48 UTC (rev 1123) @@ -0,0 +1,44 @@ +## Ian Monroe <ia...@mo...> Copyright 2009 +# released under public domain or: +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +include(CheckCXXSourceRuns) + +if(NOT WIN32) + file( READ "${CMAKE_SOURCE_DIR}/cmake/bindingstest/QtScriptBindingsTest.cpp" source ) + message(STATUS "Checking if the QtScript Qt Bindings are installed.") + + + set(CMAKE_REQUIRED_DEFINTIONS ${QT_DEFINITIONS} ${KDE4_DEFINITIONS} ) + set(CMAKE_REQUIRED_INCLUDES ${QT_QTCORE_INCLUDE_DIR} ${QT_QTSCRIPT_INCLUDE_DIR} ${KDE4_INCLUDES}) + set(CMAKE_REQUIRED_LIBRARIES ${QT_QTSCRIPT_LIBRARY} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} -L${KDE4_LIB_DIR} -lkdecore -lkdeui) + message( STATUS "includes ${CMAKE_REQUIRED_INCLUDES} libraries ${CMAKE_REQUIRED_LIBRARIES}" ) + CHECK_CXX_SOURCE_RUNS( "${source}" BINDINGS_RUN_RESULT) + + if(BINDINGS_RUN_RESULT EQUAL 1) + message( STATUS "QtBindings found") + set(QTSCRIPTQTBINDINGS_FOUND TRUE) + else(BINDINGS_RUN_RESULT EQUAL 1) + message( STATUS "QtBindings not found. Some functions provided by the script will not be available without QtBindings.") + set(QTSCRIPTQTBINDINGS_FOUND FALSE) + endif(BINDINGS_RUN_RESULT EQUAL 1) + + set(CMAKE_REQUIRED_DEFINTIONS "" ) + set(CMAKE_REQUIRED_INCLUDES "") + set(CMAKE_REQUIRED_LIBRARIES "") +else(NOT WIN32) + set(QTSCRIPTQTBINDINGS_FOUND TRUE) +endif(NOT WIN32) Added: trunk/qterm-qt4/cmake/bindingstest/CMakeLists.txt =================================================================== --- trunk/qterm-qt4/cmake/bindingstest/CMakeLists.txt (rev 0) +++ trunk/qterm-qt4/cmake/bindingstest/CMakeLists.txt 2010-01-09 05:25:48 UTC (rev 1123) @@ -0,0 +1,10 @@ +cmake_minimum_required (VERSION 2.6) + +find_package( KDE4 REQUIRED ) + +add_definitions(${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +include_directories (${QT_QTCORE_INCLUDE_DIR} ${QT_QTSCRIPT_INCLUDE_DIR} ${KDE4_INCLUDES}) + +add_executable (bindingstest QtScriptBindingsTest.cpp) +target_link_libraries( bindingstest ${QT_QTSCRIPT_LIBRARY} ${KDE4_KDEUI_LIBS} ) + Added: trunk/qterm-qt4/cmake/bindingstest/QtScriptBindingsTest.cpp =================================================================== --- trunk/qterm-qt4/cmake/bindingstest/QtScriptBindingsTest.cpp (rev 0) +++ trunk/qterm-qt4/cmake/bindingstest/QtScriptBindingsTest.cpp 2010-01-09 05:25:48 UTC (rev 1123) @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Ian Monroe <ia...@mo...> + * released under public domain or: + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <QtCore/QCoreApplication> +#include <QtScript/QScriptEngine> +#include <QtCore/QStringList> +#include <QtCore/QDebug> + +#define FAIL 0xA + +int main(int argc, char **argv) +{ + QCoreApplication app( argc, argv ); + + QStringList allowedBindings; + allowedBindings << "qt.core" << "qt.gui" << "qt.sql" << "qt.xml" << "qt.uitools" << "qt.network" << "qt.webkit"; + QScriptEngine engine; + foreach( QString binding, allowedBindings ) + { + QScriptValue error = engine.importExtension( binding ); + if( error.isUndefined() ) + { // undefined indiciates success + continue; + } + + qDebug() << "Extension" << binding << "not found:" << error.toString(); + qDebug() << "Available extensions:" << engine.availableExtensions(); + return FAIL; + } + return 0; +} Modified: trunk/qterm-qt4/src/CMakeLists.txt =================================================================== --- trunk/qterm-qt4/src/CMakeLists.txt 2010-01-09 04:15:22 UTC (rev 1122) +++ trunk/qterm-qt4/src/CMakeLists.txt 2010-01-09 05:25:48 UTC (rev 1123) @@ -60,6 +60,7 @@ if(QTERM_ENABLE_SCRIPT) if(QT_QTSCRIPT_FOUND) message(STATUS "QtScript module found, enable Script support") + find_package(QtScriptQtBindings) add_definitions(-DSCRIPT_ENABLED) include_directories(${QT_QTSCRIPT_INCLUDE_DIR}) set(optionalLibs ${optionalLibs} ${QT_QTSCRIPT_LIBRARY}) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |