diff options
-rw-r--r-- | generators/CMakeLists.txt | 36 | ||||
-rw-r--r-- | generators/main.cpp (renamed from generators/shiboken/main.cpp) | 44 | ||||
-rw-r--r-- | generators/qtdoc/main.cpp | 34 | ||||
-rw-r--r-- | generators/shibokenconfig.h.in (renamed from generators/shiboken/shibokenconfig.h.in) | 0 | ||||
-rw-r--r-- | shibokenmodule/shibokenmodule.txt.in | 2 | ||||
-rw-r--r-- | tests/minimalbinding/minimal-binding.txt.in | 2 | ||||
-rw-r--r-- | tests/otherbinding/other-binding.txt.in | 2 | ||||
-rw-r--r-- | tests/samplebinding/sample-binding.txt.in | 2 |
8 files changed, 43 insertions, 79 deletions
diff --git a/generators/CMakeLists.txt b/generators/CMakeLists.txt index 07720ff52..37a6f3cc9 100644 --- a/generators/CMakeLists.txt +++ b/generators/CMakeLists.txt @@ -1,6 +1,32 @@ -project(generators) +project(shibokengenerator) -# if (NOT APIEXTRACTOR_DOCSTRINGS_DISABLED) -# add_subdirectory(qtdoc) -# endif() -add_subdirectory(shiboken) +set(shiboken_SRC +generator.cpp +shiboken/cppgenerator.cpp +shiboken/headergenerator.cpp +shiboken/overloaddata.cpp +shiboken/shibokengenerator.cpp +shiboken/shibokennormalize.cpp +qtdoc/qtdocgenerator.cpp +main.cpp +) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/shiboken + ${CMAKE_CURRENT_SOURCE_DIR}/qtdoc + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${APIEXTRACTOR_INCLUDE_DIR} + ${QT_INCLUDE_DIR} + ${QT_QTCORE_INCLUDE_DIR} + ${QT_QTXML_INCLUDE_DIR}) + +add_executable(shiboken ${shiboken_SRC}) +set_target_properties(shiboken PROPERTIES OUTPUT_NAME shiboken${shiboken_SUFFIX}) +target_link_libraries(shiboken + ${APIEXTRACTOR_LIBRARY} + ${QT_QTCORE_LIBRARY} + ${QT_QTXML_LIBRARY}) + +configure_file(shibokenconfig.h.in "${CMAKE_CURRENT_BINARY_DIR}/shibokenconfig.h" @ONLY) + +install(TARGETS shiboken DESTINATION bin) diff --git a/generators/shiboken/main.cpp b/generators/main.cpp index 290808bc5..f9f94f7ac 100644 --- a/generators/shiboken/main.cpp +++ b/generators/main.cpp @@ -31,6 +31,7 @@ #include "shibokenconfig.h" #include "cppgenerator.h" #include "headergenerator.h" +#include "qtdocgenerator.h" #ifdef _WINDOWS #define PATH_SPLITTER ";" @@ -301,49 +302,20 @@ int main(int argc, char *argv[]) return EXIT_SUCCESS; } - // FIXME: This should be choosen by command line! - generators << new CppGenerator << new HeaderGenerator; -#if 0 - // Try to load a generator QString generatorSet = argsHandler.removeArg("generator-set"); - // Also check "generatorSet" command line argument for backward compatibility. if (generatorSet.isEmpty()) generatorSet = argsHandler.removeArg("generatorSet"); - if (!generatorSet.isEmpty()) { - QFileInfo generatorFile(generatorSet); - if (!generatorFile.exists()) { - QString generatorSetName(generatorSet + "_generator"); - - // More library paths may be added via the QT_PLUGIN_PATH environment variable. - QCoreApplication::addLibraryPath("foobar"); - foreach (const QString& path, QCoreApplication::libraryPaths()) { - generatorFile.setFile(QDir(path), generatorSetName); - if (generatorFile.exists()) - break; - } - } - - if (!generatorFile.exists()) { - errorPrint(QString("shiboken: Error loading generator-set plugin: %2 module not found.").arg(qPrintable(generatorFile.baseName())), true); - return EXIT_FAILURE; - } - - QLibrary plugin(generatorFile.filePath()); - getGeneratorsFunc getGenerators = (getGeneratorsFunc)plugin.resolve("getGenerators"); - if (getGenerators) { - getGenerators(&generators); - } else { - errorPrint(QString("shiboken: Error loading generator-set plugin: %2"). - arg(qPrintable(plugin.errorString())), true); - return EXIT_FAILURE; - } - } else if (!argsHandler.argExists("help")) { - errorPrint("shiboken: You need to specify a generator with --generator-set=GENERATOR_NAME"); + // Pre-defined generator sets. + if (generatorSet == "qtdoc") { + generators << new QtDocGenerator; + } else if (generatorSet.isEmpty() || generatorSet == "shiboken") { + generators << new CppGenerator << new HeaderGenerator; + } else { + errorPrint("shiboken: Unknown generator set, try \"shiboken\" or \"qtdoc\"."); return EXIT_FAILURE; } -#endif if (argsHandler.argExistsRemove("help")) { printUsage(generators); diff --git a/generators/qtdoc/main.cpp b/generators/qtdoc/main.cpp deleted file mode 100644 index 21fab1474..000000000 --- a/generators/qtdoc/main.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of the PySide project. - * - * Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - * - * Contact: PySide team <contact@pyside.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * This program 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 - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA - * - */ - -#include <QtCore> - -int main(int argc, char *argv[]) -{ - QStringList args; - args.append("--generator-set=qtdoc"); - for (int i = 1; i < argc; i++) - args.append(argv[i]); - return QProcess::execute("generatorrunner", args); -} - diff --git a/generators/shiboken/shibokenconfig.h.in b/generators/shibokenconfig.h.in index 7d844a940..7d844a940 100644 --- a/generators/shiboken/shibokenconfig.h.in +++ b/generators/shibokenconfig.h.in diff --git a/shibokenmodule/shibokenmodule.txt.in b/shibokenmodule/shibokenmodule.txt.in index 6ef8c4d4c..c5adc6091 100644 --- a/shibokenmodule/shibokenmodule.txt.in +++ b/shibokenmodule/shibokenmodule.txt.in @@ -1,6 +1,6 @@ [generator-project] -generator-set = @generators_BINARY_DIR@/shiboken_generator@CMAKE_RELEASE_POSTFIX@@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@ +generator-set = shiboken header-file = @CMAKE_CURRENT_SOURCE_DIR@/nothing.h typesystem-file = @CMAKE_CURRENT_SOURCE_DIR@/typesystem_shiboken.xml diff --git a/tests/minimalbinding/minimal-binding.txt.in b/tests/minimalbinding/minimal-binding.txt.in index b6bcf05b8..85b139676 100644 --- a/tests/minimalbinding/minimal-binding.txt.in +++ b/tests/minimalbinding/minimal-binding.txt.in @@ -1,6 +1,6 @@ [generator-project] -generator-set = @generators_BINARY_DIR@/shiboken_generator@CMAKE_RELEASE_POSTFIX@@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@ +generator-set = shiboken header-file = @CMAKE_CURRENT_SOURCE_DIR@/global.h typesystem-file = @minimal_TYPESYSTEM@ diff --git a/tests/otherbinding/other-binding.txt.in b/tests/otherbinding/other-binding.txt.in index 12ea06988..a17b70fc1 100644 --- a/tests/otherbinding/other-binding.txt.in +++ b/tests/otherbinding/other-binding.txt.in @@ -1,6 +1,6 @@ [generator-project] -generator-set = @generators_BINARY_DIR@/shiboken_generator@CMAKE_RELEASE_POSTFIX@@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@ +generator-set = shiboken header-file = @CMAKE_CURRENT_SOURCE_DIR@/global.h typesystem-file = @other_TYPESYSTEM@ diff --git a/tests/samplebinding/sample-binding.txt.in b/tests/samplebinding/sample-binding.txt.in index 9a4895b6f..317f76f09 100644 --- a/tests/samplebinding/sample-binding.txt.in +++ b/tests/samplebinding/sample-binding.txt.in @@ -1,6 +1,6 @@ [generator-project] -generator-set = @generators_BINARY_DIR@/shiboken_generator@CMAKE_RELEASE_POSTFIX@@CMAKE_DEBUG_POSTFIX@@CMAKE_SHARED_LIBRARY_SUFFIX@ +generator-set = shiboken header-file = @CMAKE_CURRENT_SOURCE_DIR@/global.h typesystem-file = @sample_TYPESYSTEM@ |