mirror of
https://github.com/reactos/CMake.git
synced 2024-11-27 13:30:39 +00:00
Merge topic 'ghs'
ce4f20ba62
GHS: Add release notes281c601024
GHS: Update default BSP name01c98c6ccc
GHS: Update setting default OS location for Integrity platformsbb77dc0cee
GHS: Set primary target using arch/platform values (or user specified value)f80692cf60
GHS: Add platform selection supporta37a4a00c8
GHS: Add toolset selection support5d40d2b44f
GHS: Support ARM, PPC, 86 architectures Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Matt Soucy <matthew.soucy@baesystems.com> Merge-request: !798
This commit is contained in:
commit
f6f5f9f75f
@ -3,12 +3,48 @@ Green Hills MULTI
|
|||||||
|
|
||||||
Generates Green Hills MULTI project files (experimental, work-in-progress).
|
Generates Green Hills MULTI project files (experimental, work-in-progress).
|
||||||
|
|
||||||
Customizations are available through the following cache variables:
|
Customizations that are used to pick toolset and target system:
|
||||||
|
|
||||||
|
The ``-A <arch>`` can be supplied for setting the target architecture.
|
||||||
|
``<arch>`` usually is one of "arm", "ppc", "86", etcetera. If the target architecture
|
||||||
|
is not specified then the default architecture of "arm" will be used.
|
||||||
|
|
||||||
|
The ``-T <toolset>`` can be supplied for setting the toolset to be used.
|
||||||
|
All toolsets are expected to be located at ``GHS_TOOLSET_ROOT``.
|
||||||
|
If the toolset is not specified then the latest toolset will be used.
|
||||||
|
|
||||||
|
* ``GHS_TARGET_PLATFORM``
|
||||||
|
|
||||||
|
Default to ``integrity``.
|
||||||
|
Usual values are ``integrity``, ``threadx``, ``uvelosity``,
|
||||||
|
``velosity``, ``vxworks``, ``standalone``.
|
||||||
|
|
||||||
|
* ``GHS_PRIMARY_TARGET``
|
||||||
|
|
||||||
|
Sets ``primaryTarget`` field in project file.
|
||||||
|
Defaults to ``<arch>_<GHS_TARGET_PLATFORM>.tgt``.
|
||||||
|
|
||||||
|
* ``GHS_TOOLSET_ROOT``
|
||||||
|
|
||||||
|
Default to ``C:/ghs``. Root path for ``toolset``.
|
||||||
|
|
||||||
|
* ``GHS_OS_ROOT``
|
||||||
|
|
||||||
|
Default to ``C:/ghs``. Root path for RTOS searches.
|
||||||
|
|
||||||
|
* ``GHS_OS_DIR``
|
||||||
|
|
||||||
|
Default to latest platform OS installation at ``GHS_OS_ROOT``. Set this value if
|
||||||
|
a specific RTOS is to be used.
|
||||||
|
|
||||||
* ``GHS_BSP_NAME``
|
* ``GHS_BSP_NAME``
|
||||||
|
|
||||||
|
Defaults to ``sim<arch>`` if not set by user.
|
||||||
|
|
||||||
|
Customizations are available through the following cache variables:
|
||||||
|
|
||||||
* ``GHS_CUSTOMIZATION``
|
* ``GHS_CUSTOMIZATION``
|
||||||
* ``GHS_GPJ_MACROS``
|
* ``GHS_GPJ_MACROS``
|
||||||
* ``GHS_OS_DIR``
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
This generator is deemed experimental as of CMake |release|
|
This generator is deemed experimental as of CMake |release|
|
||||||
|
20
Help/release/dev/ghs.rst
Normal file
20
Help/release/dev/ghs.rst
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
ghs
|
||||||
|
---
|
||||||
|
|
||||||
|
* The :generator:`Green Hills MULTI` generator is updated:
|
||||||
|
|
||||||
|
- Added support for architecture selection through
|
||||||
|
:variable:`CMAKE_GENERATOR_PLATFORM`:
|
||||||
|
e.g. ``arm``, ``ppc``, and ``86``.
|
||||||
|
|
||||||
|
- Added support for toolset selection through
|
||||||
|
:variable:`CMAKE_GENERATOR_TOOLSET`,
|
||||||
|
e.g. ``comp_201205``, ``comp_201510``, ``comp_201722_beta``.
|
||||||
|
|
||||||
|
- Added support for platform selection through ``GHS_TARGET_PLATFORM``,
|
||||||
|
e.g. ``integrity``, ``linux``, ``standalone``, etc.
|
||||||
|
|
||||||
|
- No longer checks that ``arm`` based compilers are installed but ensures
|
||||||
|
that the correct ``gbuild.exe`` exists.
|
||||||
|
|
||||||
|
- No longer hard-codes ARM files, BSP, toolset, or OS locations.
|
@ -19,6 +19,8 @@ Platform specification is supported only on specific generators:
|
|||||||
* For :ref:`Visual Studio Generators` with VS 2005 and above this
|
* For :ref:`Visual Studio Generators` with VS 2005 and above this
|
||||||
specifies the target architecture.
|
specifies the target architecture.
|
||||||
|
|
||||||
|
* For :generator:`Green Hills MULTI` this specifies the target architecture.
|
||||||
|
|
||||||
See native build system documentation for allowed platform names.
|
See native build system documentation for allowed platform names.
|
||||||
|
|
||||||
Visual Studio Platform Selection
|
Visual Studio Platform Selection
|
||||||
|
@ -18,6 +18,7 @@ Toolset specification is supported only on specific generators:
|
|||||||
|
|
||||||
* :ref:`Visual Studio Generators` for VS 2010 and above
|
* :ref:`Visual Studio Generators` for VS 2010 and above
|
||||||
* The :generator:`Xcode` generator for Xcode 3.0 and above
|
* The :generator:`Xcode` generator for Xcode 3.0 and above
|
||||||
|
* The :generator:`Green Hills MULTI` generator
|
||||||
|
|
||||||
See native build system documentation for allowed toolset names.
|
See native build system documentation for allowed toolset names.
|
||||||
|
|
||||||
|
@ -55,9 +55,11 @@ to configure the project:
|
|||||||
the CMake cache then CMake will use the specified value if
|
the CMake cache then CMake will use the specified value if
|
||||||
possible.
|
possible.
|
||||||
|
|
||||||
* The :generator:`Green Hills MULTI` generator sets this to ``gbuild``.
|
* The :generator:`Green Hills MULTI` generator sets this to the full
|
||||||
If a user or project explicitly adds ``CMAKE_MAKE_PROGRAM`` to
|
path to ``gbuild.exe`` based upon the toolset being used.
|
||||||
the CMake cache then CMake will use the specified value.
|
|
||||||
|
Once the generator has initialized a particular value for this
|
||||||
|
variable, changing the value has undefined behavior.
|
||||||
|
|
||||||
The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code.
|
The ``CMAKE_MAKE_PROGRAM`` variable is set for use by project code.
|
||||||
The value is also used by the :manual:`cmake(1)` ``--build`` and
|
The value is also used by the :manual:`cmake(1)` ``--build`` and
|
||||||
|
@ -6,5 +6,3 @@ The name of the CPU CMake is building for.
|
|||||||
This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if
|
This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if
|
||||||
you build for the host system instead of the target system when
|
you build for the host system instead of the target system when
|
||||||
cross compiling.
|
cross compiling.
|
||||||
|
|
||||||
* The :generator:`Green Hills MULTI` generator sets this to ``ARM`` by default.
|
|
||||||
|
@ -1,40 +1,44 @@
|
|||||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||||
|
|
||||||
|
#Setup Green Hills MULTI specific compilation information
|
||||||
|
|
||||||
#Setup Greenhills MULTI specific compilation information
|
set(GHS_OS_ROOT "C:/ghs" CACHE PATH "GHS platform OS search root directory")
|
||||||
|
mark_as_advanced(GHS_OS_ROOT)
|
||||||
|
|
||||||
if (NOT GHS_INT_DIRECTORY)
|
set(GHS_OS_DIR "NOTFOUND" CACHE PATH "GHS platform OS directory")
|
||||||
#Assume the C:/ghs/int#### directory that is latest is preferred
|
mark_as_advanced(GHS_OS_DIR)
|
||||||
set(GHS_EXPECTED_ROOT "C:/ghs")
|
|
||||||
if (EXISTS ${GHS_EXPECTED_ROOT})
|
#set GHS_OS_DIR if not set by user
|
||||||
FILE(GLOB GHS_CANDIDATE_INT_DIRS RELATIVE
|
if ( NOT GHS_OS_DIR )
|
||||||
${GHS_EXPECTED_ROOT} ${GHS_EXPECTED_ROOT}/*)
|
if (EXISTS ${GHS_OS_ROOT})
|
||||||
string(REGEX MATCHALL "int[0-9][0-9][0-9][0-9a-z]" GHS_CANDIDATE_INT_DIRS
|
|
||||||
${GHS_CANDIDATE_INT_DIRS})
|
#get all directories in root directory
|
||||||
if (GHS_CANDIDATE_INT_DIRS)
|
FILE(GLOB GHS_CANDIDATE_OS_DIRS
|
||||||
list(SORT GHS_CANDIDATE_INT_DIRS)
|
LIST_DIRECTORIES true RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
|
||||||
list(GET GHS_CANDIDATE_INT_DIRS -1 GHS_INT_DIRECTORY)
|
FILE(GLOB GHS_CANDIDATE_OS_FILES
|
||||||
string(CONCAT GHS_INT_DIRECTORY ${GHS_EXPECTED_ROOT} "/"
|
LIST_DIRECTORIES false RELATIVE ${GHS_OS_ROOT} ${GHS_OS_ROOT}/*)
|
||||||
${GHS_INT_DIRECTORY})
|
if ( GHS_CANDIDATE_OS_FILES )
|
||||||
|
list(REMOVE_ITEM GHS_CANDIDATE_OS_DIRS ${GHS_CANDIDATE_OS_FILES})
|
||||||
endif ()
|
endif ()
|
||||||
endif ()
|
|
||||||
|
|
||||||
#Try to look for known registry values
|
#filter based on platform name
|
||||||
if (NOT GHS_INT_DIRECTORY)
|
if (GHS_TARGET_PLATFORM STREQUAL "integrity")
|
||||||
find_path(GHS_INT_DIRECTORY INTEGRITY.ld PATHS
|
list(FILTER GHS_CANDIDATE_OS_DIRS INCLUDE REGEX "int[0-9][0-9][0-9][0-9a-z].*")
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware6433c345;InstallLocation]" #int1122
|
endif ()
|
||||||
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\GreenHillsSoftware289b6625;InstallLocation]" #int1104
|
|
||||||
)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(GHS_INT_DIRECTORY ${GHS_INT_DIRECTORY} CACHE PATH
|
if (GHS_CANDIDATE_OS_DIRS)
|
||||||
"Path to integrity directory")
|
list(SORT GHS_CANDIDATE_OS_DIRS)
|
||||||
|
list(GET GHS_CANDIDATE_OS_DIRS -1 GHS_OS_DIR)
|
||||||
|
string(CONCAT GHS_OS_DIR ${GHS_OS_ROOT} "/" ${GHS_OS_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(GHS_OS_DIR "${GHS_OS_DIR}" CACHE PATH "GHS platform OS directory" FORCE)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
set(GHS_OS_DIR ${GHS_INT_DIRECTORY} CACHE PATH "OS directory")
|
set(GHS_BSP_NAME "IGNORE" CACHE STRING "BSP name")
|
||||||
set(GHS_PRIMARY_TARGET "arm_integrity.tgt" CACHE STRING "target for compilation")
|
|
||||||
set(GHS_BSP_NAME "simarm" CACHE STRING "BSP name")
|
|
||||||
set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
|
set(GHS_CUSTOMIZATION "" CACHE FILEPATH "optional GHS customization")
|
||||||
mark_as_advanced(GHS_CUSTOMIZATION)
|
mark_as_advanced(GHS_CUSTOMIZATION)
|
||||||
set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
|
set(GHS_GPJ_MACROS "" CACHE STRING "optional GHS macros generated in the .gpjs for legacy reasons")
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
#include "cmVersion.h"
|
#include "cmVersion.h"
|
||||||
|
|
||||||
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
|
const char* cmGlobalGhsMultiGenerator::FILE_EXTENSION = ".gpj";
|
||||||
const char* cmGlobalGhsMultiGenerator::DEFAULT_MAKE_PROGRAM = "gbuild";
|
const char* cmGlobalGhsMultiGenerator::DEFAULT_BUILD_PROGRAM = "gbuild.exe";
|
||||||
|
const char* cmGlobalGhsMultiGenerator::DEFAULT_TOOLSET_ROOT = "C:/ghs";
|
||||||
|
|
||||||
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
|
cmGlobalGhsMultiGenerator::cmGlobalGhsMultiGenerator(cmake* cm)
|
||||||
: cmGlobalGenerator(cm)
|
: cmGlobalGenerator(cm)
|
||||||
, OSDirRelative(false)
|
, OSDirRelative(false)
|
||||||
{
|
{
|
||||||
this->GhsBuildCommandInitialized = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
|
cmGlobalGhsMultiGenerator::~cmGlobalGhsMultiGenerator()
|
||||||
@ -41,133 +41,153 @@ void cmGlobalGhsMultiGenerator::GetDocumentation(cmDocumentationEntry& entry)
|
|||||||
"Generates Green Hills MULTI files (experimental, work-in-progress).";
|
"Generates Green Hills MULTI files (experimental, work-in-progress).";
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalGhsMultiGenerator::EnableLanguage(
|
bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
|
||||||
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
|
cmMakefile* mf)
|
||||||
{
|
{
|
||||||
mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
|
std::string tsp; /* toolset path */
|
||||||
mf->AddDefinition("CMAKE_SYSTEM_PROCESSOR", "ARM");
|
std::string tsn = ts; /* toolset name */
|
||||||
|
|
||||||
const std::string ghsCompRoot(GetCompRoot());
|
GetToolset(mf, tsp, tsn);
|
||||||
mf->AddDefinition("GHS_COMP_ROOT", ghsCompRoot.c_str());
|
|
||||||
std::string ghsCompRootStart =
|
/* no toolset was found */
|
||||||
0 == ghsCompRootStart.size() ? "" : ghsCompRoot + "/";
|
if (tsn.empty()) {
|
||||||
mf->AddDefinition("CMAKE_C_COMPILER",
|
return false;
|
||||||
std::string(ghsCompRootStart + "ccarm.exe").c_str());
|
} else if (ts.empty()) {
|
||||||
|
std::string message;
|
||||||
|
message =
|
||||||
|
"Green Hills MULTI: -T <toolset> not specified; defaulting to \"";
|
||||||
|
message += tsn;
|
||||||
|
message += "\"";
|
||||||
|
cmSystemTools::Message(message.c_str());
|
||||||
|
|
||||||
|
/* store the toolset for later use
|
||||||
|
* -- already done if -T<toolset> was specified
|
||||||
|
*/
|
||||||
|
mf->AddCacheDefinition("CMAKE_GENERATOR_TOOLSET", tsn.c_str(),
|
||||||
|
"Name of generator toolset.",
|
||||||
|
cmStateEnums::INTERNAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set the build tool to use */
|
||||||
|
const char* prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
|
std::string gbuild(tsp + "/" + tsn + "/" + DEFAULT_BUILD_PROGRAM);
|
||||||
|
|
||||||
|
/* check if the toolset changed from last generate */
|
||||||
|
if (prevTool != NULL && (gbuild != prevTool)) {
|
||||||
|
std::string message = "generator toolset: ";
|
||||||
|
message += gbuild;
|
||||||
|
message += "\nDoes not match the toolset used previously: ";
|
||||||
|
message += prevTool;
|
||||||
|
message += "\nEither remove the CMakeCache.txt file and CMakeFiles "
|
||||||
|
"directory or choose a different binary directory.";
|
||||||
|
cmSystemTools::Error(message.c_str());
|
||||||
|
} 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsn.c_str());
|
||||||
|
|
||||||
|
// FIXME: compiler detection not implemented
|
||||||
|
// gbuild uses the primaryTarget setting in the top-level project
|
||||||
|
// file to determine which compiler to use. Because compiler
|
||||||
|
// detection is not implemented these variables must be
|
||||||
|
// set to skip past these tests. However cmake will verify that
|
||||||
|
// the executable pointed to by CMAKE_<LANG>_COMPILER exists.
|
||||||
|
// To pass this additional check gbuild is used as a place holder for the
|
||||||
|
// actual compiler.
|
||||||
|
mf->AddDefinition("CMAKE_C_COMPILER", gbuild.c_str());
|
||||||
mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE");
|
mf->AddDefinition("CMAKE_C_COMPILER_ID_RUN", "TRUE");
|
||||||
mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS");
|
mf->AddDefinition("CMAKE_C_COMPILER_ID", "GHS");
|
||||||
mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE");
|
mf->AddDefinition("CMAKE_C_COMPILER_FORCED", "TRUE");
|
||||||
|
|
||||||
mf->AddDefinition("CMAKE_CXX_COMPILER",
|
mf->AddDefinition("CMAKE_CXX_COMPILER", gbuild.c_str());
|
||||||
std::string(ghsCompRootStart + "cxarm.exe").c_str());
|
|
||||||
mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE");
|
mf->AddDefinition("CMAKE_CXX_COMPILER_ID_RUN", "TRUE");
|
||||||
mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS");
|
mf->AddDefinition("CMAKE_CXX_COMPILER_ID", "GHS");
|
||||||
mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE");
|
mf->AddDefinition("CMAKE_CXX_COMPILER_FORCED", "TRUE");
|
||||||
|
|
||||||
if (!ghsCompRoot.empty()) {
|
return true;
|
||||||
static const char* compPreFix = "comp_";
|
}
|
||||||
std::string compFilename =
|
|
||||||
cmsys::SystemTools::FindLastString(ghsCompRoot.c_str(), compPreFix);
|
bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
|
||||||
cmsys::SystemTools::ReplaceString(compFilename, compPreFix, "");
|
cmMakefile* mf)
|
||||||
mf->AddDefinition("CMAKE_SYSTEM_VERSION", compFilename.c_str());
|
{
|
||||||
|
if (p == "") {
|
||||||
|
cmSystemTools::Message(
|
||||||
|
"Green Hills MULTI: -A <arch> not specified; defaulting to \"arm\"");
|
||||||
|
std::string arch = "arm";
|
||||||
|
|
||||||
|
/* store the platform name for later use
|
||||||
|
* -- already done if -A<arch> was specified
|
||||||
|
*/
|
||||||
|
mf->AddCacheDefinition("CMAKE_GENERATOR_PLATFORM", arch.c_str(),
|
||||||
|
"Name of generator platform.",
|
||||||
|
cmStateEnums::INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* tgtPlatform = mf->GetDefinition("GHS_TARGET_PLATFORM");
|
||||||
|
if (tgtPlatform == nullptr) {
|
||||||
|
tgtPlatform = "integrity";
|
||||||
|
}
|
||||||
|
|
||||||
|
/* store the platform name for later use */
|
||||||
|
mf->AddCacheDefinition("GHS_TARGET_PLATFORM", tgtPlatform,
|
||||||
|
"Name of GHS target platform.",
|
||||||
|
cmStateEnums::INTERNAL);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void cmGlobalGhsMultiGenerator::EnableLanguage(
|
||||||
|
std::vector<std::string> const& l, cmMakefile* mf, bool optional)
|
||||||
|
{
|
||||||
|
mf->AddDefinition("CMAKE_SYSTEM_NAME", "GHS-MULTI");
|
||||||
|
|
||||||
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
|
mf->AddDefinition("GHSMULTI", "1"); // identifier for user CMake files
|
||||||
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
|
this->cmGlobalGenerator::EnableLanguage(l, mf, optional);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* mf)
|
bool cmGlobalGhsMultiGenerator::FindMakeProgram(cmMakefile* /*mf*/)
|
||||||
{
|
{
|
||||||
// The GHS generator knows how to lookup its build tool
|
// The GHS generator only knows how to lookup its build tool
|
||||||
// directly instead of needing a helper module to do it, so we
|
// during generation of the project files, but this
|
||||||
// do not actually need to put CMAKE_MAKE_PROGRAM into the cache.
|
// can only be done after the toolset is specified.
|
||||||
if (cmSystemTools::IsOff(mf->GetDefinition("CMAKE_MAKE_PROGRAM"))) {
|
|
||||||
mf->AddDefinition("CMAKE_MAKE_PROGRAM",
|
|
||||||
this->GetGhsBuildCommand().c_str());
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string const& cmGlobalGhsMultiGenerator::GetGhsBuildCommand()
|
void cmGlobalGhsMultiGenerator::GetToolset(cmMakefile* mf, std::string& tsd,
|
||||||
|
std::string& ts)
|
||||||
{
|
{
|
||||||
if (!this->GhsBuildCommandInitialized) {
|
const char* ghsRoot = mf->GetDefinition("GHS_TOOLSET_ROOT");
|
||||||
this->GhsBuildCommandInitialized = true;
|
|
||||||
this->GhsBuildCommand = this->FindGhsBuildCommand();
|
if (!ghsRoot) {
|
||||||
|
ghsRoot = DEFAULT_TOOLSET_ROOT;
|
||||||
}
|
}
|
||||||
return this->GhsBuildCommand;
|
tsd = ghsRoot;
|
||||||
}
|
|
||||||
|
|
||||||
std::string cmGlobalGhsMultiGenerator::FindGhsBuildCommand()
|
if (ts.empty()) {
|
||||||
{
|
std::vector<std::string> output;
|
||||||
std::vector<std::string> userPaths;
|
|
||||||
userPaths.push_back(this->GetCompRoot());
|
|
||||||
std::string makeProgram =
|
|
||||||
cmSystemTools::FindProgram(DEFAULT_MAKE_PROGRAM, userPaths);
|
|
||||||
if (makeProgram.empty()) {
|
|
||||||
makeProgram = DEFAULT_MAKE_PROGRAM;
|
|
||||||
}
|
|
||||||
return makeProgram;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string cmGlobalGhsMultiGenerator::GetCompRoot()
|
// Use latest? version
|
||||||
{
|
cmSystemTools::Glob(tsd, "comp_[^;]+", output);
|
||||||
std::string output;
|
|
||||||
|
|
||||||
const std::vector<std::string> potentialDirsHardPaths(
|
if (output.empty()) {
|
||||||
GetCompRootHardPaths());
|
cmSystemTools::Error("GHS toolset not found in ", tsd.c_str());
|
||||||
const std::vector<std::string> potentialDirsRegistry(GetCompRootRegistry());
|
ts = "";
|
||||||
|
} else {
|
||||||
std::vector<std::string> potentialDirsComplete;
|
ts = output.back();
|
||||||
potentialDirsComplete.insert(potentialDirsComplete.end(),
|
}
|
||||||
potentialDirsHardPaths.begin(),
|
} else {
|
||||||
potentialDirsHardPaths.end());
|
std::string tryPath = tsd + std::string("/") + ts;
|
||||||
potentialDirsComplete.insert(potentialDirsComplete.end(),
|
if (!cmSystemTools::FileExists(tryPath)) {
|
||||||
potentialDirsRegistry.begin(),
|
cmSystemTools::Error("GHS toolset \"", ts.c_str(), "\" not found in ",
|
||||||
potentialDirsRegistry.end());
|
tsd.c_str());
|
||||||
|
ts = "";
|
||||||
// Use latest version
|
|
||||||
std::string outputDirName;
|
|
||||||
for (std::vector<std::string>::const_iterator potentialDirsCompleteIt =
|
|
||||||
potentialDirsComplete.begin();
|
|
||||||
potentialDirsCompleteIt != potentialDirsComplete.end();
|
|
||||||
++potentialDirsCompleteIt) {
|
|
||||||
const std::string dirName(
|
|
||||||
cmsys::SystemTools::GetFilenameName(*potentialDirsCompleteIt));
|
|
||||||
if (dirName.compare(outputDirName) > 0) {
|
|
||||||
output = *potentialDirsCompleteIt;
|
|
||||||
outputDirName = dirName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootHardPaths()
|
|
||||||
{
|
|
||||||
std::vector<std::string> output;
|
|
||||||
cmSystemTools::Glob("C:/ghs", "comp_[^;]+", output);
|
|
||||||
for (std::vector<std::string>::iterator outputIt = output.begin();
|
|
||||||
outputIt != output.end(); ++outputIt) {
|
|
||||||
*outputIt = "C:/ghs/" + *outputIt;
|
|
||||||
}
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> cmGlobalGhsMultiGenerator::GetCompRootRegistry()
|
|
||||||
{
|
|
||||||
std::vector<std::string> output(2);
|
|
||||||
cmsys::SystemTools::ReadRegistryValue(
|
|
||||||
"HKEY_LOCAL_"
|
|
||||||
"MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\"
|
|
||||||
"Windows\\CurrentVersion\\Uninstall\\"
|
|
||||||
"GreenHillsSoftwared771f1b4;InstallLocation",
|
|
||||||
output[0]);
|
|
||||||
cmsys::SystemTools::ReadRegistryValue(
|
|
||||||
"HKEY_LOCAL_"
|
|
||||||
"MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\"
|
|
||||||
"Windows\\CurrentVersion\\Uninstall\\"
|
|
||||||
"GreenHillsSoftware9881cef6;InstallLocation",
|
|
||||||
output[1]);
|
|
||||||
return output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalGhsMultiGenerator::OpenBuildFileStream(
|
void cmGlobalGhsMultiGenerator::OpenBuildFileStream(
|
||||||
@ -216,25 +236,28 @@ void cmGlobalGhsMultiGenerator::OpenBuildFileStream()
|
|||||||
this->OSDirRelative = true;
|
this->OSDirRelative = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
char const* bspName =
|
std::string bspName;
|
||||||
|
char const* bspCache =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_BSP_NAME");
|
||||||
if (NULL == bspName) {
|
if (bspCache) {
|
||||||
bspName = "";
|
bspName = bspCache;
|
||||||
cmSystemTools::Error("GHS_BSP_NAME cache variable must be set");
|
|
||||||
} else {
|
|
||||||
this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME");
|
this->GetCMakeInstance()->MarkCliAsUsed("GHS_BSP_NAME");
|
||||||
}
|
}
|
||||||
std::string fBspName(this->trimQuotes(bspName));
|
if (bspName.empty() || bspName.compare("IGNORE") == 0) {
|
||||||
std::replace(fBspName.begin(), fBspName.end(), '\\', '/');
|
const char* a =
|
||||||
|
this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
|
||||||
|
bspName = "sim";
|
||||||
|
bspName += (a ? a : "");
|
||||||
|
}
|
||||||
|
|
||||||
this->WriteMacros();
|
this->WriteMacros();
|
||||||
this->WriteHighLevelDirectives();
|
this->WriteHighLevelDirectives();
|
||||||
|
|
||||||
GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream());
|
GhsMultiGpj::WriteGpjTag(GhsMultiGpj::PROJECT, this->GetBuildFileStream());
|
||||||
this->WriteDisclaimer(this->GetBuildFileStream());
|
this->WriteDisclaimer(this->GetBuildFileStream());
|
||||||
*this->GetBuildFileStream() << "# Top Level Project File" << std::endl;
|
*this->GetBuildFileStream() << "# Top Level Project File" << std::endl;
|
||||||
if (!fBspName.empty()) {
|
*this->GetBuildFileStream() << " -bsp " << bspName << std::endl;
|
||||||
*this->GetBuildFileStream() << " -bsp " << fBspName << std::endl;
|
|
||||||
}
|
|
||||||
this->WriteCompilerOptions(fOSDir);
|
this->WriteCompilerOptions(fOSDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,8 +298,10 @@ void cmGlobalGhsMultiGenerator::GenerateBuildCommand(
|
|||||||
const std::string& targetName, const std::string& /*config*/, bool /*fast*/,
|
const std::string& targetName, const std::string& /*config*/, bool /*fast*/,
|
||||||
int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions)
|
int jobs, bool /*verbose*/, std::vector<std::string> const& makeOptions)
|
||||||
{
|
{
|
||||||
|
const char* gbuild =
|
||||||
|
this->CMakeInstance->GetCacheDefinition("CMAKE_MAKE_PROGRAM");
|
||||||
makeCommand.push_back(
|
makeCommand.push_back(
|
||||||
this->SelectMakeProgram(makeProgram, this->GetGhsBuildCommand()));
|
this->SelectMakeProgram(makeProgram, (std::string)gbuild));
|
||||||
|
|
||||||
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
|
if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
|
||||||
makeCommand.push_back("-parallel");
|
makeCommand.push_back("-parallel");
|
||||||
@ -313,8 +338,26 @@ void cmGlobalGhsMultiGenerator::WriteMacros()
|
|||||||
|
|
||||||
void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives()
|
void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives()
|
||||||
{
|
{
|
||||||
*this->GetBuildFileStream()
|
/* set primary target */
|
||||||
<< "primaryTarget=arm_integrity.tgt" << std::endl;
|
std::string tgt;
|
||||||
|
const char* t =
|
||||||
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_PRIMARY_TARGET");
|
||||||
|
if (t) {
|
||||||
|
tgt = t;
|
||||||
|
this->GetCMakeInstance()->MarkCliAsUsed("GHS_PRIMARY_TARGET");
|
||||||
|
} else {
|
||||||
|
const char* a =
|
||||||
|
this->GetCMakeInstance()->GetCacheDefinition("CMAKE_GENERATOR_PLATFORM");
|
||||||
|
const char* p =
|
||||||
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_TARGET_PLATFORM");
|
||||||
|
tgt = (a ? a : "");
|
||||||
|
tgt += "_";
|
||||||
|
tgt += (p ? p : "");
|
||||||
|
tgt += ".tgt";
|
||||||
|
}
|
||||||
|
|
||||||
|
*this->GetBuildFileStream() << "primaryTarget=" << tgt << std::endl;
|
||||||
|
|
||||||
char const* const customization =
|
char const* const customization =
|
||||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
||||||
if (NULL != customization && strlen(customization) > 0) {
|
if (NULL != customization && strlen(customization) > 0) {
|
||||||
|
@ -40,13 +40,17 @@ public:
|
|||||||
* Utilized by the generator factory to determine if this generator
|
* Utilized by the generator factory to determine if this generator
|
||||||
* supports toolsets.
|
* supports toolsets.
|
||||||
*/
|
*/
|
||||||
static bool SupportsToolset() { return false; }
|
static bool SupportsToolset() { return true; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utilized by the generator factory to determine if this generator
|
* Utilized by the generator factory to determine if this generator
|
||||||
* supports platforms.
|
* supports platforms.
|
||||||
*/
|
*/
|
||||||
static bool SupportsPlatform() { return false; }
|
static bool SupportsPlatform() { return true; }
|
||||||
|
|
||||||
|
// Toolset / Platform Support
|
||||||
|
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
|
||||||
|
virtual bool SetGeneratorPlatform(std::string const& p, cmMakefile* mf);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Try to determine system information such as shared library
|
* Try to determine system information such as shared library
|
||||||
@ -93,11 +97,7 @@ protected:
|
|||||||
std::vector<std::string> const& makeOptions = std::vector<std::string>());
|
std::vector<std::string> const& makeOptions = std::vector<std::string>());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string const& GetGhsBuildCommand();
|
void GetToolset(cmMakefile* mf, std::string& tsd, std::string& ts);
|
||||||
std::string FindGhsBuildCommand();
|
|
||||||
std::string GetCompRoot();
|
|
||||||
std::vector<std::string> GetCompRootHardPaths();
|
|
||||||
std::vector<std::string> GetCompRootRegistry();
|
|
||||||
void OpenBuildFileStream();
|
void OpenBuildFileStream();
|
||||||
|
|
||||||
void WriteMacros();
|
void WriteMacros();
|
||||||
@ -124,9 +124,8 @@ private:
|
|||||||
std::vector<std::string> LibDirs;
|
std::vector<std::string> LibDirs;
|
||||||
|
|
||||||
bool OSDirRelative;
|
bool OSDirRelative;
|
||||||
bool GhsBuildCommandInitialized;
|
static const char* DEFAULT_BUILD_PROGRAM;
|
||||||
std::string GhsBuildCommand;
|
static const char* DEFAULT_TOOLSET_ROOT;
|
||||||
static const char* DEFAULT_MAKE_PROGRAM;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2260,7 +2260,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
|
|||||||
--build-generator "Green Hills MULTI"
|
--build-generator "Green Hills MULTI"
|
||||||
--build-project ReturnNum
|
--build-project ReturnNum
|
||||||
--build-config $<CONFIGURATION>
|
--build-config $<CONFIGURATION>
|
||||||
--build-options -DGHS_PRIMARY_TARGET="arm_integrity.tgt"
|
--build-options -DGHS_PRIMARY_TARGET=arm_integrity.tgt
|
||||||
-DGHS_BSP_NAME="simarm"
|
-DGHS_BSP_NAME="simarm"
|
||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
Loading…
Reference in New Issue
Block a user