GHS: Use shorter object file names on collision
This commit is contained in:
parent
7d2a0aa76c
commit
d7233a0472
|
@ -1,6 +1,7 @@
|
||||||
include(Compiler/GHS)
|
include(Compiler/GHS)
|
||||||
|
|
||||||
set(CMAKE_C_VERBOSE_FLAG "-v")
|
set(CMAKE_C_VERBOSE_FLAG "-v")
|
||||||
|
set(CMAKE_C_OUTPUT_EXTENSION ".o")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS_INIT "")
|
set(CMAKE_C_FLAGS_INIT "")
|
||||||
set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
|
set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
include(Compiler/GHS)
|
include(Compiler/GHS)
|
||||||
|
|
||||||
set(CMAKE_CXX_VERBOSE_FLAG "-v")
|
set(CMAKE_CXX_VERBOSE_FLAG "-v")
|
||||||
|
set(CMAKE_CXX_OUTPUT_EXTENSION ".o")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_INIT "")
|
set(CMAKE_CXX_FLAGS_INIT "")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
|
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "cmSourceFile.h"
|
#include "cmSourceFile.h"
|
||||||
#include "cmTarget.h"
|
#include "cmTarget.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cmAlgorithms.h>
|
|
||||||
|
|
||||||
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
|
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
|
||||||
|
|
||||||
|
@ -466,20 +465,14 @@ cmGhsMultiTargetGenerator::GetObjectNames(
|
||||||
for (std::vector<cmSourceFile*>::const_iterator sf =
|
for (std::vector<cmSourceFile*>::const_iterator sf =
|
||||||
duplicateSources.begin();
|
duplicateSources.begin();
|
||||||
sf != duplicateSources.end(); ++sf) {
|
sf != duplicateSources.end(); ++sf) {
|
||||||
static std::string::size_type const MAX_FULL_PATH_LENGTH = 247;
|
|
||||||
std::string const longestObjectDirectory(
|
std::string const longestObjectDirectory(
|
||||||
cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
|
cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
|
||||||
localGhsMultiGenerator, generatorTarget, *sf));
|
localGhsMultiGenerator, generatorTarget, *sf));
|
||||||
std::string fullFilename = (*sf)->GetFullPath();
|
std::string objFilenameName =
|
||||||
bool const ObjPathFound = cmLocalGeneratorCheckObjectName(
|
localGhsMultiGenerator->GetObjectFileNameWithoutTarget(
|
||||||
fullFilename, longestObjectDirectory.size(), MAX_FULL_PATH_LENGTH);
|
**sf, longestObjectDirectory);
|
||||||
if (!ObjPathFound) {
|
cmsys::SystemTools::ReplaceString(objFilenameName, "/", "_");
|
||||||
cmSystemTools::Error("Object path \"", fullFilename.c_str(),
|
objectNamesCorrected[*sf] = objFilenameName;
|
||||||
"\" too long", "");
|
|
||||||
}
|
|
||||||
cmsys::SystemTools::ReplaceString(fullFilename, ":/", "_");
|
|
||||||
cmsys::SystemTools::ReplaceString(fullFilename, "/", "_");
|
|
||||||
objectNamesCorrected[*sf] = fullFilename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return objectNamesCorrected;
|
return objectNamesCorrected;
|
||||||
|
@ -517,8 +510,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
|
||||||
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
|
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
|
||||||
if (objectNames.end() != objectNames.find(*si)) {
|
if (objectNames.end() != objectNames.find(*si)) {
|
||||||
*this->FolderBuildStreams[sgPath]
|
*this->FolderBuildStreams[sgPath]
|
||||||
<< " -o \"" << objectNames.find(*si)->second << ".o\""
|
<< " -o \"" << objectNames.find(*si)->second << "\"" << std::endl;
|
||||||
<< std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->WriteObjectDir(this->FolderBuildStreams[sgPath],
|
this->WriteObjectDir(this->FolderBuildStreams[sgPath],
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(demo C)
|
project(demo C)
|
||||||
|
|
||||||
add_library(libdemo test.c subfolder/test.c)
|
add_library(libdemo
|
||||||
|
test.c
|
||||||
|
subfolder_test.c
|
||||||
|
subfolder_test_0.c
|
||||||
|
"subfolder/test.c"
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(demo main.c)
|
add_executable(demo main.c)
|
||||||
target_link_libraries(demo libdemo)
|
target_link_libraries(demo libdemo)
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
int test_a(void);
|
int test_a(void);
|
||||||
int test_b(void);
|
int test_b(void);
|
||||||
|
int test_c(void);
|
||||||
|
int test_d(void);
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
test_a();
|
test_a();
|
||||||
test_b();
|
test_b();
|
||||||
|
test_c();
|
||||||
|
test_d();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
int test_c()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
int test_d()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
Loading…
Reference in New Issue