mirror of
https://github.com/reactos/CMake.git
synced 2024-12-12 05:45:51 +00:00
Autogen: Tests: Add test for MacOS frameworks
This commit is contained in:
parent
fcbd02fd6e
commit
e4ccc68429
@ -214,6 +214,12 @@ add_subdirectory(uicInclude)
|
||||
# OBJECT libraries
|
||||
add_subdirectory(objectLibrary)
|
||||
|
||||
# -- Test
|
||||
# MacOS Framework
|
||||
if(APPLE AND (NOT QT_TEST_VERSION STREQUAL 4))
|
||||
add_subdirectory(macosFW)
|
||||
endif()
|
||||
|
||||
# -- Test
|
||||
# Source files with the same basename in different subdirectories
|
||||
add_subdirectory(sameName)
|
||||
|
20
Tests/QtAutogen/macosFW/CMakeLists.txt
Normal file
20
Tests/QtAutogen/macosFW/CMakeLists.txt
Normal file
@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(macos-fw-test)
|
||||
|
||||
find_package(Qt5Test REQUIRED)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/lib)
|
||||
set(CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib)
|
||||
|
||||
if(POLICY CMP0042) # in CMake 3.0.0+
|
||||
set (CMAKE_MACOSX_RPATH OFF) # otherwise ON by default
|
||||
endif(POLICY CMP0042)
|
||||
|
||||
if(POLICY CMP0068) # in CMake 3.9+
|
||||
cmake_policy(SET CMP0068 NEW)
|
||||
endif(POLICY CMP0068)
|
||||
|
||||
add_subdirectory(src)
|
||||
add_subdirectory(test)
|
33
Tests/QtAutogen/macosFW/src/CMakeLists.txt
Normal file
33
Tests/QtAutogen/macosFW/src/CMakeLists.txt
Normal file
@ -0,0 +1,33 @@
|
||||
set(MACOS_FW_LIB_VERSION "0.1")
|
||||
set(MACOS_FW_LIB_SRCS
|
||||
macos_fw_lib.cpp
|
||||
)
|
||||
set(MACOS_FW_LIB_HDRS
|
||||
macos_fw_lib.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
add_library(macos_fw_lib SHARED
|
||||
${MACOS_FW_LIB_SRCS}
|
||||
${MACOS_FW_LIB_HDRS}
|
||||
)
|
||||
set_target_properties(macos_fw_lib PROPERTIES AUTOMOC TRUE)
|
||||
set_target_properties(macos_fw_lib PROPERTIES
|
||||
CLEAN_DIRECT_OUTPUT 1
|
||||
FRAMEWORK 1
|
||||
FRAMEWORK_VERSION ${MACOS_FW_LIB_VERSION}
|
||||
VERSION ${MACOS_FW_LIB_VERSION}
|
||||
SOVERSION ${MACOS_FW_LIB_VERSION}
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${MACOS_FW_LIB_VERSION}
|
||||
MACOSX_FRAMEWORK_IDENTIFIER org.macos.fw_lib
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
PUBLIC_HEADER "${MACOS_FW_LIB_HDRS}"
|
||||
)
|
||||
target_link_libraries(macos_fw_lib
|
||||
Qt5::Core
|
||||
)
|
17
Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp
Normal file
17
Tests/QtAutogen/macosFW/src/macos_fw_lib.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "macos_fw_lib.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QtGlobal>
|
||||
|
||||
MacosFWLib::MacosFWLib()
|
||||
{
|
||||
}
|
||||
|
||||
MacosFWLib::~MacosFWLib()
|
||||
{
|
||||
}
|
||||
|
||||
QString MacosFWLib::qtVersionString() const
|
||||
{
|
||||
return QString(qVersion());
|
||||
}
|
18
Tests/QtAutogen/macosFW/src/macos_fw_lib.h
Normal file
18
Tests/QtAutogen/macosFW/src/macos_fw_lib.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef MACOSFWLIB_H
|
||||
#define MACOSFWLIB_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class __attribute__((visibility("default"))) MacosFWLib : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MacosFWLib();
|
||||
~MacosFWLib();
|
||||
|
||||
QString qtVersionString() const;
|
||||
};
|
||||
|
||||
#endif // MACOSFWLIB_H
|
19
Tests/QtAutogen/macosFW/test/CMakeLists.txt
Normal file
19
Tests/QtAutogen/macosFW/test/CMakeLists.txt
Normal file
@ -0,0 +1,19 @@
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../src
|
||||
)
|
||||
include_directories(SYSTEM
|
||||
${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
set(testname AutomocMacosFWLib)
|
||||
add_executable(${testname} testMacosFWLib.cpp)
|
||||
set_target_properties(${testname} PROPERTIES AUTOMOC TRUE)
|
||||
target_link_libraries(${testname}
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
Qt5::Test
|
||||
macos_fw_lib
|
||||
)
|
42
Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp
Normal file
42
Tests/QtAutogen/macosFW/test/testMacosFWLib.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
#include "macos_fw_lib.h"
|
||||
#include "testMacosFWLib.h"
|
||||
|
||||
class TestMacosFWLib : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void initTestCase();
|
||||
void cleanupTestCase();
|
||||
void init() {}
|
||||
void cleanup() {}
|
||||
|
||||
void testQtVersion();
|
||||
};
|
||||
|
||||
void TestMacosFWLib::initTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
void TestMacosFWLib::cleanupTestCase()
|
||||
{
|
||||
}
|
||||
|
||||
void TestMacosFWLib::testQtVersion()
|
||||
{
|
||||
MacosFWLib* testLib = new MacosFWLib();
|
||||
QVERIFY(testLib->qtVersionString().contains("5."));
|
||||
testLib->deleteLater();
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
QApplication app(argc, argv, false);
|
||||
MacosFWLib testObject;
|
||||
return QTest::qExec(&testObject, argc, argv);
|
||||
}
|
||||
|
||||
#include "testMacosFWLib.moc"
|
7
Tests/QtAutogen/macosFW/test/testMacosFWLib.h
Normal file
7
Tests/QtAutogen/macosFW/test/testMacosFWLib.h
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef TESTMACOSFWLIB_H
|
||||
#define TESTMACOSFWLIB_H
|
||||
|
||||
#include "qapplication.h"
|
||||
#include <QtTest/QtTest>
|
||||
|
||||
#endif // TESTMACOSFWLIB_H
|
Loading…
Reference in New Issue
Block a user