Эх сурвалжийг харах

C preprocessor now also includes from directory containing the civcc binary

Taddeus Kroes 11 жил өмнө
parent
commit
5dcc4b4a9d
2 өөрчлөгдсөн 10 нэмэгдсэн , 3 устгасан
  1. 5 2
      phases/load.ml
  2. 5 1
      phases/load.mli

+ 5 - 2
phases/load.ml

@@ -5,8 +5,11 @@ open Util
  * -nostdinc        : Don't include from C stdlib
  * -C               : Don't remove comments
  * -traditional-cpp : Don't remove excessive whitespaces, so that error
- *                    messages preserve correct character locations *)
-let cpp_cmd = "cpp -nostdinc -C -traditional-cpp -I" ^ Sys.getcwd ()
+ *                    messages preserve correct character locations
+ * -I               : Add working dir and executable dir to include dirs *)
+let cpp_cmd = "cpp -nostdinc -C -traditional-cpp \
+               -I" ^ Sys.getcwd () ^ " \
+               -I" ^ (Filename.dirname Sys.executable_name)
 
 let input_all ic =
   let n = in_channel_length ic in

+ 5 - 1
phases/load.mli

@@ -7,7 +7,11 @@
     the C preprocessor is called by calling the command [cpp -nostdinc -C
     -traditional-cpp] (see source code for comments on [cpp] arguments). The
     preprocessed code is passed to the next phase in a [FileContent]
-    constructor. *)
+    constructor.
+
+    The C preprocessor is called with the current working directory and the
+    directory containing the [civcc] executable as include directories (mainy
+    to be able to conveniently saving [civic.h]). *)
 
 (** Main phase function, called by {!Main}. *)
 val phase : Main.phase_func