From cedf493ce90ab7798b6e0c0ae84fd2702e6eaac1 Mon Sep 17 00:00:00 2001 From: Natan Date: Sun, 18 Aug 2024 20:30:19 -0300 Subject: [PATCH] update MSVC target to use native multicore build --- .../jparser/builder/DefaultBuildTarget.java | 2 +- .../builder/targets/WindowsMSVCTarget.java | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/DefaultBuildTarget.java b/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/DefaultBuildTarget.java index bc4d66b..140808d 100644 --- a/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/DefaultBuildTarget.java +++ b/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/DefaultBuildTarget.java @@ -95,7 +95,7 @@ else if(!shouldCompile && shouldLink) { } } - private boolean compile(BuildConfig config, CustomFileDescriptor buildTargetTemp, ArrayList cppFiles) { + protected boolean compile(BuildConfig config, CustomFileDescriptor buildTargetTemp, ArrayList cppFiles) { boolean retFlag = false; String compiledPaths = ""; diff --git a/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/targets/WindowsMSVCTarget.java b/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/targets/WindowsMSVCTarget.java index e190a20..c3d73c9 100644 --- a/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/targets/WindowsMSVCTarget.java +++ b/jParser/builder/src/main/java/com/github/xpenatan/jparser/builder/targets/WindowsMSVCTarget.java @@ -2,6 +2,8 @@ import com.github.xpenatan.jparser.builder.BuildConfig; import com.github.xpenatan.jparser.builder.DefaultBuildTarget; +import com.github.xpenatan.jparser.core.util.CustomFileDescriptor; +import java.util.ArrayList; public class WindowsMSVCTarget extends DefaultBuildTarget { @@ -58,4 +60,17 @@ protected void setup(BuildConfig config) { linkerCompiler.add("/NOLOGO"); linkerCompiler.add("/MACHINE:X64"); } + + @Override + protected boolean compile(BuildConfig config, CustomFileDescriptor buildTargetTemp, ArrayList cppFiles) { + boolean multiCoreCompile = this.multiCoreCompile; + this.multiCoreCompile = false; + if(multiCoreCompile) { + // Use native MSVC multi core support + cppCompiler.add("/MP"); + } + boolean compile = super.compile(config, buildTargetTemp, cppFiles); + this.multiCoreCompile = multiCoreCompile; + return compile; + } }