Scons

From relax wiki
Jump to navigation Jump to search

When to issue "scons" ? After each update in repository?

This is only necessary if the C files change, or if your Python version changes (for example you switch from Python 2 to Python 3).

This has not happened for a long time and will probably not occur in the lifetime of the relax_disp branch.

User manual

scons user_manual_pdf

clean/remove compilation

scons clean_all

Bugfix scons for 32bit building

Due to a bug, versions of scons <=2.3 should alter a line in:
PYTHON INSTALL FOLDER\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py

Line 364:

    if not req_target_platform and target_platform in ('amd64','x86_64'):
        try_target_archs.append('x86')

Should be:

    #if not req_target_platform and target_platform in ('amd64','x86_64'):
    #    try_target_archs.append('x86')
    if target_platform in ('amd64','x86_64'):
        try_target_archs.append('x86')
    print "requested", req_target_platform
    print "target", target_platform
    print "try", try_target_archs

If not fixing the bug, you will get:

C:\WinPython27\relax_disp>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...

###########################
# Compiling the C modules #
###########################
Building the relaxation curve fitting module 'target_functions\\relax_fit.pyd'

cl /Fotarget_functions\c_chi2.obj /c target_functions\c_chi2.c /nologo /I"C:\Win
Python27\WinPython-32bit-xxx\scripts\..\python-xxx\include"
'cl' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [target_functions\c_chi2.obj] Error 1
scons: building terminated because of errors.

Build relax

Open the WinPython Command Prompt
Navigate to the SVN checked out relax folder.
First we need to run the variable setup vcvars32.bat or vcvarsall.bat x86 for Microsoft Visual Studio 11.0, before we can compile.

cd C:\WinPython27\relax_disp
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\vcvars32.bat"
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86
"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
echo %PROCESSOR_ARCHITECTURE%
set PROCESSOR_ARCHITECTURE=x86
echo %PROCESSOR_ARCHITECTURE%
scons

(Scons will automatically find CL.exe, and setup compilation for 64 bit.)

Construction Variables

link to Construction Variables