Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Annotation of /trunk/src/compiler/common/paths_sml.in
ViewVC logotype

Annotation of /trunk/src/compiler/common/paths_sml.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1232 - (view) (download)

1 : jhr 1115 (* paths.sml
2 :     *
3 :     * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
4 :     * All rights reserved.
5 :     *
6 :     * @configure_input@
7 :     *)
8 :    
9 :     structure Paths =
10 :     struct
11 :    
12 :     local
13 :     val // = OS.Path.concat
14 :     infixr 4 //
15 :     in
16 :     (* directories for Diderot stuff *)
17 :     val diderotBin = "@DIDEROT_ROOT@" // "bin"
18 : jhr 1232 val diderotLib = "@DIDEROT_ROOT@" // "lib"
19 : jhr 1115 val diderotSrc = "@DIDEROT_ROOT@" // "src"
20 : jhr 1232 val diderotInclude = diderotSrc // "include"
21 : jhr 1115
22 :     (* directories for Teem stuff *)
23 :     val teemBin = "@TEEM_DIR@" // "bin"
24 :     val teemInclude = "@TEEM_DIR@" // "include"
25 :     val teemLib = "@TEEM_DIR@" // "lib"
26 :     val teemLinkFlags = if @LD_NEEDS_RPATH@
27 :     then ["-Wl,-rpath=" ^ teemLib, "-L" ^ teemLib, "-lteem"]
28 :     else ["-L" ^ teemLib, "-lteem"]
29 :    
30 :     (* installation directories for Diderot stuff *)
31 :     val installBin = "@prefix@" // "bin"
32 :     val installInclude = "@prefix@" // "include"
33 :     val installLib = "@prefix@" // "lib"
34 :    
35 :     (* paths to some useful tools *)
36 :     local
37 :     (* get the user's PATH environment variable as a list of paths. Note that this is
38 :     * executed at build time.
39 :     *)
40 :     val PATH = let
41 :     val path = (case (OS.Process.getEnv "PATH") of (SOME p) => p | _ => "")
42 :     in
43 :     String.fields (fn #":" => true | _ => false) path
44 :     end (* getPath *)
45 :     (* FIXME: with SML/NJ 110.73, we'll be able to use PathUtil.findExe *)
46 :     fun findExe (paths, name) = let
47 :     fun isExe p = OS.FileSys.access(p, [OS.FileSys.A_EXEC])
48 :     in
49 :     if OS.Path.isAbsolute name
50 :     then if isExe name
51 :     then name
52 :     else raise Fail(name ^" is not executable")
53 :     else (case PathUtil.existsFile isExe paths name
54 :     of SOME cmd => cmd
55 :     | NONE => raise Fail(concat["unable to find ", name, " executable"])
56 :     (* end case *))
57 :     end
58 :     in
59 :     val dnorm = findExe ([diderotBin, installBin, diderotSrc // "dnorm"], "dnorm")
60 :     val cc = let
61 :     val (cmd::args) = String.tokens Char.isSpace "@CC@"
62 :     val cmd = findExe (PATH, cmd)
63 :     val args = if ("@CFLAG_M64@" <> "") then "@CFLAG_M64@" :: args else args
64 :     in
65 :     String.concatWith " " (cmd::args)
66 :     end
67 : jhr 1232 val cflags = {
68 :     base = "@CFLAGS_BASE@",
69 :     pthread = "@PTHREAD_CFLAGS@",
70 :     debug = "-g -O0",
71 :     (* ndebug = "-march=native -O3 -DNDEBUG" *) (* gcc complains about -march=native, even though the man page says it is supported *)
72 :     ndebug = "-O3 -DNDEBUG"
73 :     }
74 :     val extraLibs = {
75 :     base = "@LIBM@",
76 :     pthread = "@PTHREAD_LIBS@",
77 :     cl = "@CL_LIBS@"
78 :     }
79 : jhr 1115 end (* local *)
80 : jhr 1232
81 :     (* other configuration options *)
82 :     val clEnabled = @CL_ENABLED@
83 :     val clVersion = if clEnabled
84 :     then let
85 :     val major = @CL_VERSION@ div 10000
86 :     val minor = (@CL_VERSION@ div 100) mod 100
87 :     val patch = @CL_VERSION@ mod 100
88 :     in
89 :     if patch > 0 then [major, minor, patch] else [major, minor]
90 :     end
91 :     else []
92 :     val cudaEnabled = @CUDA_ENABLED@
93 : jhr 1115 end (* local *)
94 :    
95 :     end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0