Fix autotype test (build) failures on Mac OS and Windows.

We need to tell Windows what symbols the main program exports
and the autotype plugin imports.

On both systems the linker needs the path of the main program that
loads the plugin.
This commit is contained in:
Felix Geyer 2013-03-29 16:27:02 +01:00
parent 98e59215b8
commit 5550d7af0d
5 changed files with 23 additions and 7 deletions

View File

@ -198,6 +198,7 @@ qt4_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC}) qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC})
add_library(keepassx_core STATIC ${keepassx_SOURCES}) add_library(keepassx_core STATIC ${keepassx_SOURCES})
set_target_properties(keepassx_core PROPERTIES COMPILE_DEFINITIONS KEEPASSX_BUILDING_CORE)
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE}) add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
target_link_libraries(${PROGNAME} target_link_libraries(${PROGNAME}
@ -211,6 +212,8 @@ if(UNIX AND NOT APPLE)
target_link_libraries(${PROGNAME} ${QT_QTDBUS_LIBRARY}) target_link_libraries(${PROGNAME} ${QT_QTDBUS_LIBRARY})
endif() endif()
set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON)
if(APPLE) if(APPLE)
configure_file(${CMAKE_SOURCE_DIR}/share/macosx/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist) configure_file(${CMAKE_SOURCE_DIR}/share/macosx/Info.plist.cmake ${CMAKE_CURRENT_BINARY_DIR}/Info.plist)
set_target_properties(${PROGNAME} PROPERTIES set_target_properties(${PROGNAME} PROPERTIES

View File

@ -21,9 +21,11 @@
#include <QtCore/QChar> #include <QtCore/QChar>
#include <QtCore/Qt> #include <QtCore/Qt>
#include "core/Global.h"
class AutoTypeExecutor; class AutoTypeExecutor;
class AutoTypeAction class KEEPASSX_EXPORT AutoTypeAction
{ {
public: public:
virtual ~AutoTypeAction() {} virtual ~AutoTypeAction() {}
@ -31,7 +33,7 @@ public:
virtual void accept(AutoTypeExecutor* executor) = 0; virtual void accept(AutoTypeExecutor* executor) = 0;
}; };
class AutoTypeChar : public AutoTypeAction class KEEPASSX_EXPORT AutoTypeChar : public AutoTypeAction
{ {
public: public:
explicit AutoTypeChar(const QChar& character); explicit AutoTypeChar(const QChar& character);
@ -41,7 +43,7 @@ public:
const QChar character; const QChar character;
}; };
class AutoTypeKey : public AutoTypeAction class KEEPASSX_EXPORT AutoTypeKey : public AutoTypeAction
{ {
public: public:
explicit AutoTypeKey(Qt::Key key); explicit AutoTypeKey(Qt::Key key);
@ -51,7 +53,7 @@ public:
const Qt::Key key; const Qt::Key key;
}; };
class AutoTypeDelay : public AutoTypeAction class KEEPASSX_EXPORT AutoTypeDelay : public AutoTypeAction
{ {
public: public:
explicit AutoTypeDelay(int delayMs); explicit AutoTypeDelay(int delayMs);
@ -61,7 +63,7 @@ public:
const int delayMs; const int delayMs;
}; };
class AutoTypeClearField : public AutoTypeAction class KEEPASSX_EXPORT AutoTypeClearField : public AutoTypeAction
{ {
public: public:
explicit AutoTypeClearField(); explicit AutoTypeClearField();
@ -69,7 +71,7 @@ public:
void accept(AutoTypeExecutor* executor); void accept(AutoTypeExecutor* executor);
}; };
class AutoTypeExecutor class KEEPASSX_EXPORT AutoTypeExecutor
{ {
public: public:
virtual ~AutoTypeExecutor() {} virtual ~AutoTypeExecutor() {}

View File

@ -9,4 +9,4 @@ set(autotype_test_MOC
qt4_wrap_cpp(autotype_test_SOURCES ${autotype_test_MOC}) qt4_wrap_cpp(autotype_test_SOURCES ${autotype_test_MOC})
add_library(keepassx-autotype-test MODULE ${autotype_test_SOURCES}) add_library(keepassx-autotype-test MODULE ${autotype_test_SOURCES})
target_link_libraries(keepassx-autotype-test ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) target_link_libraries(keepassx-autotype-test testautotype ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})

View File

@ -118,4 +118,14 @@ template <> class QStaticAssertFailure<true> {};
#endif // COMPILER_STATIC_ASSERT #endif // COMPILER_STATIC_ASSERT
#endif // !defined(Q_STATIC_ASSERT) && !defined(Q_STATIC_ASSERT_X) #endif // !defined(Q_STATIC_ASSERT) && !defined(Q_STATIC_ASSERT_X)
#if defined(Q_OS_WIN)
# if defined(KEEPASSX_BUILDING_CORE)
# define KEEPASSX_EXPORT Q_DECL_EXPORT
# else
# define KEEPASSX_EXPORT Q_DECL_IMPORT
# endif
#else
# define KEEPASSX_EXPORT
#endif
#endif // KEEPASSX_GLOBAL_H #endif // KEEPASSX_GLOBAL_H

View File

@ -154,6 +154,7 @@ add_unit_test(NAME testwildcardmatcher SOURCES TestWildcardMatcher.cpp MOCS Test
add_unit_test(NAME testautotype SOURCES TestAutoType.cpp MOCS TestAutoType.h add_unit_test(NAME testautotype SOURCES TestAutoType.cpp MOCS TestAutoType.h
LIBS ${TEST_LIBRARIES}) LIBS ${TEST_LIBRARIES})
set_target_properties(testautotype PROPERTIES ENABLE_EXPORTS ON)
add_unit_test(NAME testentry SOURCES TestEntry.cpp MOCS TestEntry.h add_unit_test(NAME testentry SOURCES TestEntry.cpp MOCS TestEntry.h
LIBS ${TEST_LIBRARIES}) LIBS ${TEST_LIBRARIES})