1 | CMake: |
---|
2 | |
---|
3 | CMake is a build tool that can be used instead of make. |
---|
4 | In principle it can also be used on Windows, however we do not |
---|
5 | currently aim to support this. We do try to support all linux |
---|
6 | flavours in addition to Mac OSX. |
---|
7 | |
---|
8 | Basic usage: |
---|
9 | Create a temporary folder and enter it in terminal. Write the command |
---|
10 | cmake <path to source> |
---|
11 | You can then build mad-x with |
---|
12 | make |
---|
13 | If you wish, you can use "-j <nprocs>" to utilise several processors for faster compilation. |
---|
14 | If you wish, you can use "VERBOSE=yes" to see all commands that are used, e.g. for making sure you use the correct flags and compiler. |
---|
15 | If you want to see the commands without actually running them (dry-run), use "make -n". |
---|
16 | If you wish to edit something in your current build configuration, you can use the command |
---|
17 | ccmake . |
---|
18 | Inside there, you can toggle advanced mode with "t", edit an option with "c", and quit with "q" |
---|
19 | In order to use a different compiler, you can use instead of the first command |
---|
20 | cmake -DCMAKE_Fortran_COMPILER=ifort <path to source> |
---|
21 | This is general for all options, -D<option>=value will automatically set this option. |
---|
22 | If you want to use the NAG compiler, please use -DCMAKE_Fortran_COMPILER=nagfor, not f95 (which is usually just a link to your default fortran compiler..) |
---|
23 | |
---|
24 | OSX specific: |
---|
25 | On OSX you can build a binary for multiple architectures. This requires that your compilers are built with the universal option on (e.g. for macports: "port install gcc +universal") |
---|
26 | You can compile for multiple architectures with the flag CMAKE_OSX_ARCHITECTURES, so e.g. |
---|
27 | cmake -DCMAKE_OSX_ARCHITECTURES="i386;x86_64" <srcdir> |
---|
28 | |
---|
29 | In case of LF95: |
---|
30 | If you want to use lf95 32bit compiler on a 64bit system, please use the initial command: |
---|
31 | cmake -DCMAKE_TOOLCHAIN_FILE=<path-to-source>/cmake/ToolChains/LinuxLF95.cmake <path-to-source> |
---|
32 | This is so far only known to work with CMake newer than or equal to version 2.8.1. |
---|
33 | That means it will not work on lxplus at the moment. |
---|
34 | For a 32bit system the compiler can be used in the usual way, with the option "-DCMAKE_Fortran_COMPILER=lf95" |
---|
35 | Toolchain files must be generated if you want to do cross-platform compiling in general. |
---|
36 | |
---|
37 | Submitting to cdash: |
---|
38 | A testing server is set up, where a client can publish the results from updating, compiling, and testing. For this, a configuration script is needed. |
---|
39 | An example script is given in madX/cmake/cdash_madx.cmake. In this file you need to edit the following: |
---|
40 | - CTEST_SITE "myname.maymachine" - select a useful name and machine name. Keep this fixed for all configurations on your machine. It is important that it is unique for you. |
---|
41 | - CTEST_BUILD_NAME "SLC5-64bit-gfortran" - select a useful name for the build. Change this for all different configurations you have. |
---|
42 | - CTEST_SOURCE_DIRECTORY "/path/to/source/madX/" - select a temporary folder where the madX source is checked out from svn. |
---|
43 | It is important that you do not need password to update from svn. |
---|
44 | Hence it is recommended that you check out from this url: |
---|
45 | http://svnweb.cern.ch/guest/madx/trunk/madX/ |
---|
46 | - If you want to start a cron job, replace "Experimental" with "Nightly". |
---|
47 | |
---|
48 | After that, you can run the script using the following command: "ctest -S cdash_madx.cmake" |
---|
49 | |
---|
50 | You can optionally set this as a nightly cron job. To do so, place this script in a folder of choice, |
---|
51 | and then add the following to your cron table ("crontab -e"): |
---|
52 | @daily ID=madx_cmake cd /path/to/script/;ctest -S cdash_madx.cmake |
---|
53 | This will run the test script every night at 00:00, and submit results to the server. |
---|