modified ReactOS-generic.rbuild

modified   ReactOS-i386.rbuild
modified   tools/rbuild/backend/mingw/mingw.cpp
   Don't feed GCC options in MSC
   Minor detection fixes

Support for the Microsoft compiler is now fully functional: now get off your grotesquely fat asses and start fixing code so that it compiles with it

TODO: make it fully functional for real (PCH, full dependencies); Microsoft linker support

svn path=/trunk/; revision=41374
This commit is contained in:
KJK::Hyperion 2009-06-10 19:12:18 +00:00
parent c828055508
commit e1dbbac2c4
3 changed files with 94 additions and 53 deletions

View file

@ -121,5 +121,5 @@
<xi:include href="tools/tools.rbuild" /> <xi:include href="tools/tools.rbuild" />
</directory> </directory>
<compilerflag compiler="cxx">-Wno-non-virtual-dtor</compilerflag> <compilerflag compiler="cxx" compilerset="gcc">-Wno-non-virtual-dtor</compilerflag>
</group> </group>

View file

@ -19,30 +19,64 @@
<property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/> <property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
<property name="PLATFORM" value="PC"/> <property name="PLATFORM" value="PC"/>
<if property="OPTIMIZE" value="1"> <group compilerset="gcc">
<compilerflag>-Os</compilerflag> <if property="OPTIMIZE" value="1">
<compilerflag>-ftracer</compilerflag> <compilerflag>-Os</compilerflag>
<compilerflag>-momit-leaf-frame-pointer</compilerflag> <compilerflag>-ftracer</compilerflag>
</if> <compilerflag>-momit-leaf-frame-pointer</compilerflag>
<if property="OPTIMIZE" value="2"> </if>
<compilerflag>-Os</compilerflag> <if property="OPTIMIZE" value="2">
</if> <compilerflag>-Os</compilerflag>
<if property="OPTIMIZE" value="3"> </if>
<compilerflag>-O1</compilerflag> <if property="OPTIMIZE" value="3">
</if> <compilerflag>-O1</compilerflag>
<if property="OPTIMIZE" value="4"> </if>
<compilerflag>-O2</compilerflag> <if property="OPTIMIZE" value="4">
</if> <compilerflag>-O2</compilerflag>
<if property="OPTIMIZE" value="5"> </if>
<compilerflag>-O3</compilerflag> <if property="OPTIMIZE" value="5">
</if> <compilerflag>-O3</compilerflag>
</if>
<compilerflag>-mpreferred-stack-boundary=2</compilerflag> <compilerflag>-mpreferred-stack-boundary=2</compilerflag>
<compilerflag>-fno-strict-aliasing</compilerflag> <compilerflag>-fno-strict-aliasing</compilerflag>
<compilerflag>-Wno-strict-aliasing</compilerflag> <compilerflag>-Wno-strict-aliasing</compilerflag>
<compilerflag>-Wpointer-arith</compilerflag> <compilerflag>-Wpointer-arith</compilerflag>
<compilerflag>-Wno-multichar</compilerflag> <compilerflag>-Wno-multichar</compilerflag>
<!-- compilerflag>-H</compilerflag> enable this for header traces --> <!-- compilerflag>-H</compilerflag> enable this for header traces -->
<linkerflag>-disable-stdcall-fixup</linkerflag> </group>
<group compilerset="msc">
<if property="OPTIMIZE" value="1">
<compilerflag>/O1</compilerflag>
</if>
<if property="OPTIMIZE" value="2">
<compilerflag>/O2</compilerflag>
</if>
<if property="OPTIMIZE" value="3">
<compilerflag>/Ox /GS-</compilerflag>
<compilerflag>/Ot</compilerflag>
</if>
<if property="OPTIMIZE" value="4">
<compilerflag>/Ox /GS-</compilerflag>
<compilerflag>/Os</compilerflag>
</if>
<if property="OPTIMIZE" value="5">
<compilerflag>/Ox /GS-</compilerflag>
<compilerflag>/Os</compilerflag>
<compilerflag>/Ob2</compilerflag>
<compilerflag>/GF</compilerflag>
<compilerflag>/Gy</compilerflag>
</if>
<compilerflag>/GS-</compilerflag>
<compilerflag>/Zl</compilerflag>
<compilerflag>/Zi</compilerflag>
<compilerflag>/Wall</compilerflag>
</group>
<group linkerset="ld">
<linkerflag>-disable-stdcall-fixup</linkerflag>
</group>
</project> </project>

View file

@ -453,39 +453,42 @@ MingwBackend::GenerateGlobalVariables () const
GenerateGlobalProperties ( "=", ProjectNode.non_if_data ); GenerateGlobalProperties ( "=", ProjectNode.non_if_data );
fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" ); if ( ProjectNode.configuration.Compiler == GnuGcc )
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -Wall\n" ); {
fprintf ( fMakefile, "ifneq ($(OARCH),)\n" ); fprintf ( fMakefile, "PROJECT_CFLAGS += -Wall\n" );
fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" ); fprintf ( fMakefile, "PROJECT_CXXFLAGS += -Wall\n" );
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -march=$(OARCH)\n" ); fprintf ( fMakefile, "ifneq ($(OARCH),)\n" );
fprintf ( fMakefile, "endif\n" ); fprintf ( fMakefile, "PROJECT_CFLAGS += -march=$(OARCH)\n" );
fprintf ( fMakefile, "ifneq ($(TUNE),)\n" ); fprintf ( fMakefile, "PROJECT_CXXFLAGS += -march=$(OARCH)\n" );
fprintf ( fMakefile, "PROJECT_CFLAGS += -mtune=$(TUNE)\n" ); fprintf ( fMakefile, "endif\n" );
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -mtune=$(TUNE)\n" ); fprintf ( fMakefile, "ifneq ($(TUNE),)\n" );
fprintf ( fMakefile, "endif\n" ); fprintf ( fMakefile, "PROJECT_CFLAGS += -mtune=$(TUNE)\n" );
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -mtune=$(TUNE)\n" );
fprintf ( fMakefile, "endif\n" );
fprintf ( fMakefile, "PROJECT_CFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" ); fprintf ( fMakefile, "PROJECT_CFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" );
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" ); fprintf ( fMakefile, "PROJECT_CXXFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" );
fprintf ( fMakefile, "PROJECT_ASFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" ); fprintf ( fMakefile, "PROJECT_ASFLAGS += -g%s\n", Environment::GetArch() == "amd64" ? "dwarf-2" : "stabs+" );
if ( usePipe )
{
fprintf ( fMakefile, "PROJECT_CFLAGS += -pipe\n" );
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -pipe\n" );
fprintf ( fMakefile, "PROJECT_ASFLAGS += -pipe\n" );
}
// Because RosBE gcc is built to suck
fputs ( "BUILTIN_HOST_CINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
fputs ( "BUILTIN_HOST_CPPINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
fputs ( "BUILTIN_HOST_CXXINCLUDES+= $(HOST_CPPFLAGS)\n", fMakefile );
// Would be nice to have our own C++ runtime
fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
}
MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data ); MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data );
MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data ); MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data );
if ( usePipe )
{
fprintf ( fMakefile, "PROJECT_CFLAGS += -pipe\n" );
fprintf ( fMakefile, "PROJECT_CXXFLAGS += -pipe\n" );
fprintf ( fMakefile, "PROJECT_ASFLAGS += -pipe\n" );
}
// Because RosBE gcc is built to suck
fputs ( "BUILTIN_HOST_CINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
fputs ( "BUILTIN_HOST_CPPINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
fputs ( "BUILTIN_HOST_CXXINCLUDES+= $(HOST_CPPFLAGS)\n", fMakefile );
// Would be nice to have our own C++ runtime
fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
// TODO: linker flags // TODO: linker flags
fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () ); fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () );
fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)' '$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)'\n" ); fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)' '$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)'\n" );
@ -771,6 +774,7 @@ MingwBackend::DetectCompiler ()
} }
else if ( ProjectNode.configuration.Compiler == MicrosoftC ) else if ( ProjectNode.configuration.Compiler == MicrosoftC )
{ {
compilerCommand = "cl";
detectedCompiler = DetectMicrosoftCompiler ( compilerVersion, mscPath ); detectedCompiler = DetectMicrosoftCompiler ( compilerVersion, mscPath );
supportedCompiler = true; // TODO supportedCompiler = true; // TODO
} }
@ -1015,6 +1019,7 @@ MingwBackend::DetectBinutils ()
} }
else if ( ProjectNode.configuration.Linker == MicrosoftLink ) else if ( ProjectNode.configuration.Linker == MicrosoftLink )
{ {
compilerCommand = "link";
detectedBinutils = DetectMicrosoftLinker ( binutilsVersion, mslinkPath ); detectedBinutils = DetectMicrosoftLinker ( binutilsVersion, mslinkPath );
supportedBinutils = true; // TODO supportedBinutils = true; // TODO
} }
@ -1094,6 +1099,8 @@ MingwBackend::DetectPipeSupport ()
else else
printf ( "not detected\n" ); printf ( "not detected\n" );
} }
else
usePipe = false;
} }
void void