Skip to content

Commit

Permalink
update MSVC target to use native multicore build
Browse files Browse the repository at this point in the history
  • Loading branch information
xpenatan committed Aug 18, 2024
1 parent 77cc2aa commit cedf493
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ else if(!shouldCompile && shouldLink) {
}
}

private boolean compile(BuildConfig config, CustomFileDescriptor buildTargetTemp, ArrayList<CustomFileDescriptor> cppFiles) {
protected boolean compile(BuildConfig config, CustomFileDescriptor buildTargetTemp, ArrayList<CustomFileDescriptor> cppFiles) {
boolean retFlag = false;

String compiledPaths = "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down Expand Up @@ -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<CustomFileDescriptor> 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;
}
}

0 comments on commit cedf493

Please sign in to comment.