Browse Source

Ability to control static build of plugins separately.

pull/77/head
Vladimír Vondruš 12 years ago
parent
commit
1ada7cdaa0
  1. 4
      CMakeLists.txt
  2. 10
      doc/building.dox
  3. 2
      package/ci/jenkins-mingw-w64.xml
  4. 2
      package/ci/jenkins.xml
  5. 2
      src/MagnumPlugins/CMakeLists.txt
  6. 10
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h
  7. 10
      src/MagnumPlugins/TgaImporter/TgaImporter.h

4
CMakeLists.txt

@ -112,7 +112,8 @@ if(BUILD_DEPRECATED)
endif()
option(BUILD_STATIC "Build static libraries (default are shared)" OFF)
cmake_dependent_option(BUILD_STATIC_PIC "Build static libraries with position-independent code" OFF "BUILD_STATIC" OFF)
cmake_dependent_option(BUILD_STATIC_PIC "Build static libraries and plugins with position-independent code" OFF "BUILD_STATIC" OFF)
option(BUILD_PLUGINS_STATIC "Build static plugins (default are dynamic)" OFF)
option(BUILD_TESTS "Build unit tests." OFF)
cmake_dependent_option(BUILD_GL_TESTS "Build unit tests for OpenGL code." OFF "BUILD_TESTS" OFF)
if(BUILD_TESTS)
@ -142,6 +143,7 @@ endif()
# meaningless on Emscripten and too inconvenient on Android
if(CORRADE_TARGET_NACL_NEWLIB OR CORRADE_TARGET_EMSCRIPTEN OR CORRADE_TARGET_ANDROID)
set(BUILD_STATIC ON)
set(BUILD_PLUGINS_STATIC ON)
endif()
if(BUILD_STATIC)

10
doc/building.dox

@ -137,10 +137,12 @@ Installation to given prefix can be done from within QtCreator by adding new
The libraries are build as shared by default. If you are developing for
platform which doesn't support shared libraries or if you just want to link
them statically, enable `BUILD_STATIC` to build the libraries as static. If you
plan to use them with shared libraries later, enable also position-independent
code with `BUILD_STATIC_PIC`. If you want to build with another compiler (e.g.
Clang), pass `-DCMAKE_CXX_COMPILER=clang++` to CMake.
them statically, enable `BUILD_STATIC` to build the libraries as static.
Building of static plugins is controlled with separate `BUILD_PLUGINS_STATIC`
variable. If you plan to use the static libraries with shared libraries later,
enable also position-independent code with `BUILD_STATIC_PIC`. If you want to
build with another compiler (e.g. Clang), pass `-DCMAKE_CXX_COMPILER=clang++`
to CMake.
Libraries and static plugins built in `Debug` configuration (e.g. with
`CMAKE_BUILD_TYPE` set to `Debug`) have `-d` suffix to make it possible to have

2
package/ci/jenkins-mingw-w64.xml

@ -69,7 +69,7 @@ git submodule init
git submodule update
if [ ${libraries} = "static" ] ; then
static_build_flag="-DBUILD_STATIC=ON -DBUILD_STATIC_PIC=ON"
static_build_flag="-DBUILD_STATIC=ON -DBUILD_PLUGINS_STATIC=ON -DBUILD_STATIC_PIC=ON"
fi
if [ "${compatibility}" = "deprecated" ] ; then

2
package/ci/jenkins.xml

@ -85,7 +85,7 @@ else
fi
if [ ${libraries} = "static" ] ; then
static_build_flag="-DBUILD_STATIC=ON -DBUILD_STATIC_PIC=ON"
static_build_flag="-DBUILD_STATIC=ON -DBUILD_PLUGINS_STATIC=ON -DBUILD_STATIC_PIC=ON"
fi
if [ "${compatibility}" = "deprecated" ] ; then

2
src/MagnumPlugins/CMakeLists.txt

@ -25,7 +25,7 @@
# Wrapper for creating given plugin type
macro(add_plugin plugin_name debug_install_dir release_install_dir metadata_file)
if(NOT BUILD_STATIC)
if(NOT BUILD_PLUGINS_STATIC)
corrade_add_plugin(${plugin_name} ${debug_install_dir} ${release_install_dir} ${metadata_file} ${ARGN})
else()
corrade_add_static_plugin(${plugin_name} ${release_install_dir} ${metadata_file} ${ARGN})

10
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.h

@ -32,14 +32,10 @@
#include "Magnum/Trade/AbstractImageConverter.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_BUILD_STATIC
#if defined(TgaImageConverter_EXPORTS) || defined(TgaImageConverterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#if defined(TgaImageConverter_EXPORTS) || defined(TgaImageConverterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_STATIC
#define MAGNUM_TRADE_TGAIMAGECONVERTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#define MAGNUM_TRADE_TGAIMAGECONVERTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif

10
src/MagnumPlugins/TgaImporter/TgaImporter.h

@ -34,14 +34,10 @@
#include "Magnum/Trade/AbstractImporter.h"
#ifndef DOXYGEN_GENERATING_OUTPUT
#ifndef MAGNUM_BUILD_STATIC
#if defined(TgaImporter_EXPORTS) || defined(TgaImporterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#if defined(TgaImporter_EXPORTS) || defined(TgaImporterObjects_EXPORTS)
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_EXPORT
#else
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_STATIC
#define MAGNUM_TRADE_TGAIMPORTER_EXPORT CORRADE_VISIBILITY_IMPORT
#endif
#define MAGNUM_TRADE_TGAIMPORTER_LOCAL CORRADE_VISIBILITY_LOCAL
#endif

Loading…
Cancel
Save