<source id="4vppl"><ins id="4vppl"></ins></source>
<u id="4vppl"><sub id="4vppl"><label id="4vppl"></label></sub></u>
<object id="4vppl"></object>
  • <u id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></u>

    <object id="4vppl"></object>
    <b id="4vppl"><sub id="4vppl"><tr id="4vppl"></tr></sub></b>

      <i id="4vppl"><thead id="4vppl"></thead></i>

      <thead id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></thead>

      當前位置:首頁 > 網站舊欄目 > 學習園地 > 設計軟件教程 > 用Rant自動化D語言程序構建

      用Rant自動化D語言程序構建
      2010-01-13 21:07:23  作者:  來源:

      用Rant自動化D語言程序構建
          
      上回說到 Rank 這個 Ruby 世界最廣泛使用的構建工具在 Windows 下有大bug,根本不能運行。Python的scons太慢、自動得過了頭,造成定制起來很麻煩.....
      最終,我找到了一個叫 Rant 的Ruby構建工具,用起來幾乎與 Rank一樣,而且特性更多,最重要的是能在 windows 下面正常運行。因此我強烈推薦各位D語言的粉絲使用Rant作為軟件構建工具,放棄那些不成熟的IDE。用Rant的好處是還能順帶學習一下Ruby語言,對于像我一樣的Ruby&&D雙料菜鳥,這是不可多得的學習機會。

      如果沒有Ruby,請先下載安裝 Ruby。 然后在控制臺中輸入:gem --remote install rant,系統將會自動安裝并配置好 rant
      下面是我寫的 for DMD 萬用 Rantfile 模板,只要把它放到你的D程序所在的目錄,稍加修改就能使用。

      RANTFILE 代碼
      # The Rantfile for DMD

      # Author: oldrev (wstringgmail.com)
      # No copyrights, use it freely

      import "AutoClean"

      #require "rant/filelist"

      # 請自行定義下面幾行

      NAME = "foo.exe" # 可執行文件名
      SRC = "./src" # D 源程序在 ./src 目錄下(包括子目錄)
      LIBS = ["advapi32.lib", "uuid.lib", "ole32.lib"] # 程序用到的附加 .lib
      DEBUG_FLAGS = "-debug -g"
      RELEASE_FLAGS ="-release -O"

      DC = "dmd.exe"
      IMPLIB = "implib.exe"
      PROG = "#{NAME}"
      PROG_DEBUG = "#{NAME}"

      SRCS = Rant::FileList[SRC + "/**/*.d"]
      OBJS = SRCS.ext "obj"
      OBJS_DEBUG = SRCS.map {|file| file.sub /\.d$/, "_debug.obj"}

      DEFS = Rant::FileList[SRC + "/**/*.def"]
      ILIBS = DEFS.ext "lib"

      task :default => :debug
      task :release => :program
      task :debug => :program_d


      def dolink(target, t)
      sys.sh "#{DC} -of#{target} #{t.prerequisites.join(' ')} #{LIBS.join(' ')}"
      end

      task :program => OBJS.entries + ILIBS.entries do |t|
      dolink PROG_DEBUG, t
      end

      task :program_d => OBJS_DEBUG.entries + ILIBS.entries do |t|
      dolink PROG, t
      end

      gen Rule, ".obj" => ".d" do |t|
      sys.sh "#{DC} #{t.source} -c -I#{SRC} #{RELEASE_FLAGS} -of#{t.name}"
      end

      gen Rule, "_debug.obj" => ".d" do |t|
      sys "#{DC} #{t.source} #{DEBUG_FLAGS} -c -I#{SRC} -of#{t.name}"
      end

      gen Rule, ".lib" => ".def" do |t|
      # DigitalMars 的 implib.exe 程序不認識 '/' 分割的路徑
      lib = t.name.gsub("/", "\\")
      dotdef = t.source.gsub("/", "\\")
      sys.sh "#{IMPLIB} /system #{lib} #{dotdef}"
      end

      task :clean do
      sys.rm_f OBJS
      sys.rm_f OBJS_DEBUG
      sys.rm_f ILIBS
      sys.rm_f PROG
      sys.rm_f PROG_DEBUG
      end

      此 Rantfile 能掃描源程序目錄的所有.d文件,并自動編譯連接。如果源程序目錄存在 .def 的 DLL 導入庫定義文件的話,也會自動生成 .lib,并鏈接到程序中。

      rant 的用法與make基本一致:
      rant debug //建立 debug 版程序
      rant release // 建立 release 版程序
      rant clean // 清理零時文件
      rant -f build.rb //指定build.rb為rantfile,而不是當前目錄下的 Rantfile

      更多信息請登陸http://61.191.27.74:802/ 最后,歡迎加入http://61.191.27.74:802/的會員


      安徽新華電腦學校專業職業規劃師為你提供更多幫助【在線咨詢
      国产午夜福三级在线播放_亚洲精品成a人片在线观看_亚洲自慰一区二区三区_久久棈精品久久久久久噜噜
      <source id="4vppl"><ins id="4vppl"></ins></source>
      <u id="4vppl"><sub id="4vppl"><label id="4vppl"></label></sub></u>
      <object id="4vppl"></object>
    1. <u id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></u>

      <object id="4vppl"></object>
      <b id="4vppl"><sub id="4vppl"><tr id="4vppl"></tr></sub></b>

        <i id="4vppl"><thead id="4vppl"></thead></i>

        <thead id="4vppl"><li id="4vppl"><label id="4vppl"></label></li></thead>
        日本在线免费观看AⅤ | 香蕉97超级碰碰碰免费公开 | 亚洲国产AV一区二区三区四区 | 亚洲国产精品综合久久网络 | 日本乱偷中文字幕久久久 | 亚洲中文精品久久久久久图片 |