Commit 0478314e authored by Brad King's avatar Brad King Committed by Kitware Robot

Merge topic 'QtAutogen_Contain'

c8a4147a QtAutogen: Release notes for the Contain branch
e1f571a9 QtAutogen: CMake-Qt documentation update
e324d704 QtAutogen: AUTOMOC documentation update
c2211703 QtAutogen: Tests: Don't use std::auto_ptr
2da0875f QtAutogen: Tests: Update ui_ include lookup directory
5961db41 QtAutogen: Tests: Increase minimum required CMake version
6d0a8af3 QtAutogen: Tests: Don't use std::auto_ptr
67310252 QtAutogen: Tests: Don't include CMAKE_CURRENT_BINARY_DIR
43d77e1d QtAutogen: Don't use std::i/ofstream::is_open()
98665c35 QtAutogen: Rename and sort variables
df74f3ff QtAutogen: Generate rcc output file names in one place only
bafbeaf1 QtAutogen: Add rcc output files to autogen target byproducts
8f437f3c QtAutogen: Add moc compilation file to autogen target byproducts
360c3427 QtAutogen: Reconfigure when .qrc file changes
b5409d04 QtAutogen: Rename autogen target to *_autogen from *_automoc
d9996aab QtAutogen: Inline single use variable definitions
...
parents b620772b c8a4147a
......@@ -22,12 +22,11 @@ Qt 4 and Qt 5 may be used together in the same
.. code-block:: cmake
cmake_minimum_required(VERSION 3.0.0 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8.0 FATAL_ERROR)
project(Qt4And5)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
find_package(Qt5 COMPONENTS Widgets DBus REQUIRED)
add_executable(publisher publisher.cpp)
......@@ -73,9 +72,12 @@ The ``moc`` command line will consume the :prop_tgt:`COMPILE_DEFINITIONS` and
:prop_tgt:`INCLUDE_DIRECTORIES` target properties from the target it is being
invoked for, and for the appropriate build configuration.
Generated ``moc_*.cpp`` and ``*.moc`` files are placed in the build directory
so it is convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR`
variable. The :prop_tgt:`AUTOMOC` target property may be pre-set for all
The generated ``moc_*.cpp`` and ``*.moc`` files are placed in the
``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which is
automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
(This differs from CMake 3.7 and below; see their documentation for details.)
The :prop_tgt:`AUTOMOC` target property may be pre-set for all
following targets by setting the :variable:`CMAKE_AUTOMOC` variable. The
:prop_tgt:`AUTOMOC_MOC_OPTIONS` target property may be populated to set
options to pass to ``moc``. The :variable:`CMAKE_AUTOMOC_MOC_OPTIONS`
......@@ -94,10 +96,13 @@ If a preprocessor ``#include`` directive is found which matches
``ui_<basename>.h``, and a ``<basename>.ui`` file exists, then ``uic`` will
be executed to generate the appropriate file.
Generated ``ui_*.h`` files are placed in the build directory so it is
convenient to set the :variable:`CMAKE_INCLUDE_CURRENT_DIR` variable. The
:prop_tgt:`AUTOUIC` target property may be pre-set for all following targets
by setting the :variable:`CMAKE_AUTOUIC` variable. The
The generated generated ``ui_*.h`` files are placed in the
``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which is
automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
(This differs from CMake 3.7 and below; see their documentation for details.)
The :prop_tgt:`AUTOUIC` target property may be pre-set for all following
targets by setting the :variable:`CMAKE_AUTOUIC` variable. The
:prop_tgt:`AUTOUIC_OPTIONS` target property may be populated to set options
to pass to ``uic``. The :variable:`CMAKE_AUTOUIC_OPTIONS` variable may be
populated to pre-set the options for all following targets. The
......
AUTOGEN_TARGETS_FOLDER
----------------------
Name of :prop_tgt:`FOLDER` for ``*_automoc`` targets that are added automatically by
Name of :prop_tgt:`FOLDER` for ``*_autogen`` targets that are added automatically by
CMake for targets for which :prop_tgt:`AUTOMOC` is enabled.
If not set, CMake uses the :prop_tgt:`FOLDER` property of the parent target as a
......
AUTOMOC_TARGETS_FOLDER
----------------------
Name of :prop_tgt:`FOLDER` for ``*_automoc`` targets that are added automatically by
Name of :prop_tgt:`FOLDER` for ``*_autogen`` targets that are added automatically by
CMake for targets for which :prop_tgt:`AUTOMOC` is enabled.
This property is obsolete. Use :prop_gbl:`AUTOGEN_TARGETS_FOLDER` instead.
......
AUTOGEN_TARGET_DEPENDS
----------------------
Target dependencies of the corresponding ``_automoc`` target.
Target dependencies of the corresponding ``_autogen`` target.
Targets which have their :prop_tgt:`AUTOMOC` target ``ON`` have a
corresponding ``_automoc`` target which is used to autogenerate generate moc
files. As this ``_automoc`` target is created at generate-time, it is not
corresponding ``_autogen`` target which is used to autogenerate generate moc
files. As this ``_autogen`` target is created at generate-time, it is not
possible to define dependencies of it, such as to create inputs for the ``moc``
executable.
The ``AUTOGEN_TARGET_DEPENDS`` target property can be set instead to a list of
dependencies for the ``_automoc`` target. The buildsystem will be generated to
dependencies for the ``_autogen`` target. The buildsystem will be generated to
depend on its contents.
See the :manual:`cmake-qt(7)` manual for more information on using CMake
......
......@@ -15,11 +15,12 @@ source files at build time and invoke moc accordingly.
the ``Q_OBJECT`` class declaration is expected in the header, and
``moc`` is run on the header file. A ``moc_foo.cpp`` file will be
generated from the source's header into the
:variable:`CMAKE_CURRENT_BINARY_DIR` directory. This allows the
compiler to find the included ``moc_foo.cpp`` file regardless of the
location the original source. However, if multiple source files
in different directories do this then their generated moc files would
collide. In this case a diagnostic will be issued.
``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include``
directory which is automatically added to the target's
:prop_tgt:`INCLUDE_DIRECTORIES`. This allows the compiler to find the
included ``moc_foo.cpp`` file regardless of the location the original source.
However, if multiple source files in different directories do this then their
generated moc files would collide. In this case a diagnostic will be issued.
* If an ``#include`` statement like ``#include "foo.moc"`` is found,
then a ``Q_OBJECT`` is expected in the current source file and ``moc``
......@@ -30,7 +31,7 @@ source files at build time and invoke moc accordingly.
alternative extensions, such as ``hpp``, ``hxx`` etc when searching
for headers. The resulting moc files, which are not included as shown
above in any of the source files are included in a generated
``<targetname>_automoc.cpp`` file, which is compiled as part of the
``moc_compilation.cpp`` file, which is compiled as part of the
target.
This property is initialized by the value of the :variable:`CMAKE_AUTOMOC`
......
QtAutogen_Contain
-----------------
* When using AUTOMOC or AUTOUIC, generated
``moc_*``, ``*.moc`` and ``ui_*`` are placed in the
``<CMAKE_CURRENT_BINARY_DIR>/<TARGETNAME>_autogen/include`` directory which
is automatically added to the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
It is therefore not necessary anymore to have
:variable:`CMAKE_CURRENT_BINARY_DIR` in the target's
:prop_tgt:`INCLUDE_DIRECTORIES`.
set(AM_SOURCES @_cpp_files@ )
set(AM_RCC_SOURCES @_rcc_files@ )
set(AM_RCC_INPUTS @_qt_rcc_inputs@)
set(AM_SKIP_MOC @_skip_moc@ )
set(AM_SKIP_UIC @_skip_uic@ )
set(AM_HEADERS @_moc_headers@ )
set(AM_MOC_COMPILE_DEFINITIONS @_moc_compile_defs@)
set(AM_MOC_INCLUDES @_moc_incs@)
set(AM_MOC_OPTIONS @_moc_options@)
set(AM_MOC_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
......@@ -18,9 +17,10 @@ set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_QT_VERSION_MAJOR "@_target_qt_version@")
set(AM_TARGET_NAME @_moc_target_name@)
set(AM_ORIGIN_TARGET_NAME @_origin_target_name@)
set(AM_RELAXED_MODE "@_moc_relaxed_mode@")
set(AM_UIC_TARGET_OPTIONS @_uic_target_options@)
set(AM_UIC_OPTIONS_FILES @_qt_uic_options_files@)
set(AM_UIC_OPTIONS_OPTIONS @_qt_uic_options_options@)
set(AM_RCC_OPTIONS_FILES @_qt_rcc_options_files@)
set(AM_RCC_OPTIONS_OPTIONS @_qt_rcc_options_options@)
set(AM_RCC_SOURCES @_rcc_files@ )
set(AM_RCC_INPUTS @_rcc_inputs@)
set(AM_RCC_OPTIONS_FILES @_rcc_options_files@)
set(AM_RCC_OPTIONS_OPTIONS @_rcc_options_options@)
......@@ -243,8 +243,8 @@ set(SRCS
cmFileLockPool.h
cmFileLockResult.cxx
cmFileLockResult.h
cmFilePathUuid.cxx
cmFilePathUuid.h
cmFilePathChecksum.cxx
cmFilePathChecksum.h
cmFileTimeComparison.cxx
cmFileTimeComparison.h
cmFortranLexer.cxx
......
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFilePathChecksum.h"
#include "cmBase32.h"
#include "cmCryptoHash.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include <vector>
cmFilePathChecksum::cmFilePathChecksum()
{
}
cmFilePathChecksum::cmFilePathChecksum(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir)
{
setupParentDirs(currentSrcDir, currentBinDir, projectSrcDir, projectBinDir);
}
cmFilePathChecksum::cmFilePathChecksum(cmMakefile* makefile)
{
setupParentDirs(makefile->GetCurrentSourceDirectory(),
makefile->GetCurrentBinaryDirectory(),
makefile->GetHomeDirectory(),
makefile->GetHomeOutputDirectory());
}
void cmFilePathChecksum::setupParentDirs(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir)
{
parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
parentDirs[0].second = "CurrentSource";
parentDirs[1].second = "CurrentBinary";
parentDirs[2].second = "ProjectSource";
parentDirs[3].second = "ProjectBinary";
}
std::string cmFilePathChecksum::get(const std::string& filePath)
{
std::string relPath;
std::string relSeed;
{
const std::string fileReal = cmsys::SystemTools::GetRealPath(filePath);
std::string parentDir;
// Find closest project parent directory
for (size_t ii = 0; ii != numParentDirs; ++ii) {
const std::string& pDir = parentDirs[ii].first;
if (!pDir.empty() &&
cmsys::SystemTools::IsSubDirectory(fileReal, pDir)) {
relSeed = parentDirs[ii].second;
parentDir = pDir;
break;
}
}
// Use file system root as fallback parent directory
if (parentDir.empty()) {
relSeed = "FileSystemRoot";
cmsys::SystemTools::SplitPathRootComponent(fileReal, &parentDir);
}
// Calculate relative path from project parent directory
relPath = cmsys::SystemTools::RelativePath(
parentDir, cmsys::SystemTools::GetParentDirectory(fileReal));
}
// Calculate the file ( seed + relative path ) binary checksum
std::vector<unsigned char> hashBytes =
cmCryptoHash(cmCryptoHash::AlgoSHA256).ByteHashString(relSeed + relPath);
// Convert binary checksum to string
return cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(),
false);
}
std::string cmFilePathChecksum::getPart(const std::string& filePath,
size_t length)
{
return get(filePath).substr(0, length);
}
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmFilePathUuid_h
#define cmFilePathUuid_h
#ifndef cmFilePathChecksum_h
#define cmFilePathChecksum_h
#include <cmConfigure.h> // IWYU pragma: keep
......@@ -11,55 +11,51 @@
class cmMakefile;
/** \class cmFilePathUuid
* @brief Generates a unique pathless file name with a checksum component
* calculated from the file path.
/** \class cmFilePathChecksum
* @brief Generates a checksum for the parent directory of a file
*
* The checksum is calculated from the relative file path to the
* closest known project directory. This guarantees reproducibility
* when source and build directory differ e.g. for different project
* build directories.
*/
class cmFilePathUuid
class cmFilePathChecksum
{
public:
/// Maximum number of characters to use from the file name
static const size_t partLengthName = 14;
/// Maximum number of characters to use from the path checksum
static const size_t partLengthCheckSum = 14;
static const size_t partLengthDefault = 10;
/// @brief Initilizes the parent directories from a makefile
cmFilePathUuid(cmMakefile* makefile);
/// @brief Parent directories are empty
cmFilePathChecksum();
/// @brief Initilizes the parent directories manually
cmFilePathUuid(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir);
cmFilePathChecksum(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir);
/* @brief Calculates and returns the uuid for a file path
*
* @arg outputPrefix optional string to prepend to the result
* @arg outputSuffix optional string to append to the result
*/
std::string get(const std::string& filePath,
const char* outputPrefix = CM_NULLPTR,
const char* outputSuffix = CM_NULLPTR);
/// @brief Initilizes the parent directories from a makefile
cmFilePathChecksum(cmMakefile* makefile);
private:
void initParentDirs(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir);
/// @brief Allows parent directories setup after construction
///
void setupParentDirs(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir);
/// Returns the relative path and the parent directory key string (seed)
void GetRelPathSeed(const std::string& filePath, std::string& sourceRelPath,
std::string& sourceRelSeed);
/* @brief Calculates the path checksum for the parent directory of a file
*
*/
std::string get(const std::string& filePath);
std::string GetChecksumString(const std::string& sourceFilename,
const std::string& sourceRelPath,
const std::string& sourceRelSeed);
/* @brief Same as get() but returns only the first length characters
*
*/
std::string getPart(const std::string& filePath,
size_t length = partLengthDefault);
private:
/// Size of the parent directory list
static const size_t numParentDirs = 4;
/// List of (directory name, seed name) pairs
......
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmFilePathUuid.h"
#include "cmBase32.h"
#include "cmCryptoHash.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include <vector>
cmFilePathUuid::cmFilePathUuid(cmMakefile* makefile)
{
initParentDirs(makefile->GetCurrentSourceDirectory(),
makefile->GetCurrentBinaryDirectory(),
makefile->GetHomeDirectory(),
makefile->GetHomeOutputDirectory());
}
cmFilePathUuid::cmFilePathUuid(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir)
{
initParentDirs(currentSrcDir, currentBinDir, projectSrcDir, projectBinDir);
}
void cmFilePathUuid::initParentDirs(const std::string& currentSrcDir,
const std::string& currentBinDir,
const std::string& projectSrcDir,
const std::string& projectBinDir)
{
parentDirs[0].first = cmsys::SystemTools::GetRealPath(currentSrcDir);
parentDirs[1].first = cmsys::SystemTools::GetRealPath(currentBinDir);
parentDirs[2].first = cmsys::SystemTools::GetRealPath(projectSrcDir);
parentDirs[3].first = cmsys::SystemTools::GetRealPath(projectBinDir);
parentDirs[0].second = "CurrentSource";
parentDirs[1].second = "CurrentBinary";
parentDirs[2].second = "ProjectSource";
parentDirs[3].second = "ProjectBinary";
}
std::string cmFilePathUuid::get(const std::string& filePath,
const char* outputPrefix,
const char* outputSuffix)
{
std::string sourceFilename = cmsys::SystemTools::GetFilenameName(filePath);
std::string sourceBasename =
cmsys::SystemTools::GetFilenameWithoutLastExtension(sourceFilename);
// Acquire checksum string
std::string checksum;
{
std::string sourceRelPath;
std::string sourceRelSeed;
GetRelPathSeed(filePath, sourceRelPath, sourceRelSeed);
checksum = GetChecksumString(sourceFilename, sourceRelPath, sourceRelSeed);
}
// Compose the file name
std::string uuid;
if (outputPrefix) {
uuid += outputPrefix;
}
uuid += sourceBasename.substr(0, partLengthName);
uuid += "_";
uuid += checksum.substr(0, partLengthCheckSum);
if (outputSuffix) {
uuid += outputSuffix;
}
return uuid;
}
void cmFilePathUuid::GetRelPathSeed(const std::string& filePath,
std::string& sourceRelPath,
std::string& sourceRelSeed)
{
const std::string sourceNameReal = cmsys::SystemTools::GetRealPath(filePath);
std::string parentDirectory;
// Find closest project parent directory
for (size_t ii = 0; ii != numParentDirs; ++ii) {
const std::string& pDir = parentDirs[ii].first;
if (!pDir.empty() &&
cmsys::SystemTools::IsSubDirectory(sourceNameReal, pDir)) {
sourceRelSeed = parentDirs[ii].second;
parentDirectory = pDir;
break;
}
}
// Check if the file path is below a known project directory
if (parentDirectory.empty()) {
// Use file syste root as fallback parent directory
sourceRelSeed = "FileSystemRoot";
cmsys::SystemTools::SplitPathRootComponent(sourceNameReal,
&parentDirectory);
}
sourceRelPath = cmsys::SystemTools::RelativePath(
parentDirectory, cmsys::SystemTools::GetParentDirectory(sourceNameReal));
}
std::string cmFilePathUuid::GetChecksumString(
const std::string& sourceFilename, const std::string& sourceRelPath,
const std::string& sourceRelSeed)
{
std::string checksumBase32;
{
// Calculate the file ( seed + relative path + name ) checksum
std::vector<unsigned char> hashBytes =
cmCryptoHash(cmCryptoHash::AlgoSHA256)
.ByteHashString(sourceRelSeed + sourceRelPath + sourceFilename);
checksumBase32 =
cmBase32Encoder().encodeString(&hashBytes[0], hashBytes.size(), false);
}
return checksumBase32;
}
......@@ -533,6 +533,21 @@ void cmGeneratorTarget::AddTracedSources(std::vector<std::string> const& srcs)
}
}
void cmGeneratorTarget::AddIncludeDirectory(const std::string& src,
bool before)
{
this->Target->InsertInclude(src, this->Makefile->GetBacktrace(), before);
cmListFileBacktrace lfbt = this->Makefile->GetBacktrace();
cmGeneratorExpression ge(lfbt);
CM_AUTO_PTR<cmCompiledGeneratorExpression> cge = ge.Parse(src);
cge->SetEvaluateForBuildsystem(true);
// Insert before begin/end
std::vector<TargetPropertyEntry*>::iterator pos = before
? this->IncludeDirectoriesEntries.begin()
: this->IncludeDirectoriesEntries.end();
this->IncludeDirectoriesEntries.insert(pos, new TargetPropertyEntry(cge));
}
std::vector<cmSourceFile*> const* cmGeneratorTarget::GetSourceDepends(
cmSourceFile const* sf) const
{
......
......@@ -395,6 +395,12 @@ public:
void AddSource(const std::string& src);
void AddTracedSources(std::vector<std::string> const& srcs);
/**
* Adds an entry to the INCLUDE_DIRECTORIES list.
* If before is true the entry is pushed at the front.
*/
void AddIncludeDirectory(const std::string& src, bool before = false);
/**
* Flags for a given source file as used in this target. Typically assigned
* via SET_TARGET_PROPERTIES when the property is a list of source files.
......
This diff is collapsed.
This diff is collapsed.
......@@ -4,6 +4,7 @@
#define cmQtAutoGenerators_h
#include <cmConfigure.h> // IWYU pragma: keep
#include <cmFilePathChecksum.h>
#include <list>
#include <map>
......@@ -23,32 +24,36 @@ private:
bool ReadAutogenInfoFile(cmMakefile* makefile,
const std::string& targetDirectory,
const std::string& config);
bool ReadOldMocDefinitionsFile(cmMakefile* makefile,
void ReadOldMocDefinitionsFile(cmMakefile* makefile,
const std::string& targetDirectory);
void WriteOldMocDefinitionsFile(const std::string& targetDirectory);
bool WriteOldMocDefinitionsFile(const std::string& targetDirectory);
std::string MakeCompileSettingsString(cmMakefile* makefile);
bool RunAutogen(cmMakefile* makefile);
bool GenerateMocFiles(
const std::map<std::string, std::string>& includedMocs,
const std::map<std::string, std::string>& notIncludedMocs);
bool GenerateMoc(const std::string& sourceFile,
const std::string& mocFileName);
const std::string& mocFileName,
const std::string& subDirPrefix);
bool GenerateUiFiles(
const std::map<std::string, std::vector<std::string> >& includedUis);
bool GenerateUi(const std::string& realName, const std::string& uiInputFile,
const std::string& uiOutputFile);
bool GenerateQrcFiles();
bool GenerateQrc(const std::string& qrcInputFile,
const std::string& qrcOutputFile, bool unique_n);
void ParseCppFile(
bool ParseCppFile(
const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,
std::map<std::string, std::vector<std::string> >& includedUis);
void StrictParseCppFile(
bool StrictParseCppFile(
const std::string& absFilename,
const std::vector<std::string>& headerExtensions,
std::map<std::string, std::string>& includedMocs,
......@@ -76,13 +81,18 @@ private:
bool NameCollisionTest(const std::map<std::string, std::string>& genFiles,
std::multimap<std::string, std::string>& collisions);
void NameCollisionLog(
void LogErrorNameCollision(
const std::string& message,
const std::multimap<std::string, std::string>& collisions);
void LogBold(const std::string& message);
void LogInfo(const std::string& message);
void LogWarning(const std::string& message);
void LogError(const std::string& message);
void LogCommand(const std::vector<std::string>& command);
bool makeParentDirectory(const std::string& filename);
std::string JoinExts(const std::vector<std::string>& lst);
static void MergeUicOptions(std::vector<std::string>& opts,
......@@ -92,39 +102,47 @@ private:
bool InputFilesNewerThanQrc(const std::string& qrcFile,
const std::string& rccOutput);
// - Target names
std::string OriginTargetName;
std::string AutogenTargetName;
// - Directories
std::string ProjectSourceDir;
std::string ProjectBinaryDir;
std::string CurrentSourceDir;
std::string CurrentBinaryDir;
std::string AutogenBuildSubDir;
// - Qt environment
std::string QtMajorVersion;
std::string Sources;
std::vector<std::string> RccSources;
std::string SkipMoc;
std::string SkipUic;
std::string Headers;
std::string Srcdir;
std::string Builddir;
std::string MocExecutable;
std::string UicExecutable;
std::string RccExecutable;
// - File lists
std::string Sources;
std::string Headers;
// - Moc
std::string SkipMoc;
std::string MocCompileDefinitionsStr;
std::string MocIncludesStr;
std::string MocOptionsStr;
std::string ProjectBinaryDir;
std::string ProjectSourceDir;
std::string TargetName;
std::string OriginTargetName;
std::string CurrentCompileSettingsStr;
std::string OldCompileSettingsStr;
std::string TargetBuildSubDir;
std::string OutMocCppFilenameRel;
std::string OutMocCppFilenameAbs;
std::list<std::string> MocIncludes;
std::list<std::string> MocDefinitions;
std::vector<std::string> MocOptions;
// - Uic
std::string SkipUic;
std::vector<std::string> UicTargetOptions;
std::map<std::string, std::string> UicOptions;
// - Rcc
std::vector<std::string> RccSources;
std::map<std::string, std::string> RccOptions;
std::map<std::string, std::vector<std::string> > RccInputs;
// - Settings
std::string CurrentCompileSettingsStr;
std::string OldCompileSettingsStr;
// - Utility
cmFilePathChecksum fpathCheckSum;
// - Flags
bool IncludeProjectDirsBefore;
bool Verbose;
bool ColorOutput;
......@@ -132,7 +150,7 @@ private:
bool RunUicFailed;
bool RunRccFailed;
bool GenerateAll;
bool RelaxedMode;
bool MocRelaxedMode;
};
#endif
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.7)
project(QtAutoUicInterface)
......@@ -21,7 +21,6 @@ else()
endif()
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
......@@ -65,6 +64,6 @@ target_link_libraries(MyWidget KI18n ${QT_GUI_TARGET})
add_executable(QtAutoUicInterface main.cpp)
target_compile_definitions(QtAutoUicInterface
PRIVATE
UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_libwidget.h"
UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/ui_mywidget.h"
UI_LIBWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/LibWidget_autogen/include/ui_libwidget.h"
UI_MYWIDGET_H="${CMAKE_CURRENT_BINARY_DIR}/MyWidget_autogen/include/ui_mywidget.h"
)
......@@ -7,3 +7,8 @@ LibWidget::LibWidget(QWidget* parent)
{
ui->setupUi(this);
}
LibWidget::~LibWidget()
{
delete ui;
}
......@@ -16,9 +16,10 @@ class LibWidget : public QWidget
Q_OBJECT
public:
explicit LibWidget(QWidget* parent = 0);
~LibWidget();
private:
const std::auto_ptr<Ui::LibWidget> ui;
Ui::LibWidget* ui;
};
#endif
......@@ -7,3 +7,8 @@ MyWidget::MyWidget(QWidget* parent)
{
ui->setupUi(this);
}
MyWidget::~MyWidget()
{
delete ui;
}
......@@ -16,9 +16,10 @@ class MyWidget : public QWidget
Q_OBJECT
public:
explicit MyWidget(QWidget* parent = 0);
~MyWidget();
private:
const std::auto_ptr<Ui::MyWidget> ui;
Ui::MyWidget* ui;
};
#endif
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.