| Anonymous | Login | Signup for a new account | 2013-06-20 01:46 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||
| 0005823 | OCaml | OCaml backend (code generation) | public | 2012-11-14 10:47 | 2012-11-14 10:47 | ||||||
| Reporter | daweil | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | feature | Reproducibility | always | ||||||
| Status | new | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | 4.00.1 | ||||||||||
| Target Version | Fixed in Version | ||||||||||
| Summary | 0005823: wish that ocamlopt compile .cpp files as well as c files | ||||||||||
| Description | I tried the following very simple patch that seems to work : diff -ur ocaml-4.00.1/driver/main.ml ocaml-4.00.1_patched/driver/main.ml --- ocaml-4.00.1/driver/main.ml Wed May 30 13:29:48 2012 +++ ocaml-4.00.1_patched/driver/main.ml Thu Nov 8 11:27:45 2012 @@ -52,7 +52,7 @@ ccobjs := name :: !ccobjs else if Filename.check_suffix name ext_dll then dllibs := name :: !dllibs - else if Filename.check_suffix name ".c" then begin + else if Filename.check_suffix name ".c" or Filename.check_suffix name ".cpp" then begin Compile.c_file name; ccobjs := (Filename.chop_suffix (Filename.basename name) ".c" ^ ext_obj) :: !ccobjs diff -ur ocaml-4.00.1/driver/optmain.ml ocaml-4.00.1_patched/driver/optmain.ml --- ocaml-4.00.1/driver/optmain.ml Wed May 30 13:29:48 2012 +++ ocaml-4.00.1_patched/driver/optmain.ml Thu Nov 8 11:34:20 2012 @@ -51,7 +51,7 @@ else if Filename.check_suffix name ext_obj || Filename.check_suffix name ext_lib then ccobjs := name :: !ccobjs - else if Filename.check_suffix name ".c" then begin + else if Filename.check_suffix name ".c" or Filename.check_suffix name ".cpp" then begin Optcompile.c_file name; ccobjs := (Filename.chop_suffix (Filename.basename name) ".c" ^ ext_obj) :: !ccobjs and add the following rule for ocamlbuild: rule "C files cpp -> o" ~insert:`top ~prod:x_o ~dep:"%.cpp" begin fun env _build -> let c = env "%.cpp" in let o = env x_o in let comp = if Tags.mem "native" (tags_of_pathname c) then !Options.ocamlopt else !Options.ocamlc in let cc = Cmd(S[comp; T(tags_of_pathname c++"c"++"compile"); A"-c"; Px c]) in if Pathname.dirname o = Pathname.current_dir_name then cc else Seq[cc; mv (Pathname.basename o) o] end; | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2012-11-14 10:47 | daweil | New Issue | |
| Copyright © 2000 - 2011 MantisBT Group |