diff options
author | Hugo Lima <hugo.lima@openbossa.org> | 2009-11-17 11:44:00 -0200 |
---|---|---|
committer | Hugo Lima <hugo.lima@openbossa.org> | 2009-11-17 11:44:00 -0200 |
commit | f081e5ff270a23a2ae2dafede0520416f681ff4b (patch) | |
tree | dac5b04eeda86a32c6f3bc783dcf1fea75b53160 | |
parent | 4545d7fc24b016d6456da40298a2cf4581e38ec1 (diff) |
Add symbol visibility rules to generator runner.
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | generator.h | 11 | ||||
-rw-r--r-- | generatorrunnermacros.h | 42 | ||||
-rw-r--r-- | generators/qtdoc/qtdocgenerator.h | 4 |
4 files changed, 52 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3eea2411e..39acc2c5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,7 @@ cmake_minimum_required(VERSION 2.6) find_package(Qt4 4.5.0 REQUIRED) find_package(ApiExtractor REQUIRED) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -DGENRUNNER_BUILD -fvisibility=hidden") set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) set(LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE) @@ -64,6 +65,7 @@ add_custom_target(dist install(TARGETS genrunner DESTINATION ${LIB_INSTALL_DIR}) install(TARGETS generatorrunner DESTINATION bin) install(FILES generator.h DESTINATION include/generatorrunner) +install(FILES generatorrunnermacros.h DESTINATION include/generatorrunner) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/generatorrunner.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FindGeneratorRunner.cmake diff --git a/generator.h b/generator.h index 7423b25b5..b16694de0 100644 --- a/generator.h +++ b/generator.h @@ -28,13 +28,14 @@ #include <QtCore/QDir> #include <QtCore/QLinkedList> #include <apiextractor/abstractmetalang.h> +#include "generatorrunnermacros.h" class ApiExtractor; class AbstractMetaBuilder; class QFile; #define EXPORT_GENERATOR_PLUGIN(X)\ -extern "C" Q_DECL_EXPORT GeneratorList getGenerators()\ +extern "C" GENRUNNER_API GeneratorList getGenerators()\ {\ return GeneratorList() << X;\ }\ @@ -45,7 +46,7 @@ QTextStream& formatCode(QTextStream &s, const QString& code, Indentor &indentor) * Base class for all generators. The default implementations does nothing, * you must subclass this to create your own generators. */ -class Generator +class GENRUNNER_API Generator { public: /// Optiosn used around the generator code @@ -301,7 +302,7 @@ typedef QLinkedList<Generator*> GeneratorList; /** * Utility class to store the identation level, use it in a QTextStream. */ -class Indentor +class GENRUNNER_API Indentor { public: Indentor(): @@ -312,7 +313,7 @@ public: /** * Class that use the RAII idiom to set and unset the identation level. */ -class Indentation +class GENRUNNER_API Indentation { public: Indentation(Indentor &indentor) : indentor(indentor) @@ -328,7 +329,7 @@ private: Indentor &indentor; }; -inline QTextStream &operator <<(QTextStream &s, const Indentor &indentor) +GENRUNNER_API inline QTextStream &operator <<(QTextStream &s, const Indentor &indentor) { for (int i = 0; i < indentor.indent; ++i) s << " "; diff --git a/generatorrunnermacros.h b/generatorrunnermacros.h new file mode 100644 index 000000000..f7095f18f --- /dev/null +++ b/generatorrunnermacros.h @@ -0,0 +1,42 @@ +/* +* This file is part of the API Extractor 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 +* +*/ + +#ifndef GENERATORRUNNERMACROS_H +#define GENERATORRUNNERMACROS_H + +// GENRUNNER_API is used for the public API symbols. +#if defined _WIN32 || defined __CYGWIN__ + #if GENRUNNER_BUILD + #define GENRUNNER_API __declspec(dllimport) + #else + #define GENRUNNER_API __declspec(dllexport) + #endif +#else + #if __GNUC__ >= 4 + #define GENRUNNER_API __attribute__ ((visibility("default"))) + #else + #define GENRUNNER_API + #endif +#endif + +#endif diff --git a/generators/qtdoc/qtdocgenerator.h b/generators/qtdoc/qtdocgenerator.h index 01717a0cd..763f3c53d 100644 --- a/generators/qtdoc/qtdocgenerator.h +++ b/generators/qtdoc/qtdocgenerator.h @@ -35,7 +35,7 @@ class AbstractMetaClass; class QXmlStreamReader; class QtDocGenerator; -class QtXmlToSphinx +class GENRUNNER_API QtXmlToSphinx { public: struct TableCell @@ -156,7 +156,7 @@ QTextStream& operator<<(QTextStream& s, const QtXmlToSphinx::Table &table); /** * The DocGenerator generates documentation from library being binded. */ -class QtDocGenerator : public Generator +class GENRUNNER_API QtDocGenerator : public Generator { public: QString libSourceDir() const |