On a windows platform, you are likely to run into more problems than on linux when building from source. Therefore, we will try to provide built versions for some platforms. If your platform is supported, you can just run
pip install cern-cpymad
from your terminal and that’s it. If this fails, you will need to build from source. The following guide assumes that you use MinGW as compiler suite.
I recommend to use Python(x,y). This is a python distribution which includes all Dependencies except for CMake. Make sure Cython and MinGW are marked for installation.
Note
If you want to use another python installation things will get more complicated. I recommend the following resources:
Now install CMake. In the Install options dialog choose to Add CMake to the system PATH for all/current user according to your liking.
Note
You can also select Do not add CMake to the system PATH. In this case you will need to manually extend your PATH later on in the terminal:
set PATH=%PATH%;C:\Program Files (x86)\CMake\bin
Download and extract the MAD-X source from SVN.
Note
If the latest release contains bugs that have been fixed in the meantime you may want to download the latest revision from SVN. Be aware though, that the latest revision is not at all guaranteed to be stable or even buildable.
Note
You might need multiple extraction steps until you get a folder containing the file CMakeLists.txt as well as several other files and subdirectories.
I recommend to build MAD-X as a static library as described below. This way, you won’t need to carry any .dll files around and you won’t run into version problems when having a multiple MAD-X library builds around.
Python(x,y) provides an Open enhanced console here context menu item when right-clicking on a folder in the explorer. Open the madX folder with it and run the commands:
mkdir build
cd build
cmake -G "MinGW Makefiles" -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_INSTALL_PREFIX=..\install ..
make
make install
This will install the headers, binaries and library files to the madX/install subfolder.
Note
You can also use the regular console cmd.exe. In this case extend the PATH environment variable with your python and MinGW installation:
set PATH=%PATH%;C:\MinGW32-xy\bin
set PATH=%PATH%;C:\Python27
set PATH=%PATH%;C:\Python27\Scripts
Note
If executing CMake from the GUI, you have to disable the BUILD_SHARED_LIBS option, if present. Afterwards reconfigure and regenerate.
Download the CPyMad source. Then go to the pymad folder and build as follows:
python setup.py build --compiler=mingw32 --madxdir=<madx-install-path>
python setup.py install
Substitute <madx-install-path> with the madX\install subfolder as specified by CMAKE_INSTALL_PREFIX before.