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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1842 - (download) (annotate)
Sat Apr 14 00:39:22 2012 UTC (7 years, 5 months ago) by jhr
File size: 2927 byte(s)
  porting updates from vis12 branch into trunk
(* paths.sml
 *
 * COPYRIGHT (c) 2011 The Diderot Project (http://diderot-language.cs.uchicago.edu)
 * All rights reserved.
 *
 * @configure_input@
 *)

structure Paths =
  struct

    local
      val // = OS.Path.concat
      infixr 4 //
    in
  (* directories for Diderot stuff *)
    val diderotBin = "@DIDEROT_ROOT@" // "bin"
    val diderotLib = "@DIDEROT_ROOT@" // "lib"
    val diderotSrc = "@DIDEROT_ROOT@" // "src"
    val diderotInclude = diderotSrc // "include"

  (* directories for Teem stuff *)
    val teemBin = "@TEEM_DIR@" // "bin"
    val teemInclude = "@TEEM_DIR@" // "include"
    val teemLib = "@TEEM_DIR@" // "lib"
    val teemLinkFlags = if @LD_NEEDS_RPATH@
	  then ["-Wl,-rpath=" ^ teemLib, "-L" ^ teemLib, "-lteem"]
	  else ["-L" ^ teemLib, "-lteem"]

  (* installation directories for Diderot stuff *)
    val installBin = "@prefix@" // "bin"
    val installInclude = "@prefix@" // "include"
    val installLib = "@prefix@" // "lib"

  (* paths to some useful tools *)
    local
    (* get the user's PATH environment variable as a list of paths.  Note that this is
     * executed at build time.
     *)
      val PATH = let
	    val path = (case (OS.Process.getEnv "PATH") of (SOME p) => p | _ => "")
	    in
	       String.fields (fn #":" => true | _ => false) path
	    end (* getPath *)
(* FIXME: won't need the isAbsolute check in 110.75 *)
      fun findExe (paths, name) = if OS.Path.isAbsolute name
	    then name
	    else (case PathUtil.findExe paths name
	       of SOME p => p
		| NONE => raise Fail(concat["unable to find ", name, " executable"])
	      (* end case *))
    in
    val dnorm = findExe ([diderotBin, installBin, diderotSrc // "dnorm"], "dnorm")
    val cc = let
	  val (cmd::args) = String.tokens Char.isSpace "@CC@"
	  val cmd = findExe (PATH, cmd)
	  val args = if ("@CFLAG_M64@" <> "") then "@CFLAG_M64@" :: args else args
	  in
	    String.concatWith " " (cmd::args)
	  end
    val cflags = {
	    base = "@CFLAGS_BASE@",
	    pthread = "@PTHREAD_CFLAGS@",
            cl = "@CPPFLAGS_CL@",
	    debug = "-g -O0",
(*	    ndebug = "-march=native -O3 -DNDEBUG" *)  (* gcc complains about -march=native, even though the man page says it is supported *)
	    ndebug = "-O3 -DNDEBUG"
	  }
    val ld = let
	  val (cmd::args) = String.tokens Char.isSpace "@LD@"
	  val cmd = findExe (PATH, cmd)
	  in
	    String.concatWith " " (cmd :: args)
	  end
    val extraLibs = {
	    base = "@LIBM@",
	    pthread = "@PTHREAD_LIBS@",
	    cl = "@CL_LIBS@"
	  }
    end (* local *)

  (* other configuration options *)
    val clEnabled = @CL_ENABLED@
    val clVersion = if clEnabled
	  then let
	    val major = @CL_VERSION@ div 10000
	    val minor = (@CL_VERSION@ div 100) mod 100
	    val patch = @CL_VERSION@ mod 100
	    in
	      if patch > 0 then [major, minor, patch] else [major, minor]
	    end
	  else []
    val cudaEnabled = @CUDA_ENABLED@
    end (* local *)

  end

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