Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Libor Bukata
CMake
Commits
0965002e
Commit
0965002e
authored
May 15, 2017
by
Sebastian Holtermann
Browse files
Autogen: Pass build directory in Info file
parent
83e4a8e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Modules/AutogenInfo.cmake.in
View file @
0965002e
...
...
@@ -7,6 +7,7 @@ set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
set(AM_BUILD_DIR @_autogen_build_dir@)
set(AM_SOURCES @_sources@)
set(AM_HEADERS @_headers@)
# Qt environment
...
...
Source/cmQtAutoGeneratorInitializer.cxx
View file @
0965002e
...
...
@@ -67,7 +67,7 @@ static std::string GetAutogenTargetFilesDir(cmGeneratorTarget const* target)
targetDir
+=
makefile
->
GetCMakeInstance
()
->
GetCMakeFilesDirectory
();
targetDir
+=
"/"
;
targetDir
+=
GetAutogenTargetName
(
target
);
targetDir
+=
".dir
/
"
;
targetDir
+=
".dir"
;
return
targetDir
;
}
...
...
@@ -77,7 +77,6 @@ static std::string GetAutogenTargetBuildDir(cmGeneratorTarget const* target)
std
::
string
targetDir
=
makefile
->
GetCurrentBinaryDirectory
();
targetDir
+=
"/"
;
targetDir
+=
GetAutogenTargetName
(
target
);
targetDir
+=
"/"
;
return
targetDir
;
}
...
...
@@ -624,7 +623,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
if
(
target
->
GetPropertyAsBool
(
"AUTOMOC"
))
{
cmMakefile
*
makefile
=
target
->
Target
->
GetMakefile
();
std
::
string
mocCppFile
=
GetAutogenTargetBuildDir
(
target
);
mocCppFile
+=
"moc_compilation.cpp"
;
mocCppFile
+=
"
/
moc_compilation.cpp"
;
{
cmSourceFile
*
gFile
=
makefile
->
GetOrCreateSource
(
mocCppFile
,
true
);
gFile
->
SetProperty
(
"SKIP_AUTOGEN"
,
"On"
);
...
...
@@ -706,14 +705,14 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Create autogen target includes directory and
// add it to the origin target INCLUDE_DIRECTORIES
if
(
mocEnabled
||
uicEnabled
)
{
const
std
::
string
incsDir
=
autogenBuildDir
+
"include"
;
const
std
::
string
incsDir
=
autogenBuildDir
+
"
/
include"
;
cmSystemTools
::
MakeDirectory
(
incsDir
);
target
->
AddIncludeDirectory
(
incsDir
,
true
);
}
// Register moc compilation file as generated
if
(
mocEnabled
)
{
autogenProvides
.
push_back
(
autogenBuildDir
+
"moc_compilation.cpp"
);
autogenProvides
.
push_back
(
autogenBuildDir
+
"
/
moc_compilation.cpp"
);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
...
...
@@ -785,6 +784,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Compose rcc output file name
{
std
::
string
rccOut
=
autogenBuildDir
;
rccOut
+=
"/"
;
rccOut
+=
fpathCheckSum
.
getPart
(
absFile
);
rccOut
+=
"/qrc_"
;
rccOut
+=
...
...
@@ -919,6 +919,8 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
}
}
AddDefinitionEscaped
(
makefile
,
"_autogen_build_dir"
,
GetAutogenTargetBuildDir
(
target
));
AddDefinitionEscaped
(
makefile
,
"_autogen_target_name"
,
autogenTargetName
);
AddDefinitionEscaped
(
makefile
,
"_origin_target_name"
,
target
->
GetName
());
AddDefinitionEscaped
(
makefile
,
"_qt_version_major"
,
qtMajorVersion
);
...
...
Source/cmQtAutoGenerators.cxx
View file @
0965002e
...
...
@@ -372,6 +372,7 @@ bool cmQtAutoGenerators::ReadAutogenInfoFile(
InfoGet
(
makefile
,
"AM_CMAKE_CURRENT_BINARY_DIR"
,
this
->
CurrentBinaryDir
);
InfoGet
(
makefile
,
"AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE"
,
this
->
IncludeProjectDirsBefore
);
InfoGet
(
makefile
,
"AM_BUILD_DIR"
,
this
->
AutogenBuildDir
);
InfoGet
(
makefile
,
"AM_SOURCES"
,
this
->
Sources
);
InfoGet
(
makefile
,
"AM_HEADERS"
,
this
->
Headers
);
...
...
@@ -615,18 +616,15 @@ bool cmQtAutoGenerators::SettingsFileWrite()
void
cmQtAutoGenerators
::
Init
(
cmMakefile
*
makefile
)
{
this
->
AutogenBuildSubDir
=
this
->
AutogenTargetName
;
this
->
AutogenBuildSubDir
+=
"/"
;
this
->
MocCppFilenameRel
=
this
->
AutogenBuildSubDir
;
this
->
MocCppFilenameRel
+=
"moc_compilation.cpp"
;
this
->
MocCppFilenameAbs
=
this
->
CurrentBinaryDir
+
this
->
MocCppFilenameRel
;
this
->
MocCppFilenameRel
=
"moc_compilation.cpp"
;
this
->
MocCppFilenameAbs
=
cmSystemTools
::
CollapseCombinedPath
(
this
->
AutogenBuildDir
,
this
->
MocCppFilenameRel
);
// Moc predefs file
if
(
!
this
->
MocPredefsCmd
.
empty
())
{
this
->
MocPredefsFileRel
=
this
->
AutogenBuildSubDir
+
"moc_predefs.h"
;
this
->
MocPredefsFileAbs
=
this
->
CurrentBinaryDir
+
this
->
MocPredefsFileRel
;
this
->
MocPredefsFileRel
=
"moc_predefs.h"
;
this
->
MocPredefsFileAbs
=
cmSystemTools
::
CollapseCombinedPath
(
this
->
AutogenBuildDir
,
this
->
MocPredefsFileRel
);
}
// Init file path checksum generator
...
...
@@ -1335,8 +1333,9 @@ bool cmQtAutoGenerators::MocGenerateFile(
bool
generateMoc
=
this
->
MocSettingsChanged
||
this
->
MocPredefsChanged
;
const
std
::
string
mocFileRel
=
this
->
AutogenBuildSubDir
+
subDir
+
mocFileName
;
const
std
::
string
mocFileAbs
=
this
->
CurrentBinaryDir
+
mocFileRel
;
cmSystemTools
::
CollapseCombinedPath
(
subDir
,
mocFileName
);
const
std
::
string
mocFileAbs
=
cmSystemTools
::
CollapseCombinedPath
(
this
->
AutogenBuildDir
,
mocFileRel
);
if
(
!
generateMoc
)
{
// Test if the source file is newer that the build file
...
...
@@ -1525,8 +1524,9 @@ bool cmQtAutoGenerators::UicGenerateFile(const std::string& realName,
bool
generateUic
=
this
->
UicSettingsChanged
;
const
std
::
string
uicFileRel
=
this
->
AutogenBuildSubDir
+
"include/"
+
uiOutputFile
;
const
std
::
string
uicFileAbs
=
this
->
CurrentBinaryDir
+
uicFileRel
;
cmSystemTools
::
CollapseCombinedPath
(
"include"
,
uiOutputFile
);
const
std
::
string
uicFileAbs
=
cmSystemTools
::
CollapseCombinedPath
(
this
->
AutogenBuildDir
,
uicFileRel
);
if
(
!
generateUic
)
{
// Test if the source file is newer that the build file
...
...
@@ -1594,8 +1594,7 @@ bool cmQtAutoGenerators::RccGenerateAll()
si
!=
this
->
RccSources
.
end
();
++
si
)
{
const
std
::
string
ext
=
cmsys
::
SystemTools
::
GetFilenameLastExtension
(
*
si
);
if
(
ext
==
".qrc"
)
{
qrcGenMap
[
*
si
]
=
this
->
AutogenBuildSubDir
+
this
->
ChecksumedPath
(
*
si
,
"qrc_"
,
".cpp"
);
qrcGenMap
[
*
si
]
=
this
->
ChecksumedPath
(
*
si
,
"qrc_"
,
".cpp"
);
}
}
...
...
@@ -1636,7 +1635,8 @@ bool cmQtAutoGenerators::RccGenerateFile(const std::string& rccInputFile,
bool
rccGenerated
=
false
;
bool
generateRcc
=
this
->
RccSettingsChanged
;
const
std
::
string
rccBuildFile
=
this
->
CurrentBinaryDir
+
rccOutputFile
;
const
std
::
string
rccBuildFile
=
cmSystemTools
::
CollapseCombinedPath
(
this
->
AutogenBuildDir
,
rccOutputFile
);
if
(
!
generateRcc
)
{
// Test if the resources list file is newer than build file
...
...
Source/cmQtAutoGenerators.h
View file @
0965002e
...
...
@@ -165,7 +165,7 @@ private:
std
::
string
ProjectBinaryDir
;
std
::
string
CurrentSourceDir
;
std
::
string
CurrentBinaryDir
;
std
::
string
AutogenBuild
Sub
Dir
;
std
::
string
AutogenBuildDir
;
// -- Qt environment
std
::
string
QtMajorVersion
;
std
::
string
MocExecutable
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment