Difference between revisions of "RBuild Files"

From ReactOS Wiki
Jump to: navigation, search
Line 11: Line 11:
 
This line is only needed if you need some special header that are not located in the base include directory.  Otherwise you don't need to add it in.
 
This line is only needed if you need some special header that are not located in the base include directory.  Otherwise you don't need to add it in.
 
   <include base="namedir">actualdir</include>
 
   <include base="namedir">actualdir</include>
With this, you can do something like #include "namedir/foo.h".  However, be careful using this.  Use of backslashes is liable to break Linux builds.  Always use forward(/) slashes.  mingw can figure out what you mean.
+
With this, you can do something like #include "namedir/foo.h".
  
 
This statement is the same as a #define in your source code.  Using this will make it a global for all files.
 
This statement is the same as a #define in your source code.  Using this will make it a global for all files.
Line 47: Line 47:
 
Once you're done creating your rbuild file, you must go one level up and add this to the rbuild file there.
 
Once you're done creating your rbuild file, you must go one level up and add this to the rbuild file there.
 
   <directory name = "foo"
 
   <directory name = "foo"
  <x:include href="foo/foo.rbuild">
+
      <x:include href="foo/foo.rbuild">
 
   </directory>
 
   </directory>
 +
 +
Notes:
 +
* Use of backslashes is liable to break Linux builds.  Always use forward(/) slashes.  mingw can figure out what you mean.

Revision as of 02:35, 11 June 2007

work in progress by Z98

If you have another program that you wish to compile into ReactOS, you will need the source code as well as create an rbuild config file for it. In this example, we will assume that the program is called foo.

This is the first line. For type, you have the option of using win32cui (console application), win32gui (Windows application), win32ocx (relates to COM), win32dll (Dynamic Linked Libraries), objectlibrary (don't know yet what they are), exportdriver (don't know yet what they are), and kernelmodedriver (hardware driver). The other two are self explanatory. Another option that could be added is unicode="true/false".

 <module name="foo" type="win32gui" installname="foo.exe">

This line is only needed if you're trying to export functions. This is most frequently used in DLLs, in which case your file would be located in something like /dll/*/foo. Drivers sometimes also export functions.

 <importlibrary definition="foo.def" />

This line is only needed if you need some special header that are not located in the base include directory. Otherwise you don't need to add it in.

 <include base="namedir">actualdir</include>

With this, you can do something like #include "namedir/foo.h".

This statement is the same as a #define in your source code. Using this will make it a global for all files.

 <define name="_WIN32_WINNT">0x0501</define>

This statement is used to designate the use of a precompiled header. Generally you will have to know explicitly which headers are precompiled to use this.

 <pch>precomp.h</pch>

This statement specifies a subdirectory where you want to do something. Once you are done supplying config information, you must close it.

 <directory name="stuff">
 (various other config options)
 </directory>

This statement specifies what other modules your module is dependent upon, so that the compiler knows to recompile your module in the event there's a change in the other one.

 <dependency>wineheaders</dependency>

Next is which libraries you will be using. If you use more than one library, the declaration becomes multi-line.

 <library>user32</library>
 <library>shell32</library>

For this, you need to know what libraries your program will need. If you don't know, you can try compiling the program and see which functions GCC complains about no finding and figure out where they're from.

If you wish to merge several files together and compile them as one file, you will wrap <file> with this.

 <compilationunit name = allfoo.c>

Next comes the files that will be compiled.

 <file>main.c</file>
 <file>functions.c</file>

If you had used <compliationunit> above, you must close it.

 </compliationunit>

You end the rbuild file with this.

 </module>

Once you're done creating your rbuild file, you must go one level up and add this to the rbuild file there.

 <directory name = "foo"
     <x:include href="foo/foo.rbuild">
 </directory>

Notes:

  • Use of backslashes is liable to break Linux builds. Always use forward(/) slashes. mingw can figure out what you mean.