Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/build_xml/Compiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Compilers are run over each of the changed files in each of the filegroups in a
```xml
<objdir value="obj/somewhere" />
```
+ value = usually built programmatically, like `obj/msvc${MSVC_VER}-rt${OBJEXT}${OBJCACHE}${XPOBJ}`
+ value = usually built programmatically, like `obj/msvc-rt${OBJEXT}${OBJCACHE}${XPOBJ}`

- *output* - Flag used to specifying compiler output name.
```xml
Expand Down
2 changes: 0 additions & 2 deletions hxcpp/Builder.hx
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,9 @@ class Builder
case "msvc":
if (isStatic)
{
validArchs.set("2013m32", ["-D"+target, "-DHXCPP_M32", "HXCPP_MSVC_VER=120"].concat(staticFlags) );
validArchs.set("2015m32", ["-D"+target, "-DHXCPP_M32", "HXCPP_MSVC_VER=140"].concat(staticFlags) );
if (wantWindows64())
{
validArchs.set("2013m64", ["-D"+target, "-DHXCPP_M64", "HXCPP_MSVC_VER=120"].concat(staticFlags) );
validArchs.set("2015m64", ["-D"+target, "-DHXCPP_M64", "HXCPP_MSVC_VER=140"].concat(staticFlags) );
}
}
Expand Down
15 changes: 3 additions & 12 deletions toolchain/finish-setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,10 @@
<set name="MSVC_LIB_VERSION" value="-${MSVC_VER}" />
</section>

<set name="LIBEXTRA" value="-19" if="MSVC19" />
<set name="LIBEXTRA" value="-19" if="MSVC_VER" />
<set name="LIBEXTRA" value="-arm64" if="HXCPP_ARM64" />
<set name="HXCPP_M64" value="1" if="HXCPP_ARM64" />
<set name="HX_LINK_SUFFIX" value="-19" if="MSVC19" />
<set name="HX_TARGET_SUFFIX" value="-19" if="MSVC19 static_link" />

<section if="HXCPP_OPTIMIZE_LINK_INCREMENTAL" unless="debug || MSVC19">
<echo value="Warning: INCREMENTAL requies Visual Studio 2015+"/>
<!-- without INCREMENTAL -->
<unset name="HXCPP_OPTIMIZE_LINK_INCREMENTAL"/>
<set name="HXCPP_OPTIMIZE_LINK" value="1"/>
<set name="OBJOPT" value="-opt" if="HXCPP_OPTIMIZE_LINK || HXCPP_OPTIMIZE_LINK_INCREMENTAL" unless="debug" />
<set name="OBJEXT" value="${M64}${F32}${STAT}${OBJDBG}${OBJOPT}${NOCONSOLE}${RPI}${APIFP}${PRIME}" />
</section>
<set name="HX_LINK_SUFFIX" value="-19" if="MSVC_VER" />
<set name="HX_TARGET_SUFFIX" value="-19" if="MSVC_VER static_link" />
</section>
</xml>
47 changes: 0 additions & 47 deletions toolchain/msvc-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,53 +37,6 @@ if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" (
)
@echo HXCPP_VARS
@set
) else if exist "%VS120COMNTOOLS%\vsvars32.bat" (
@call "%VS120COMNTOOLS%\vsvars32.bat"
@if defined HXCPP_WINXP_COMPAT (
@if exist "%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\" (
@set "INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Include;!INCLUDE!"
@set "PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Bin;!PATH!"
@set "LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\v7.1A\Lib;!LIB!"
) else if exist "%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\" (
@set "INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;!INCLUDE!"
@set "PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;!PATH!"
@set "LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;!LIB!"
)

@set HXCPP_XP_DEFINE=_USING_V120_SDK71_
)
@echo HXCPP_VARS
@set
) else if exist "%VS110COMNTOOLS%\vsvars32.bat" (
@call "%VS110COMNTOOLS%\vsvars32.bat"
@if defined HXCPP_WINXP_COMPAT (
@set "INCLUDE=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Include;!INCLUDE!"
@set "PATH=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Bin;!PATH!"
@set "LIB=%ProgramFiles(x86)%\Microsoft SDKs\Windows\7.1A\Lib;!LIB!"
@set HXCPP_XP_DEFINE=_USING_V110_SDK71_
)
@echo HXCPP_VARS
@set
) else if exist "%VS100COMNTOOLS%\vsvars32.bat" (
@call "%VS100COMNTOOLS%\vsvars32.bat"
@echo HXCPP_VARS
@set
) else if exist "%VS90COMNTOOLS%\vsvars32.bat" (
@call "%VS90COMNTOOLS%\vsvars32.bat"
@echo HXCPP_VARS
@set
) else if exist "%VS80COMNTOOLS%\vsvars32.bat" (
@call "%VS80COMNTOOLS%\vsvars32.bat"
@echo HXCPP_VARS
@set
) else if exist "%VS71COMNTOOLS%\vsvars32.bat" (
@call "%VS71COMNTOOLS%\vsvars32.bat"
@echo HXCPP_VARS
@set
) else if exist "%VS70COMNTOOLS%\vsvars32.bat" (
@call "%VS70COMNTOOLS%\vsvars32.bat"
@echo HXCPP_VARS
@set
) else (
echo Warning: Could not find environment variables for Visual Studio
)
13 changes: 6 additions & 7 deletions toolchain/msvc-toolchain.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
</section>
<set name="SUBSYSTEM_VER" value=",6.02" if="HXCPP_ARM64" />

<set name="MSVC_OBJ_DIR" value="obj/msvc${MSVC_VER}${OBJEXT}${OBJCACHE}${XPOBJ}" unless="winrt" />
<set name="MSVC_OBJ_DIR" value="obj/msvc${MSVC_VER}-rt${OBJEXT}${OBJCACHE}${XPOBJ}" if="winrt" />
<set name="MSVC_OBJ_DIR" value="obj/msvc${MSVC_VER}-arm${OBJEXT}${OBJCACHE}${XPOBJ}" if="HXCPP_ARM64" />
<set name="MSVC_OBJ_DIR" value="obj/msvc${OBJEXT}${OBJCACHE}${XPOBJ}" unless="winrt" />
<set name="MSVC_OBJ_DIR" value="obj/msvc-rt${OBJEXT}${OBJCACHE}${XPOBJ}" if="winrt" />
<set name="MSVC_OBJ_DIR" value="obj/msvc-arm${OBJEXT}${OBJCACHE}${XPOBJ}" if="HXCPP_ARM64" />

<set name="MACHINE" value="x86" />
<set name="MACHINE" value="x64" if="HXCPP_M64" />
Expand All @@ -49,16 +49,15 @@
<set name="MSVC_ARCH" value="SSE2" unless="HXCPP_M64" />

<set name="HXCPP_LTCG_INCREMENTAL" value="1" if="HXCPP_OPTIMIZE_LINK_INCREMENTAL"/>
<unset name="HXCPP_FAST_LINK" if="HXCPP_FAST_LINK" unless="MSVC19"/>

<compiler id="MSVC" exe="cl.exe" if="windows">
<flag value="-nologo"/>


<!-- Newer options -->
<!-- <flag value = "/analyze-" if="MSVC17+" /> -->
<flag value = "/WX-" if="MSVC17+" />
<flag value = "/fp:precise" if="MSVC17+" />
<!-- <flag value = "/analyze-" /> -->
<flag value = "/WX-" />
<flag value = "/fp:precise" />
<flag value = "-DWINAPI_FAMILY=WINAPI_FAMILY_APP" if="winrt" />
<flag value = "-DHX_WINRT" if="winrt" />
<flag value = "-errorReport:prompt" if="winrt" />
Expand Down
12 changes: 1 addition & 11 deletions toolchain/msvc64-setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ setlocal enabledelayedexpansion
@echo HXCPP_VARS
@set
@echo HXCPP_HACK_PDBSRV=1
) else if exist "%VS120COMNTOOLS%\..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat" (
@echo "%VS120COMNTOOLS%"
@call "%VS120COMNTOOLS%\..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
@echo HXCPP_VARS
@set
) else if exist "%VS110COMNTOOLS%\..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat" (
@echo "%VS110COMNTOOLS%"
@call "%VS110COMNTOOLS%\..\..\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
@echo HXCPP_VARS
@set
) else (
echo Error: 64bit is not automatically supported for this version of VC. Set HXCPP_MSVC_CUSTOM and manually configure the executable, library and include paths
)
)
26 changes: 11 additions & 15 deletions tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class BuildTool
var defaultObjCxxStandard:Null<Int>;

public static var os="";
public static var sAllowNumProcs = true;
public static var sCompileThreadCount = 1;
public static var sThreadPool:ThreadPool;
public static var sReportedThreads = -1;
Expand Down Expand Up @@ -201,8 +200,8 @@ class BuildTool
if (isMsvc())
{
mDefines.set("isMsvc","1");
if (Std.parseInt(mDefines.get("MSVC_VER"))>=18)
mDefines.set("MSVC18+","1");
// deprecated
mDefines.set("MSVC18+","1");
}

include("toolchain/finish-setup.xml", false);
Expand Down Expand Up @@ -365,19 +364,16 @@ class BuildTool
if (instance!=null)
{
var defs = instance.mDefines;
if (sAllowNumProcs)
{
var thread_var = defs.exists("HXCPP_COMPILE_THREADS") ?
defs.get("HXCPP_COMPILE_THREADS") : Sys.getEnv("HXCPP_COMPILE_THREADS");
var thread_var = defs.exists("HXCPP_COMPILE_THREADS") ?
defs.get("HXCPP_COMPILE_THREADS") : Sys.getEnv("HXCPP_COMPILE_THREADS");

if (thread_var == null)
{
sCompileThreadCount = getNumberOfProcesses();
}
else
{
sCompileThreadCount = (Std.parseInt(thread_var)<2) ? 1 : Std.parseInt(thread_var);
}
if (thread_var == null)
{
sCompileThreadCount = getNumberOfProcesses();
}
else
{
sCompileThreadCount = (Std.parseInt(thread_var)<2) ? 1 : Std.parseInt(thread_var);
}
if (sCompileThreadCount>1 && sThreadPool==null)
sThreadPool = new ThreadPool(sCompileThreadCount);
Expand Down
16 changes: 1 addition & 15 deletions tools/hxcpp/GenMsvc.hx
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,9 @@ class GenMsvc
platformToolset = "v143";
vsVersion = "17";
}
else if (ver >= 18)
{
// cl.exe 18.x = VS 2013
platformToolset = "v120";
vsVersion = "12";
}
else if (ver >= 17)
{
// cl.exe 17.x = VS 2012
platformToolset = "v110";
vsVersion = "11";
}
else
{
// Older versions
platformToolset = "v100";
vsVersion = "10";
Log.error('Unsupported MSVC_VER: ' + ver);
}
}
}
Expand Down
16 changes: 1 addition & 15 deletions tools/hxcpp/Linker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,7 @@ class Linker
}
else
{
var v18 = parts[0] + "-18" + parts[1];
if (FileSystem.exists(v18))
{
Log.info("", " - \x1b[1mUsing MSVC18 compatible library:\x1b[0m " + v18);
libs[i]=v18;
if (!v18Added)
{
v18Added=true;
libs.push( BuildTool.HXCPP + "/lib/Windows/libmsvccompat-18.lib");
}
}
else
{
Log.error("Could not find compatible library for " + lib + ", " + v18 + " does not exist");
}
Log.error("Could not find compatible library for " + lib + ", " + current + " does not exist");
}
}
else
Expand Down
22 changes: 11 additions & 11 deletions tools/hxcpp/Setup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ class Setup
else
{
var ival = Std.parseInt(ioDefines.get("HXCPP_MSVC_VER"));
if (ival>0)
if (ival>=140)
{
var varName = "VS" + ival+ "COMNTOOLS";
var where = Sys.getEnv(varName);
Expand All @@ -812,12 +812,16 @@ class Setup
Sys.putEnv("HXCPP_MSVC", where);
Log.setup('Using MSVC Ver $ival in $where ($varName)');
}
else
else if (ival == null)
{
Log.setup('Using specified MSVC Ver $val');
ioDefines.set("HXCPP_MSVC", val );
Sys.putEnv("HXCPP_MSVC", val);
}
else
{
Log.error('HXCPP_MSVC_VER ${ival} is not supported');
}
}
}

Expand Down Expand Up @@ -915,20 +919,16 @@ class Setup
var cl_version = Std.parseInt(reg.matched(1));
Log.setup("Using MSVC version: " + cl_version);
ioDefines.set("MSVC_VER", cl_version+"");
if (cl_version>=17)
ioDefines.set("MSVC17+","1");
if (cl_version>=18)
ioDefines.set("MSVC18+","1");
if (cl_version==19)
ioDefines.set("MSVC19","1");
BuildTool.sAllowNumProcs = cl_version >= 14;
// deprecated
ioDefines.set("MSVC17+","1");
ioDefines.set("MSVC18+","1");
ioDefines.set("MSVC19","1");
var threads = BuildTool.getThreadCount();
if (threads>1 && cl_version>=18)
if (threads>1)
ioDefines.set("HXCPP_FORCE_PDB_SERVER","1");
}
}
} catch(e:Dynamic){}
//if (cl_version!="") BuildTool.println("Using cl version: " + cl_version);
}

static function toPath(inPath:String)
Expand Down
Loading