mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-04 05:10:10 -05:00
Merge topic 'ghs-linux'
2c43fb5be3FindThreads: Fix pthread library check in GHS Multi Generator0404efe786GHS: Add support for GHS Multi Generator in Linux2060a1445cTests: Fix file name case in GHS object library testddad70c8a4Tests: Run GHS tests in a separate ctest processf7dca1fc97GHS: Fix include-what-you-use and clang-tidy diagnostics Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3006
This commit is contained in:
@@ -33,12 +33,12 @@ Cache variables that are used for toolset and target system customization:
|
||||
* ``GHS_TOOLSET_ROOT``
|
||||
|
||||
| Root path for ``toolset`` searches.
|
||||
| Defaults to ``C:/ghs``.
|
||||
| Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
|
||||
|
||||
* ``GHS_OS_ROOT``
|
||||
|
||||
| Root path for RTOS searches.
|
||||
| Defaults to ``C:/ghs``.
|
||||
| Defaults to ``C:/ghs`` in Windows or ``/usr/ghs`` in Linux.
|
||||
|
||||
* ``GHS_OS_DIR``
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
ghs-linux
|
||||
---------
|
||||
|
||||
* The :generator:`Green Hills MULTI` generator is now available on Linux.
|
||||
@@ -52,7 +52,8 @@ to configure the project:
|
||||
possible.
|
||||
|
||||
* The :generator:`Green Hills MULTI` generator sets this to the full
|
||||
path to ``gbuild.exe`` based upon the toolset being used.
|
||||
path to ``gbuild.exe(Windows)`` or ``gbuild(Linux)`` based upon
|
||||
the toolset being used.
|
||||
|
||||
Once the generator has initialized a particular value for this
|
||||
variable, changing the value has undefined behavior.
|
||||
|
||||
@@ -431,10 +431,18 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS}
|
||||
)
|
||||
# Match the compiler location line printed out.
|
||||
set(ghs_toolpath "${CMAKE_MAKE_PROGRAM}")
|
||||
string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
|
||||
string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
|
||||
if(CMAKE_HOST_UNIX)
|
||||
string(REPLACE "/gbuild" "/" ghs_toolpath ${ghs_toolpath})
|
||||
else()
|
||||
string(REPLACE "/gbuild.exe" "/" ghs_toolpath ${ghs_toolpath})
|
||||
string(REPLACE / "\\\\" ghs_toolpath ${ghs_toolpath})
|
||||
endif()
|
||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "(${ghs_toolpath}[^ ]*)")
|
||||
set(_comp "${CMAKE_MATCH_1}.exe")
|
||||
if(CMAKE_HOST_UNIX)
|
||||
set(_comp "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(_comp "${CMAKE_MATCH_1}.exe")
|
||||
endif()
|
||||
if(EXISTS "${_comp}")
|
||||
file(TO_CMAKE_PATH "${_comp}" _comp)
|
||||
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
||||
|
||||
@@ -161,6 +161,9 @@ if(CMAKE_HAVE_PTHREAD_H)
|
||||
_check_pthreads_flag()
|
||||
endif ()
|
||||
|
||||
if(CMAKE_SYSTEM MATCHES "GHS-MULTI")
|
||||
_check_threads_lib(posix pthread_create CMAKE_HAVE_PTHREADS_CREATE)
|
||||
endif()
|
||||
_check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
|
||||
_check_threads_lib(pthread pthread_create CMAKE_HAVE_PTHREAD_CREATE)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
|
||||
#Setup Green Hills MULTI specific compilation information
|
||||
|
||||
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
|
||||
if(CMAKE_HOST_UNIX)
|
||||
set(GHS_OS_ROOT "/usr/ghs" CACHE PATH "GHS platform OS search root directory")
|
||||
else()
|
||||
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
|
||||
endif()
|
||||
mark_as_advanced(GHS_OS_ROOT)
|
||||
|
||||
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
|
||||
|
||||
+16
-8
@@ -729,14 +729,6 @@ if (WIN32)
|
||||
cmVisualStudioSlnParser.cxx
|
||||
cmVisualStudioWCEPlatformParser.h
|
||||
cmVisualStudioWCEPlatformParser.cxx
|
||||
cmGlobalGhsMultiGenerator.cxx
|
||||
cmGlobalGhsMultiGenerator.h
|
||||
cmLocalGhsMultiGenerator.cxx
|
||||
cmLocalGhsMultiGenerator.h
|
||||
cmGhsMultiTargetGenerator.cxx
|
||||
cmGhsMultiTargetGenerator.h
|
||||
cmGhsMultiGpj.cxx
|
||||
cmGhsMultiGpj.h
|
||||
cmVSSetupHelper.cxx
|
||||
cmVSSetupHelper.h
|
||||
)
|
||||
@@ -756,6 +748,22 @@ if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
)
|
||||
endif()
|
||||
|
||||
# GHS support
|
||||
# Works only for windows and linux
|
||||
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(SRCS ${SRCS}
|
||||
cmGlobalGhsMultiGenerator.cxx
|
||||
cmGlobalGhsMultiGenerator.h
|
||||
cmLocalGhsMultiGenerator.cxx
|
||||
cmLocalGhsMultiGenerator.h
|
||||
cmGhsMultiTargetGenerator.cxx
|
||||
cmGhsMultiTargetGenerator.h
|
||||
cmGhsMultiGpj.cxx
|
||||
cmGhsMultiGpj.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
# Ninja support
|
||||
set(SRCS ${SRCS}
|
||||
cmGlobalNinjaGenerator.cxx
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmGhsMultiGpj.h"
|
||||
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include <ostream>
|
||||
|
||||
static const char* GHS_TAG[] = { "[INTEGRITY Application]",
|
||||
"[Library]",
|
||||
@@ -11,7 +11,7 @@ static const char* GHS_TAG[] = { "[INTEGRITY Application]",
|
||||
"[Reference]",
|
||||
"[Subproject]" };
|
||||
|
||||
const char* GhsMultiGpj::GetGpjTag(Types const gpjType)
|
||||
const char* GhsMultiGpj::GetGpjTag(Types gpjType)
|
||||
{
|
||||
char const* tag;
|
||||
switch (gpjType) {
|
||||
@@ -29,7 +29,7 @@ const char* GhsMultiGpj::GetGpjTag(Types const gpjType)
|
||||
return tag;
|
||||
}
|
||||
|
||||
void GhsMultiGpj::WriteGpjTag(Types const gpjType, std::ostream& fout)
|
||||
void GhsMultiGpj::WriteGpjTag(Types gpjType, std::ostream& fout)
|
||||
{
|
||||
char const* tag;
|
||||
tag = GhsMultiGpj::GetGpjTag(gpjType);
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
#include "cmConfigure.h" // IWYU pragma: keep
|
||||
#include <iosfwd>
|
||||
|
||||
class cmGeneratedFileStream;
|
||||
|
||||
class GhsMultiGpj
|
||||
{
|
||||
public:
|
||||
@@ -21,9 +19,9 @@ public:
|
||||
SUBPROJECT
|
||||
};
|
||||
|
||||
static void WriteGpjTag(Types const gpjType, std::ostream& fout);
|
||||
static void WriteGpjTag(Types gpjType, std::ostream& fout);
|
||||
|
||||
static const char* GetGpjTag(Types const gpjType);
|
||||
static const char* GetGpjTag(Types gpjType);
|
||||
};
|
||||
|
||||
#endif // ! cmGhsMultiGpjType_h
|
||||
|
||||
@@ -2,16 +2,29 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmGhsMultiTargetGenerator.h"
|
||||
|
||||
#include "cmComputeLinkInformation.h"
|
||||
#include "cmCustomCommand.h"
|
||||
#include "cmCustomCommandLines.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGhsMultiGenerator.h"
|
||||
#include "cmLinkLineComputer.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmLocalGhsMultiGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmSourceGroup.h"
|
||||
#include "cmStateDirectory.h"
|
||||
#include "cmStateSnapshot.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmTarget.h"
|
||||
#include "cmTargetDepend.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
#include <ostream>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
|
||||
: GeneratorTarget(target)
|
||||
@@ -30,9 +43,7 @@ cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
|
||||
}
|
||||
}
|
||||
|
||||
cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator()
|
||||
{
|
||||
}
|
||||
cmGhsMultiTargetGenerator::~cmGhsMultiTargetGenerator() = default;
|
||||
|
||||
void cmGhsMultiTargetGenerator::Generate()
|
||||
{
|
||||
@@ -99,7 +110,7 @@ void cmGhsMultiTargetGenerator::GenerateTarget()
|
||||
fname += "/";
|
||||
fname += this->Name;
|
||||
fname += cmGlobalGhsMultiGenerator::FILE_EXTENSION;
|
||||
cmGeneratedFileStream fout(fname.c_str());
|
||||
cmGeneratedFileStream fout(fname);
|
||||
fout.SetCopyIfDifferent(true);
|
||||
|
||||
this->GetGlobalGenerator()->WriteFileHeader(fout);
|
||||
@@ -336,10 +347,9 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper(
|
||||
}
|
||||
}
|
||||
|
||||
void cmGhsMultiTargetGenerator::WriteSourceProperty(std::ostream& fout,
|
||||
const cmSourceFile* sf,
|
||||
std::string propName,
|
||||
std::string propFlag)
|
||||
void cmGhsMultiTargetGenerator::WriteSourceProperty(
|
||||
std::ostream& fout, const cmSourceFile* sf, std::string const& propName,
|
||||
std::string const& propFlag)
|
||||
{
|
||||
const char* prop = sf->GetProperty(propName);
|
||||
if (prop) {
|
||||
@@ -370,7 +380,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
||||
this->Makefile->FindSourceGroup(sf->GetFullPath(), sourceGroups);
|
||||
std::string gn = sourceGroup->GetFullName();
|
||||
groupFiles[gn].push_back(sf);
|
||||
groupNames.insert(gn);
|
||||
groupNames.insert(std::move(gn));
|
||||
}
|
||||
|
||||
/* list of known groups and the order they are displayed in a project file */
|
||||
@@ -397,7 +407,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
||||
}
|
||||
|
||||
{ /* catch-all group - is last item */
|
||||
std::string gn = "";
|
||||
std::string gn;
|
||||
auto n = groupNames.find(gn);
|
||||
if (n != groupNames.end()) {
|
||||
groupFilesList.back() = *n;
|
||||
@@ -446,7 +456,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
||||
std::string fpath = this->LocalGenerator->GetCurrentBinaryDirectory();
|
||||
fpath += "/";
|
||||
fpath += lpath;
|
||||
cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath.c_str());
|
||||
cmGeneratedFileStream* f = new cmGeneratedFileStream(fpath);
|
||||
f->SetCopyIfDifferent(true);
|
||||
gfiles.push_back(f);
|
||||
fout = f;
|
||||
@@ -476,7 +486,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
||||
|
||||
if ("ld" != si->GetExtension() && "int" != si->GetExtension() &&
|
||||
"bsp" != si->GetExtension()) {
|
||||
this->WriteObjectLangOverride(*fout, si);
|
||||
WriteObjectLangOverride(*fout, si);
|
||||
}
|
||||
|
||||
this->WriteSourceProperty(*fout, si, "INCLUDE_DIRECTORIES", "-I");
|
||||
@@ -502,9 +512,9 @@ void cmGhsMultiTargetGenerator::WriteObjectLangOverride(
|
||||
std::ostream& fout, const cmSourceFile* sourceFile)
|
||||
{
|
||||
const char* rawLangProp = sourceFile->GetProperty("LANGUAGE");
|
||||
if (NULL != rawLangProp) {
|
||||
if (nullptr != rawLangProp) {
|
||||
std::string sourceLangProp(rawLangProp);
|
||||
std::string extension(sourceFile->GetExtension());
|
||||
std::string const& extension = sourceFile->GetExtension();
|
||||
if ("CXX" == sourceLangProp && ("c" == extension || "C" == extension)) {
|
||||
fout << " -dotciscxx" << std::endl;
|
||||
}
|
||||
@@ -540,20 +550,19 @@ void cmGhsMultiTargetGenerator::WriteReferences(std::ostream& fout)
|
||||
}
|
||||
}
|
||||
|
||||
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp(void)
|
||||
bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
|
||||
{
|
||||
const char* p = this->GeneratorTarget->GetProperty("ghs_integrity_app");
|
||||
if (p) {
|
||||
return cmSystemTools::IsOn(
|
||||
this->GeneratorTarget->GetProperty("ghs_integrity_app"));
|
||||
} else {
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
|
||||
for (auto& sf : sources) {
|
||||
if ("int" == sf->GetExtension()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
|
||||
for (auto& sf : sources) {
|
||||
if ("int" == sf->GetExtension()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,12 @@
|
||||
|
||||
#include "cmTarget.h"
|
||||
|
||||
#include <iosfwd>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class cmCustomCommand;
|
||||
class cmGeneratedFileStream;
|
||||
class cmGeneratorTarget;
|
||||
class cmGlobalGhsMultiGenerator;
|
||||
class cmLocalGhsMultiGenerator;
|
||||
@@ -51,12 +55,13 @@ private:
|
||||
cmTarget::CustomCommandType commandType);
|
||||
void WriteSources(std::ostream& fout_proj);
|
||||
void WriteSourceProperty(std::ostream& fout, const cmSourceFile* sf,
|
||||
std::string propName, std::string propFlag);
|
||||
std::string const& propName,
|
||||
std::string const& propFlag);
|
||||
void WriteReferences(std::ostream& fout);
|
||||
static void WriteObjectLangOverride(std::ostream& fout,
|
||||
const cmSourceFile* sourceFile);
|
||||
|
||||
bool DetermineIfIntegrityApp(void);
|
||||
bool DetermineIfIntegrityApp();
|
||||
cmGeneratorTarget* GeneratorTarget;
|
||||
cmLocalGhsMultiGenerator* LocalGenerator;
|
||||
cmMakefile* Makefile;
|
||||
|
||||
@@ -2,22 +2,33 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmGlobalGhsMultiGenerator.h"
|
||||
|
||||
#include "cmsys/SystemTools.hxx"
|
||||
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmDocumentationEntry.h"
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGhsMultiTargetGenerator.h"
|
||||
#include "cmGhsMultiGpj.h"
|
||||
#include "cmLocalGenerator.h"
|
||||
#include "cmLocalGhsMultiGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmState.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmSystemTools.h"
|
||||
#include "cmVersion.h"
|
||||
#include "cmake.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <ostream>
|
||||
#include <string.h>
|
||||
#include <utility>
|
||||
|
||||
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
|
||||
#ifdef __linux__
|
||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild";
|
||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "/usr/ghs";
|
||||
#elif defined(_WIN32)
|
||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
|
||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
|
||||
#endif
|
||||
|
||||
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
|
||||
: cmGlobalGenerator(cm)
|
||||
@@ -25,9 +36,7 @@ cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
|
||||
cm->GetState()->SetGhsMultiIDE(true);
|
||||
}
|
||||
|
||||
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
|
||||
{
|
||||
}
|
||||
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator() = default;
|
||||
|
||||
cmLocalGenerator* cmGlobalGhsMultiGenerator::CreateLocalGenerator(
|
||||
cmMakefile* mf)
|
||||
@@ -64,7 +73,8 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
||||
/* no toolset was found */
|
||||
if (tsp.empty()) {
|
||||
return false;
|
||||
} else if (ts.empty()) {
|
||||
}
|
||||
if (ts.empty()) {
|
||||
std::string message;
|
||||
message =
|
||||
"Green Hills MULTI: -T <toolset> not specified; defaulting to \"";
|
||||
@@ -86,7 +96,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
||||
const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||
|
||||
/* check if the toolset changed from last generate */
|
||||
if (prevTool != NULL && (gbuild != prevTool)) {
|
||||
if (prevTool != nullptr && (gbuild != prevTool)) {
|
||||
std::string message = "toolset build tool: ";
|
||||
message += gbuild;
|
||||
message += "\nDoes not match the previously used build tool: ";
|
||||
@@ -95,13 +105,12 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
||||
"directory or choose a different binary directory.";
|
||||
cmSystemTools::Error(message);
|
||||
return false;
|
||||
} else {
|
||||
/* store the toolset that is being used for this build */
|
||||
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
|
||||
"build program to use", cmStateEnums::INTERNAL,
|
||||
true);
|
||||
}
|
||||
|
||||
/* store the toolset that is being used for this build */
|
||||
mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild.c_str(),
|
||||
"build program to use", cmStateEnums::INTERNAL, true);
|
||||
|
||||
mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp.c_str());
|
||||
|
||||
return true;
|
||||
@@ -110,7 +119,7 @@ bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
||||
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
||||
cmMakefile* mf)
|
||||
{
|
||||
if (p == "") {
|
||||
if (p.empty()) {
|
||||
cmSystemTools::Message(
|
||||
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
|
||||
std::string arch = "arm";
|
||||
@@ -201,7 +210,7 @@ void cmGlobalGhsMultiGenerator::WriteFileHeader(std::ostream& fout)
|
||||
fout << "#!gbuild" << std::endl;
|
||||
fout << "#" << std::endl
|
||||
<< "# CMAKE generated file: DO NOT EDIT!" << std::endl
|
||||
<< "# Generated by \"" << this->GetActualName() << "\""
|
||||
<< "# Generated by \"" << GetActualName() << "\""
|
||||
<< " Generator, CMake Version " << cmVersion::GetMajorVersion() << "."
|
||||
<< cmVersion::GetMinorVersion() << std::endl
|
||||
<< "#" << std::endl
|
||||
@@ -296,7 +305,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(
|
||||
if (projName && projType) {
|
||||
cmLocalGenerator* lg = target->GetLocalGenerator();
|
||||
std::string dir = lg->GetCurrentBinaryDirectory();
|
||||
dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir.c_str());
|
||||
dir = root->MaybeConvertToRelativePath(rootBinaryDir, dir);
|
||||
if (dir == ".") {
|
||||
dir.clear();
|
||||
} else {
|
||||
@@ -319,7 +328,7 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(
|
||||
fname += "REF";
|
||||
fname += FILE_EXTENSION;
|
||||
|
||||
cmGeneratedFileStream fref(fname.c_str());
|
||||
cmGeneratedFileStream fref(fname);
|
||||
fref.SetCopyIfDifferent(true);
|
||||
|
||||
this->WriteFileHeader(fref);
|
||||
@@ -360,7 +369,7 @@ void cmGlobalGhsMultiGenerator::OutputTopLevelProject(
|
||||
fname += ".top";
|
||||
fname += FILE_EXTENSION;
|
||||
|
||||
cmGeneratedFileStream fout(fname.c_str());
|
||||
cmGeneratedFileStream fout(fname);
|
||||
fout.SetCopyIfDifferent(true);
|
||||
|
||||
this->WriteTopLevelProject(fout, root, generators);
|
||||
@@ -376,9 +385,12 @@ cmGlobalGhsMultiGenerator::GenerateBuildCommand(
|
||||
std::vector<std::string> const& makeOptions)
|
||||
{
|
||||
GeneratedMakeCommand makeCommand = {};
|
||||
const char* gbuild =
|
||||
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
||||
makeCommand.Add(this->SelectMakeProgram(makeProgram, (std::string)gbuild));
|
||||
std::string gbuild;
|
||||
if (const char* gbuildCached =
|
||||
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM")) {
|
||||
gbuild = gbuildCached;
|
||||
}
|
||||
makeCommand.Add(this->SelectMakeProgram(makeProgram, gbuild));
|
||||
|
||||
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
|
||||
makeCommand.Add("-parallel");
|
||||
@@ -424,7 +436,7 @@ void cmGlobalGhsMultiGenerator::WriteMacros(std::ostream& fout)
|
||||
{
|
||||
char const* ghsGpjMacros =
|
||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_GPJ_MACROS");
|
||||
if (NULL != ghsGpjMacros) {
|
||||
if (nullptr != ghsGpjMacros) {
|
||||
std::vector<std::string> expandedList;
|
||||
cmSystemTools::ExpandListArgument(std::string(ghsGpjMacros), expandedList);
|
||||
for (std::string const& arg : expandedList) {
|
||||
@@ -457,7 +469,7 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(std::ostream& fout)
|
||||
|
||||
char const* const customization =
|
||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
||||
if (NULL != customization && strlen(customization) > 0) {
|
||||
if (nullptr != customization && strlen(customization) > 0) {
|
||||
fout << "customization=" << trimQuotes(customization) << std::endl;
|
||||
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
|
||||
}
|
||||
|
||||
@@ -5,10 +5,20 @@
|
||||
|
||||
#include "cmGlobalGenerator.h"
|
||||
|
||||
#include "cmGhsMultiGpj.h"
|
||||
#include "cmGlobalGeneratorFactory.h"
|
||||
#include "cmTargetDepend.h"
|
||||
|
||||
class cmGeneratedFileStream;
|
||||
#include <iosfwd>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalGenerator;
|
||||
class cmMakefile;
|
||||
class cmake;
|
||||
struct cmDocumentationEntry;
|
||||
|
||||
class cmGlobalGhsMultiGenerator : public cmGlobalGenerator
|
||||
{
|
||||
@@ -17,7 +27,7 @@ public:
|
||||
static const char* FILE_EXTENSION;
|
||||
|
||||
cmGlobalGhsMultiGenerator(cmake* cm);
|
||||
~cmGlobalGhsMultiGenerator();
|
||||
~cmGlobalGhsMultiGenerator() override;
|
||||
|
||||
static cmGlobalGeneratorFactory* NewFactory()
|
||||
{
|
||||
@@ -31,7 +41,7 @@ public:
|
||||
static std::string GetActualName() { return "Green Hills MULTI"; }
|
||||
|
||||
///! Get the name for this generator
|
||||
std::string GetName() const override { return this->GetActualName(); }
|
||||
std::string GetName() const override { return GetActualName(); }
|
||||
|
||||
/// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
|
||||
static void GetDocumentation(cmDocumentationEntry& entry);
|
||||
@@ -77,8 +87,8 @@ public:
|
||||
std::string First;
|
||||
|
||||
public:
|
||||
TargetCompare(std::string const& first)
|
||||
: First(first)
|
||||
TargetCompare(std::string first)
|
||||
: First(std::move(first))
|
||||
{
|
||||
}
|
||||
bool operator()(cmGeneratorTarget const* l,
|
||||
|
||||
@@ -2,12 +2,15 @@
|
||||
file Copyright.txt or https://cmake.org/licensing for details. */
|
||||
#include "cmLocalGhsMultiGenerator.h"
|
||||
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGhsMultiTargetGenerator.h"
|
||||
#include "cmGlobalGhsMultiGenerator.h"
|
||||
#include "cmMakefile.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmSourceFile.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmSystemTools.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
|
||||
cmMakefile* mf)
|
||||
@@ -15,9 +18,7 @@ cmLocalGhsMultiGenerator::cmLocalGhsMultiGenerator(cmGlobalGenerator* gg,
|
||||
{
|
||||
}
|
||||
|
||||
cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator()
|
||||
{
|
||||
}
|
||||
cmLocalGhsMultiGenerator::~cmLocalGhsMultiGenerator() = default;
|
||||
|
||||
std::string cmLocalGhsMultiGenerator::GetTargetDirectory(
|
||||
cmGeneratorTarget const* target) const
|
||||
|
||||
@@ -5,7 +5,14 @@
|
||||
|
||||
#include "cmLocalGenerator.h"
|
||||
|
||||
class cmGeneratedFileStream;
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class cmGeneratorTarget;
|
||||
class cmGlobalGenerator;
|
||||
class cmMakefile;
|
||||
class cmSourceFile;
|
||||
|
||||
/** \class cmLocalGhsMultiGenerator
|
||||
* \brief Write Green Hills MULTI project files.
|
||||
@@ -18,7 +25,7 @@ class cmLocalGhsMultiGenerator : public cmLocalGenerator
|
||||
public:
|
||||
cmLocalGhsMultiGenerator(cmGlobalGenerator* gg, cmMakefile* mf);
|
||||
|
||||
virtual ~cmLocalGhsMultiGenerator();
|
||||
~cmLocalGhsMultiGenerator() override;
|
||||
|
||||
/**
|
||||
* Generate the makefile for this directory.
|
||||
|
||||
+7
-2
@@ -48,7 +48,6 @@
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
# if !defined(CMAKE_BOOT_MINGW)
|
||||
# include "cmGlobalBorlandMakefileGenerator.h"
|
||||
# include "cmGlobalGhsMultiGenerator.h"
|
||||
# include "cmGlobalJOMMakefileGenerator.h"
|
||||
# include "cmGlobalNMakeMakefileGenerator.h"
|
||||
# include "cmGlobalVisualStudio10Generator.h"
|
||||
@@ -84,6 +83,10 @@
|
||||
# include "cmExtraEclipseCDT4Generator.h"
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(_WIN32)
|
||||
# include "cmGlobalGhsMultiGenerator.h"
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
# if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
# include "cmGlobalXCodeGenerator.h"
|
||||
@@ -1833,13 +1836,15 @@ void cmake::AddDefaultGenerators()
|
||||
this->Generators.push_back(cmGlobalBorlandMakefileGenerator::NewFactory());
|
||||
this->Generators.push_back(cmGlobalNMakeMakefileGenerator::NewFactory());
|
||||
this->Generators.push_back(cmGlobalJOMMakefileGenerator::NewFactory());
|
||||
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
|
||||
# endif
|
||||
this->Generators.push_back(cmGlobalMSYSMakefileGenerator::NewFactory());
|
||||
this->Generators.push_back(cmGlobalMinGWMakefileGenerator::NewFactory());
|
||||
#endif
|
||||
this->Generators.push_back(cmGlobalUnixMakefileGenerator3::NewFactory());
|
||||
#if defined(CMAKE_BUILD_WITH_CMAKE)
|
||||
# if defined(__linux__) || defined(_WIN32)
|
||||
this->Generators.push_back(cmGlobalGhsMultiGenerator::NewFactory());
|
||||
# endif
|
||||
this->Generators.push_back(cmGlobalNinjaGenerator::NewFactory());
|
||||
#endif
|
||||
#if defined(CMAKE_USE_WMAKE)
|
||||
|
||||
@@ -2324,6 +2324,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
||||
--build-generator "Green Hills MULTI"
|
||||
--build-project test
|
||||
--build-config $<CONFIGURATION>
|
||||
--force-new-ctest-process
|
||||
--build-options ${ghs_target_arch} ${ghs_toolset_name} ${ghs_toolset_root} ${ghs_target_platform}
|
||||
${ghs_os_root} ${ghs_os_dir} ${ghs_bsp_name} ${_ghs_build_opts} ${_ghs_toolset_extra}
|
||||
${_ghs_test_command}
|
||||
|
||||
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
|
||||
|
||||
project(test C)
|
||||
|
||||
add_library(obj1 OBJECT testObj.c testObj.h sub/testObj.c testObj2.c)
|
||||
add_library(obj1 OBJECT testOBJ.c testOBJ.h sub/testOBJ.c testOBJ2.c)
|
||||
|
||||
add_executable(exe1 exe.c $<TARGET_OBJECTS:obj1>)
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GHS")
|
||||
|
||||
Reference in New Issue
Block a user