mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-12 02:43:14 +01:00
Use .obj extension on Windows.
The Windows linker LINK insists on the .obj extension. The following changes are made: - CMake uses the same extension as the C compiler - global.obj_ext_alt (aka .obj) is recognized as objectfile extension - global.obj_ext_alt is used on Windows
This commit is contained in:
@@ -72,9 +72,7 @@ Global::Global()
|
|||||||
bc_ext = "bc";
|
bc_ext = "bc";
|
||||||
s_ext = "s";
|
s_ext = "s";
|
||||||
obj_ext = "o";
|
obj_ext = "o";
|
||||||
#if _WIN32
|
|
||||||
obj_ext_alt = "obj";
|
obj_ext_alt = "obj";
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
#if TARGET_WINDOS
|
#if TARGET_WINDOS
|
||||||
obj_ext = "obj";
|
obj_ext = "obj";
|
||||||
|
|||||||
10
dmd2/mars.h
10
dmd2/mars.h
@@ -285,12 +285,10 @@ struct Global
|
|||||||
const char *sym_ext;
|
const char *sym_ext;
|
||||||
const char *obj_ext;
|
const char *obj_ext;
|
||||||
#if IN_LLVM
|
#if IN_LLVM
|
||||||
#if _WIN32
|
const char *obj_ext_alt;
|
||||||
char *obj_ext_alt;
|
const char *ll_ext;
|
||||||
#endif
|
const char *bc_ext;
|
||||||
char *ll_ext;
|
const char *s_ext;
|
||||||
char *bc_ext;
|
|
||||||
char *s_ext;
|
|
||||||
#endif
|
#endif
|
||||||
const char *lib_ext;
|
const char *lib_ext;
|
||||||
const char *dll_ext;
|
const char *dll_ext;
|
||||||
|
|||||||
@@ -358,10 +358,10 @@ void Module::buildTargetFiles(bool singleObj)
|
|||||||
if(!objfile)
|
if(!objfile)
|
||||||
{
|
{
|
||||||
if (global.params.output_o)
|
if (global.params.output_o)
|
||||||
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.obj_ext);
|
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.params.os == OSWindows ? global.obj_ext_alt : global.obj_ext);
|
||||||
else if (global.params.output_bc)
|
else if (global.params.output_bc)
|
||||||
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext);
|
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext);
|
||||||
else if (global.params.output_ll)
|
else if (global.params.output_ll)
|
||||||
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.ll_ext);
|
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.ll_ext);
|
||||||
else if (global.params.output_s)
|
else if (global.params.output_s)
|
||||||
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.s_ext);
|
objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.s_ext);
|
||||||
|
|||||||
@@ -391,17 +391,16 @@ int main(int argc, char** argv)
|
|||||||
} else if (strcmp(ext, global.s_ext) == 0) {
|
} else if (strcmp(ext, global.s_ext) == 0) {
|
||||||
global.params.output_s = OUTPUTFLAGset;
|
global.params.output_s = OUTPUTFLAGset;
|
||||||
autofound = true;
|
autofound = true;
|
||||||
} else if (strcmp(ext, global.obj_ext) == 0) {
|
} else if (strcmp(ext, global.obj_ext) == 0 || strcmp(ext, global.obj_ext_alt) == 0) {
|
||||||
global.params.output_o = OUTPUTFLAGset;
|
global.params.output_o = OUTPUTFLAGset;
|
||||||
autofound = true;
|
autofound = true;
|
||||||
} else {
|
} else {
|
||||||
// append dot, so forceExt won't change existing name even if it contains dots
|
// append dot, so forceExt won't change existing name even if it contains dots
|
||||||
size_t len = strlen(global.params.objname);
|
size_t len = strlen(global.params.objname);
|
||||||
size_t extlen = strlen(".");
|
char* s = static_cast<char *>(mem.malloc(len + 1 + 1));
|
||||||
char* s = static_cast<char *>(mem.malloc(len + 1 + extlen + 1));
|
|
||||||
memcpy(s, global.params.objname, len);
|
memcpy(s, global.params.objname, len);
|
||||||
s[len] = '.';
|
s[len] = '.';
|
||||||
s[len+1+extlen] = 0;
|
s[len+1] = 0;
|
||||||
global.params.objname = s;
|
global.params.objname = s;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ macro(dc INPUT_D OUTLIST_O OUTLIST_BC MOREFLAGS PATH SUFFIX)
|
|||||||
else ("${path}" STREQUAL "")
|
else ("${path}" STREQUAL "")
|
||||||
set(output ${path}/${name})
|
set(output ${path}/${name})
|
||||||
endif ("${path}" STREQUAL "")
|
endif ("${path}" STREQUAL "")
|
||||||
set(OUTPUT_O ${PROJECT_BINARY_DIR}/${output}${SUFFIX}.o)
|
set(OUTPUT_O ${PROJECT_BINARY_DIR}/${output}${SUFFIX}${CMAKE_C_OUTPUT_EXTENSION})
|
||||||
set(OUTPUT_BC ${PROJECT_BINARY_DIR}/${output}${SUFFIX}.bc)
|
set(OUTPUT_BC ${PROJECT_BINARY_DIR}/${output}${SUFFIX}.bc)
|
||||||
list(APPEND ${OUTLIST_O} ${OUTPUT_O})
|
list(APPEND ${OUTLIST_O} ${OUTPUT_O})
|
||||||
list(APPEND ${OUTLIST_BC} ${OUTPUT_BC})
|
list(APPEND ${OUTLIST_BC} ${OUTPUT_BC})
|
||||||
|
|||||||
Reference in New Issue
Block a user