<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Adding a compile date to your code in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840733#M58702</link>
    <description>Thanks all for your suggestions. They helped quite a bit and inspired me to come up with a python pre-build step. I'm sure this is not optimal, but it works.&lt;BR /&gt;&lt;BR /&gt;Python script "setcompiledate.py"&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;FONT color="#0000ff"&gt;import datetime&lt;BR /&gt;today = datetime.date.today()&lt;BR /&gt;fout = open("verno.h", "w")&lt;BR /&gt;fout.write( today.strftime("#define CompileDate %Y%m%d") )&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;Sample Fortran code "main.f90"&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;FONT color="#0000ff"&gt; program Hello&lt;BR /&gt; &lt;BR /&gt;#include "verno.h"&lt;BR /&gt; &lt;BR /&gt; !DEC$ IF DEFINED (CompileDate) &lt;BR /&gt; write( * , "(A,I8)" ) " Compiled on date: ",CompileDate&lt;BR /&gt; !DEC$ ENDIF&lt;BR /&gt; &lt;BR /&gt; write( * , * ) "Hello World"&lt;BR /&gt; &lt;BR /&gt; end program Hello&lt;BR /&gt;&lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Build Steps&lt;BR /&gt;&lt;OL&gt;&lt;LI&gt;Run &lt;B&gt;setcompiledate.py&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;Build &lt;B&gt;ifort -fpp main.f90&lt;/B&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
    <pubDate>Tue, 24 Jul 2007 23:59:35 GMT</pubDate>
    <dc:creator>JohnR</dc:creator>
    <dc:date>2007-07-24T23:59:35Z</dc:date>
    <item>
      <title>Adding a compile date to your code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840728#M58697</link>
      <description>Apologies if this is a really easy question, but how do you add an automated compile date to your code? I tried doing this using the pre-processor, but couldn't find a symbol for datetime. Any hints?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;John&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jul 2007 06:37:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840728#M58697</guid>
      <dc:creator>JohnR</dc:creator>
      <dc:date>2007-07-24T06:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a compile date to your code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840729#M58698</link>
      <description>The Fortran preprocessor does not have such a symbol, as far as I know.&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jul 2007 12:44:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840729#M58698</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-07-24T12:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a compile date to your code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840730#M58699</link>
      <description>We had a similar thread on automatic increase of version (in the .rc file) with every build (I can dig out the thread if you wish), using a Visual Studio macro. However, without preprocessor support, it would pose a problem if you want to embed it in the &lt;B&gt;code&lt;/B&gt;: changing the build timestamp in the code would alter it, triggering a build -- it's a catch-22.&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jul 2007 14:07:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840730#M58699</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2007-07-24T14:07:57Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a compile date to your code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840731#M58700</link>
      <description>The only methods that I can think of are: 
&lt;P&gt;From Visual Studio &lt;BR /&gt;- Add a pre-build event&lt;BR /&gt;- Feed your code through the C preprocessor and use the __DATE__ and __TIME__ predefined macros. The alternative to using the C preprocessor is to write a small program that will insert the current date and time 
&lt;/P&gt;&lt;P&gt;From command line using make (or nmake)&lt;BR /&gt;- Create a rule for building .obj from .F90 (traditionally only .F file names are run through a preprocessor, but you don't have to follow that convention)&lt;BR /&gt;In that rule invoke the C preprocessor or a custom written program &lt;/P&gt;
&lt;P&gt;I have not tested it out, so I won't say it will work for sure.&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jul 2007 14:25:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840731#M58700</guid>
      <dc:creator>Dishaw__Jim</dc:creator>
      <dc:date>2007-07-24T14:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a compile date to your code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840732#M58701</link>
      <description>If you can fiigure out a way to modify the build options, you could change the value of a /D switch used to compile the source. Another possibility is to use a pre-build step to write an include file that is used to define the date.&lt;BR /&gt;&lt;BR /&gt; I'd also suggest that you file a feature request for adding date and time symbols to the Fortran preprocessor with Intel Premier Support.&lt;BR /&gt;</description>
      <pubDate>Tue, 24 Jul 2007 14:51:27 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840732#M58701</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-07-24T14:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Adding a compile date to your code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840733#M58702</link>
      <description>Thanks all for your suggestions. They helped quite a bit and inspired me to come up with a python pre-build step. I'm sure this is not optimal, but it works.&lt;BR /&gt;&lt;BR /&gt;Python script "setcompiledate.py"&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;FONT color="#0000ff"&gt;import datetime&lt;BR /&gt;today = datetime.date.today()&lt;BR /&gt;fout = open("verno.h", "w")&lt;BR /&gt;fout.write( today.strftime("#define CompileDate %Y%m%d") )&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;Sample Fortran code "main.f90"&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;FONT color="#0000ff"&gt; program Hello&lt;BR /&gt; &lt;BR /&gt;#include "verno.h"&lt;BR /&gt; &lt;BR /&gt; !DEC$ IF DEFINED (CompileDate) &lt;BR /&gt; write( * , "(A,I8)" ) " Compiled on date: ",CompileDate&lt;BR /&gt; !DEC$ ENDIF&lt;BR /&gt; &lt;BR /&gt; write( * , * ) "Hello World"&lt;BR /&gt; &lt;BR /&gt; end program Hello&lt;BR /&gt;&lt;/FONT&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;Build Steps&lt;BR /&gt;&lt;OL&gt;&lt;LI&gt;Run &lt;B&gt;setcompiledate.py&lt;/B&gt;&lt;/LI&gt;&lt;LI&gt;Build &lt;B&gt;ifort -fpp main.f90&lt;/B&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;</description>
      <pubDate>Tue, 24 Jul 2007 23:59:35 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Adding-a-compile-date-to-your-code/m-p/840733#M58702</guid>
      <dc:creator>JohnR</dc:creator>
      <dc:date>2007-07-24T23:59:35Z</dc:date>
    </item>
  </channel>
</rss>

