From 5765f763f6d314923bb1606f9e59fefa8c83a698 Mon Sep 17 00:00:00 2001 From: Simon Rit Date: Wed, 18 May 2011 19:33:03 +0200 Subject: [PATCH] Dirty work around to force instantiation of auto tools with shared library: list them in an automatically generated header and include it in vv.cxx --- vv/CMakeLists.txt | 15 +++++++++++++-- vv/vv.cxx | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/vv/CMakeLists.txt b/vv/CMakeLists.txt index e9cd2d2..b4a6d71 100644 --- a/vv/CMakeLists.txt +++ b/vv/CMakeLists.txt @@ -128,17 +128,28 @@ QT4_WRAP_UI(vv_UI_CXX QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc) -#Add the autotools and the common files ui +# Add the autotools in the header vvToolsList.h for initialization of the dummy +# variables in vv.cxx for the tools contained in vvLib +file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h) +foreach(tool ${vv_TOOLS}) + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "#include \"${tool}.h\"\n") + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "extern const vvToolCreator<${tool}> *dummy${tool};\n") + FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/vvToolsList.h "const vvToolCreator<${tool}> *dummy${tool}2 = dummy${tool};\n\n") +endforeach(tool) + +# Add the autotools and the common files ui foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI}) SET(vv_SRCS ${vv_SRCS} ${tool}.cxx) QT4_WRAP_CPP(vv_SRCS ${tool}.h) QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui) endforeach(tool) -#Add the common source files + +# Add the common source files foreach(tool ${vv_COMMON}) SET(vv_SRCS ${vv_SRCS} ${tool}.cxx) QT4_WRAP_CPP(vv_SRCS ${tool}.h) endforeach(tool) + # if Windows and Qt was built as a static lib then don't set QT_DLL flag SET(QT_STATIC 0) IF (WIN32) diff --git a/vv/vv.cxx b/vv/vv.cxx index 13a513e..93b708e 100644 --- a/vv/vv.cxx +++ b/vv/vv.cxx @@ -30,6 +30,7 @@ #include "clitkIO.h" #include "vvMainWindow.h" +#include "vvToolsList.h" #include #include #include -- 2.47.1