Skip to content

Commit

Permalink
Use different flags for MSVC
Browse files Browse the repository at this point in the history
Signed-off-by: Ulysse Gérard <[email protected]>
  • Loading branch information
voodoos committed Dec 3, 2020
1 parent 5746ebd commit c01df9c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/dune_rules/cxx_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,17 @@ let rules ~sctx ~dir =
(* let tmp = Path.External.of_string (Filename.get_temp_dir_name ()) in *)
let header_file = Path.Build.relative dir "header_check.h" in
let write_test_file = Action.write_file header_file header_file_content in
let args =
let open Command.Args in
( match Ocaml_config.ccomp_type ocfg with
| Msvc -> [ A "/EP" ]
| Other _ -> [ A "-E"; A "-P" ] )
@ [ A Path.(to_absolute_filename (build header_file)) ]
in
let action =
let open Build.With_targets.O in
let+ run_preprocessor =
Command.run ~dir:(Path.build dir) ~stdout_to:file prog
Command.Args.
[ A "-EP"; A Path.(to_absolute_filename (build header_file)) ]
Command.run ~dir:(Path.build dir) ~stdout_to:file prog args
in
Action.progn [ write_test_file; run_preprocessor ]
in
Expand Down

0 comments on commit c01df9c

Please sign in to comment.