Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
CMake
CMake
Commits
2f51f281
Commit
2f51f281
authored
Feb 14, 2019
by
Brad King
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'fortran-submodule-names' into release-3.14
Merge-request:
!2958
parents
9f351b93
d80ecba5
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
91 additions
and
11 deletions
+91
-11
Modules/Compiler/Flang-Fortran.cmake
Modules/Compiler/Flang-Fortran.cmake
+3
-0
Modules/Compiler/GNU-Fortran.cmake
Modules/Compiler/GNU-Fortran.cmake
+3
-0
Modules/Compiler/Intel-Fortran.cmake
Modules/Compiler/Intel-Fortran.cmake
+3
-0
Modules/Compiler/PGI-Fortran.cmake
Modules/Compiler/PGI-Fortran.cmake
+3
-0
Modules/Compiler/XL-Fortran.cmake
Modules/Compiler/XL-Fortran.cmake
+3
-0
Source/cmDependsFortran.cxx
Source/cmDependsFortran.cxx
+10
-1
Source/cmDependsFortran.h
Source/cmDependsFortran.h
+4
-0
Source/cmFortranParser.h
Source/cmFortranParser.h
+15
-1
Source/cmFortranParserImpl.cxx
Source/cmFortranParserImpl.cxx
+21
-8
Source/cmGlobalNinjaGenerator.cxx
Source/cmGlobalNinjaGenerator.cxx
+11
-1
Source/cmLocalUnixMakefileGenerator3.cxx
Source/cmLocalUnixMakefileGenerator3.cxx
+11
-0
Source/cmNinjaTargetGenerator.cxx
Source/cmNinjaTargetGenerator.cxx
+4
-0
No files found.
Modules/Compiler/Flang-Fortran.cmake
View file @
2f51f281
include
(
Compiler/Clang
)
__compiler_clang
(
Fortran
)
set
(
CMAKE_Fortran_SUBMODULE_SEP
"-"
)
set
(
CMAKE_Fortran_SUBMODULE_EXT
".mod"
)
set
(
CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>"
)
...
...
Modules/Compiler/GNU-Fortran.cmake
View file @
2f51f281
include
(
Compiler/GNU
)
__compiler_gnu
(
Fortran
)
set
(
CMAKE_Fortran_SUBMODULE_SEP
"@"
)
set
(
CMAKE_Fortran_SUBMODULE_EXT
".smod"
)
set
(
CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -cpp <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> -o <PREPROCESSED_SOURCE>"
)
...
...
Modules/Compiler/Intel-Fortran.cmake
View file @
2f51f281
include
(
Compiler/Intel
)
__compiler_intel
(
Fortran
)
set
(
CMAKE_Fortran_SUBMODULE_SEP
"@"
)
set
(
CMAKE_Fortran_SUBMODULE_EXT
".smod"
)
set
(
CMAKE_Fortran_MODDIR_FLAG
"-module "
)
set
(
CMAKE_Fortran_FORMAT_FIXED_FLAG
"-fixed"
)
set
(
CMAKE_Fortran_FORMAT_FREE_FLAG
"-free"
)
...
...
Modules/Compiler/PGI-Fortran.cmake
View file @
2f51f281
include
(
Compiler/PGI
)
__compiler_pgi
(
Fortran
)
set
(
CMAKE_Fortran_SUBMODULE_SEP
"-"
)
set
(
CMAKE_Fortran_SUBMODULE_EXT
".mod"
)
set
(
CMAKE_Fortran_PREPROCESS_SOURCE
"<CMAKE_Fortran_COMPILER> -Mpreprocess <DEFINES> <INCLUDES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>"
)
...
...
Modules/Compiler/XL-Fortran.cmake
View file @
2f51f281
include
(
Compiler/XL
)
__compiler_xl
(
Fortran
)
set
(
CMAKE_Fortran_SUBMODULE_SEP
"_"
)
set
(
CMAKE_Fortran_SUBMODULE_EXT
".smod"
)
set
(
CMAKE_Fortran_FORMAT_FIXED_FLAG
"-qfixed"
)
# [=<right_margin>]
set
(
CMAKE_Fortran_FORMAT_FREE_FLAG
"-qfree"
)
# [=f90|ibm]
...
...
Source/cmDependsFortran.cxx
View file @
2f51f281
...
...
@@ -94,6 +94,10 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg)
}
this
->
PPDefinitions
.
insert
(
def
);
}
this
->
CompilerId
=
mf
->
GetSafeDefinition
(
"CMAKE_Fortran_COMPILER_ID"
);
this
->
SModSep
=
mf
->
GetSafeDefinition
(
"CMAKE_Fortran_SUBMODULE_SEP"
);
this
->
SModExt
=
mf
->
GetSafeDefinition
(
"CMAKE_Fortran_SUBMODULE_EXT"
);
}
cmDependsFortran
::~
cmDependsFortran
()
...
...
@@ -116,6 +120,11 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources,
return
false
;
}
cmFortranCompiler
fc
;
fc
.
Id
=
this
->
CompilerId
;
fc
.
SModSep
=
this
->
SModSep
;
fc
.
SModExt
=
this
->
SModExt
;
bool
okay
=
true
;
for
(
std
::
string
const
&
src
:
sources
)
{
// Get the information object for this source.
...
...
@@ -123,7 +132,7 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources,
// Create the parser object. The constructor takes info by reference,
// so we may look into the resulting objects later.
cmFortranParser
parser
(
this
->
IncludePath
,
this
->
PPDefinitions
,
info
);
cmFortranParser
parser
(
fc
,
this
->
IncludePath
,
this
->
PPDefinitions
,
info
);
// Push on the starting file.
cmFortranParser_FilePush
(
&
parser
,
src
.
c_str
());
...
...
Source/cmDependsFortran.h
View file @
2f51f281
...
...
@@ -77,6 +77,10 @@ protected:
// The source file from which to start scanning.
std
::
string
SourceFile
;
std
::
string
CompilerId
;
std
::
string
SModSep
;
std
::
string
SModExt
;
std
::
set
<
std
::
string
>
PPDefinitions
;
// Internal implementation details.
...
...
Source/cmFortranParser.h
View file @
2f51f281
...
...
@@ -128,15 +128,29 @@ struct cmFortranFile
bool
LastCharWasNewline
;
};
struct
cmFortranCompiler
{
std
::
string
Id
;
std
::
string
SModSep
;
std
::
string
SModExt
;
};
struct
cmFortranParser_s
{
cmFortranParser_s
(
std
::
vector
<
std
::
string
>
includes
,
cmFortranParser_s
(
cmFortranCompiler
fc
,
std
::
vector
<
std
::
string
>
includes
,
std
::
set
<
std
::
string
>
defines
,
cmFortranSourceInfo
&
info
);
~
cmFortranParser_s
();
bool
FindIncludeFile
(
const
char
*
dir
,
const
char
*
includeName
,
std
::
string
&
fileName
);
std
::
string
ModName
(
std
::
string
const
&
mod_name
)
const
;
std
::
string
SModName
(
std
::
string
const
&
mod_name
,
std
::
string
const
&
sub_name
)
const
;
// What compiler.
cmFortranCompiler
Compiler
;
// The include file search path.
std
::
vector
<
std
::
string
>
IncludePath
;
...
...
Source/cmFortranParserImpl.cxx
View file @
2f51f281
...
...
@@ -43,10 +43,12 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
return
false
;
}
cmFortranParser_s
::
cmFortranParser_s
(
std
::
vector
<
std
::
string
>
includes
,
cmFortranParser_s
::
cmFortranParser_s
(
cmFortranCompiler
fc
,
std
::
vector
<
std
::
string
>
includes
,
std
::
set
<
std
::
string
>
defines
,
cmFortranSourceInfo
&
info
)
:
IncludePath
(
std
::
move
(
includes
))
:
Compiler
(
std
::
move
(
fc
))
,
IncludePath
(
std
::
move
(
includes
))
,
PPDefinitions
(
std
::
move
(
defines
))
,
Info
(
info
)
{
...
...
@@ -69,6 +71,17 @@ cmFortranParser_s::~cmFortranParser_s()
cmFortran_yylex_destroy
(
this
->
Scanner
);
}
std
::
string
cmFortranParser_s
::
ModName
(
std
::
string
const
&
mod_name
)
const
{
return
mod_name
+
".mod"
;
}
std
::
string
cmFortranParser_s
::
SModName
(
std
::
string
const
&
mod_name
,
std
::
string
const
&
sub_name
)
const
{
return
mod_name
+
this
->
Compiler
.
SModSep
+
sub_name
+
this
->
Compiler
.
SModExt
;
}
bool
cmFortranParser_FilePush
(
cmFortranParser
*
parser
,
const
char
*
fname
)
{
// Open the new file and push it onto the stack. Save the old
...
...
@@ -178,7 +191,7 @@ void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name)
// syntax: "use module_name"
// requires: "module_name.mod"
std
::
string
const
&
mod_name
=
cmSystemTools
::
LowerCase
(
module_name
);
parser
->
Info
.
Requires
.
insert
(
mod_name
+
".mod"
);
parser
->
Info
.
Requires
.
insert
(
parser
->
ModName
(
mod_name
)
);
}
void
cmFortranParser_RuleLineDirective
(
cmFortranParser
*
parser
,
...
...
@@ -242,7 +255,7 @@ void cmFortranParser_RuleModule(cmFortranParser* parser,
// syntax: "module module_name"
// provides: "module_name.mod"
std
::
string
const
&
mod_name
=
cmSystemTools
::
LowerCase
(
module_name
);
parser
->
Info
.
Provides
.
insert
(
mod_name
+
".mod"
);
parser
->
Info
.
Provides
.
insert
(
parser
->
ModName
(
mod_name
)
);
}
}
...
...
@@ -265,8 +278,8 @@ void cmFortranParser_RuleSubmodule(cmFortranParser* parser,
std
::
string
const
&
mod_name
=
cmSystemTools
::
LowerCase
(
module_name
);
std
::
string
const
&
sub_name
=
cmSystemTools
::
LowerCase
(
submodule_name
);
parser
->
Info
.
Requires
.
insert
(
mod_name
+
".mod"
);
parser
->
Info
.
Provides
.
insert
(
mod_name
+
"@"
+
sub_name
+
".smod"
);
parser
->
Info
.
Requires
.
insert
(
parser
->
ModName
(
mod_name
)
);
parser
->
Info
.
Provides
.
insert
(
parser
->
SModName
(
mod_name
,
sub_name
)
);
}
void
cmFortranParser_RuleSubmoduleNested
(
cmFortranParser
*
parser
,
...
...
@@ -286,8 +299,8 @@ void cmFortranParser_RuleSubmoduleNested(cmFortranParser* parser,
std
::
string
const
&
sub_name
=
cmSystemTools
::
LowerCase
(
submodule_name
);
std
::
string
const
&
nest_name
=
cmSystemTools
::
LowerCase
(
nested_submodule_name
);
parser
->
Info
.
Requires
.
insert
(
mod_name
+
"@"
+
sub_name
+
".smod"
);
parser
->
Info
.
Provides
.
insert
(
mod_name
+
"@"
+
nest_name
+
".smod"
);
parser
->
Info
.
Requires
.
insert
(
parser
->
SModName
(
mod_name
,
sub_name
)
);
parser
->
Info
.
Provides
.
insert
(
parser
->
SModName
(
mod_name
,
nest_name
)
);
}
void
cmFortranParser_RuleDefine
(
cmFortranParser
*
parser
,
const
char
*
macro
)
...
...
Source/cmGlobalNinjaGenerator.cxx
View file @
2f51f281
...
...
@@ -1679,6 +1679,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
return
1
;
}
cmFortranCompiler
fc
;
std
::
vector
<
std
::
string
>
includes
;
{
Json
::
Value
tdio
;
...
...
@@ -1700,11 +1701,20 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
includes
.
push_back
(
tdi_include_dir
.
asString
());
}
}
Json
::
Value
const
&
tdi_compiler_id
=
tdi
[
"compiler-id"
];
fc
.
Id
=
tdi_compiler_id
.
asString
();
Json
::
Value
const
&
tdi_submodule_sep
=
tdi
[
"submodule-sep"
];
fc
.
SModSep
=
tdi_submodule_sep
.
asString
();
Json
::
Value
const
&
tdi_submodule_ext
=
tdi
[
"submodule-ext"
];
fc
.
SModExt
=
tdi_submodule_ext
.
asString
();
}
cmFortranSourceInfo
info
;
std
::
set
<
std
::
string
>
defines
;
cmFortranParser
parser
(
includes
,
defines
,
info
);
cmFortranParser
parser
(
fc
,
includes
,
defines
,
info
);
if
(
!
cmFortranParser_FilePush
(
&
parser
,
arg_pp
.
c_str
()))
{
cmSystemTools
::
Error
(
"-E cmake_ninja_depends failed to open "
,
arg_pp
.
c_str
());
...
...
Source/cmLocalUnixMakefileGenerator3.cxx
View file @
2f51f281
...
...
@@ -1808,6 +1808,17 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
<<
"_COMPILER_ID
\"
"
<<
cid
<<
"
\"
)
\n
"
;
}
if
(
implicitLang
.
first
==
"Fortran"
)
{
std
::
string
smodSep
=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_Fortran_SUBMODULE_SEP"
);
std
::
string
smodExt
=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_Fortran_SUBMODULE_EXT"
);
cmakefileStream
<<
"set(CMAKE_Fortran_SUBMODULE_SEP
\"
"
<<
smodSep
<<
"
\"
)
\n
"
;
cmakefileStream
<<
"set(CMAKE_Fortran_SUBMODULE_EXT
\"
"
<<
smodExt
<<
"
\"
)
\n
"
;
}
// Build a list of preprocessor definitions for the target.
std
::
set
<
std
::
string
>
defines
;
this
->
GetTargetDefines
(
target
,
this
->
ConfigName
,
implicitLang
.
first
,
...
...
Source/cmNinjaTargetGenerator.cxx
View file @
2f51f281
...
...
@@ -1144,6 +1144,10 @@ void cmNinjaTargetGenerator::WriteTargetDependInfo(std::string const& lang)
mod_dir
=
this
->
Makefile
->
GetCurrentBinaryDirectory
();
}
tdi
[
"module-dir"
]
=
mod_dir
;
tdi
[
"submodule-sep"
]
=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_Fortran_SUBMODULE_SEP"
);
tdi
[
"submodule-ext"
]
=
this
->
Makefile
->
GetSafeDefinition
(
"CMAKE_Fortran_SUBMODULE_EXT"
);
}
tdi
[
"dir-cur-bld"
]
=
this
->
Makefile
->
GetCurrentBinaryDirectory
();
...
...
Write
Preview
Markdown
is supported
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