This commit is contained in:
Ian Bell
2014-10-25 09:36:17 -04:00
8 changed files with 207 additions and 83 deletions

View File

@@ -57,6 +57,14 @@ option (BUILD_TESTING
"Enable testing for this given builder"
OFF)
option (FORCE_BITNESS_32
"Force a 32bit build regardless of the host"
OFF)
option (FORCE_BITNESS_64
"Force a 64bit build regardless of the host"
OFF)
#######################################
# FIND ALL SOURCES #
#-------------------------------------#
@@ -125,6 +133,28 @@ else()
endif()
endif()
IF(MSVC AND (FORCE_BITNESS_32 OR FORCE_BITNESS_64))
MESSAGE(STATUS "You cannot force a certain bitness for Visual Studio, use the generator settings for this purpose." )
MESSAGE(STATUS "Pass '-G \"Visual Studio 10 2010 Win64\"' to CMake to make a 64bit binary using VS2010." )
MESSAGE(STATUS "Pass '-G \"Visual Studio 10 2010\"' to CMake to make a 32bit binary using VS2010." )
MESSAGE(STATUS "Pass '-G \"Visual Studio 9 2008 Win64\"' to CMake to make a 64bit binary using VS2008." )
MESSAGE(STATUS "Pass '-G \"Visual Studio 9 2008\"' to CMake to make a 32bit binary using VS2008." )
MESSAGE(FATAL_ERROR "Fix that and try again...")
ENDIF()
IF(FORCE_BITNESS_32)
SET(BITNESS "32")
ELSEIF(FORCE_BITNESS_64)
SET(BITNESS "64")
ENDIF()
if (!MSVC)
#set_target_properties(${app_name} PROPERTIES COMPILE_FLAGS "-m${BITNESS}" LINK_FLAGS "-m${BITNESS}")
#set_target_properties(${app_name} PROPERTIES COMPILE_FLAGS "-m${BITNESS}" LINK_FLAGS "-m${BITNESS}")
set_target_properties(${app_name} PROPERTIES APPEND_STRING PROPERTY COMPILE_FLAGS "-m${BITNESS}")
set_target_properties(${app_name} PROPERTIES APPEND_STRING PROPERTY LINK_FLAGS "-m${BITNESS}")
endif()
#######################################
# MAKE ARTIFACTS #
#-------------------------------------#
@@ -150,6 +180,8 @@ if (COOLPROP_STATIC_LIBRARY_MODULE OR COOLPROP_STATIC_LIBRARY OR COOLPROP_EXTERN
install (TARGETS ${app_name} DESTINATION static_library/${CMAKE_SYSTEM_NAME})
endif()
### Process some more options ###
if (COOLPROP_EXTERNC_STATIC_LIBRARY)
set_target_properties (${app_name} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -DEXTERNC")
endif()

View File

@@ -52,9 +52,10 @@ For git, your best best is the installer from http://msysgit.github.io/. Check
C:\Users\XXXX>git --version
git version 1.9.4.msysgit.0
For the C++ compiler, the options are a bit more complicated. There are multiple (binary incompatible) versions of Visual Studio, as well as G++ ports for windows (MinGW). Unless you are compiling the python wrappers, you can compile with MinGW, so you should obtain the `MinGW installer <http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download>`_ and run it. You should install all the packages available, and you must install to a path without spaces. ``C:\MinGW`` is recommended as an installation path.
For the C++ compiler, the options are a bit more complicated. There are multiple (binary incompatible) versions of Visual Studio, as well as G++ ports for windows (MinGW). Unless you are compiling the python wrappers, you can compile with MinGW, so you should obtain the `MinGW installer <http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download>`_ and run it. You should install all the packages available, and you must install to a path without spaces. ``C:\MinGW`` is recommended as an installation path. Be sure to add the binaries in ``C:\MinGW\bin\`` to your PATH variable.
If you are compiling for Python 2.7, you can install Visual Studio 2008 Express from `VS2008Express installer <http://go.microsoft.com/?linkid=7729279>`_.
Make sure you install ServicePack 1, otherwise your are going to get quite cryptic error messages during compilation.
If you are compiling for Python 3.x, you can install Visual Studio 2010 Express from `VS2010Express installer <http://www.visualstudio.com/en-us/downloads#d-2010-express>`_.
@@ -62,6 +63,7 @@ If you want to build 64-bit extensions, you MUST install VS2010 Professional, wh
All three compilers should co-exist happily on the path, so you should be fine installing all three, but they are rather sizeable installs.
Linux
-----
On debian based linux distributions (ubuntu, etc.), you can simply do::

View File

@@ -77,11 +77,7 @@ steps on a Windows machine::
pip install wheel
deactivate
Please repeat the steps above for both 32bit and 64bit Python environments. In
addition to the Python tools, you also need the Microsoft compilers. Please
install Visual Studio 2010 for Python 3.4 and Visual Studio 2008 for Python 2.7.
The latter requires ServicePack 1, otherwise your are going to get quite cryptic
error messages during compilation.
Please repeat the steps above for both 32bit and 64bit Python environments.
On a Linux system, things only change a little bit::
@@ -104,6 +100,10 @@ POSIX specification.
At the moment, it is not possible to use several slaves for the same build job.
We have to find a new way to generate the configuration.
Information on building the single wrappers can be found on
:ref:`this dedicated page<wrapper_common_prereqs>`.
Buildbot as a service (Windows)
-------------------------------

View File

@@ -48,7 +48,7 @@ c['change_source'].append(GitPoller(
from buildbot.process.factory import BuildFactory
from buildbot.steps.source.git import Git
from buildbot.steps.shell import ShellCommand
from buildbot.steps.slave import MakeDirectory, RemoveDirectory
from buildbot.steps.slave import MakeDirectory, RemoveDirectory, CopyDirectory
from buildbot.steps.transfer import DirectoryUpload, FileDownload
from buildbot.process import properties
@@ -303,11 +303,11 @@ def pythonFactory(pyID, pyCFG=PythonSlaveConfig("name"), gitMode='incremental'):
combinedCMD = " && ".join([activateCMD, installCMD])
factory.addStep(ShellCommand(command = combinedCMD, workdir = workingFolder, haltOnFailure = True))
#
factory.addStep(DirectoryUpload(slavesrc=uploadFolder, masterdest="public_html/bin", url="bin", compress="bz2"))
factory.addStep(DirectoryUpload(slavesrc=uploadFolder, masterdest="public_html/binaries", url="binaries", compress="bz2"))
return factory
def cmakeFactory(mod_name, platform, gitMode = 'incremental', install = True, pre_cmd = [], cmake_args = [], build_args = [], ctest_args = [], cmake_env={}, test = True):
def cmakeFactory(mod_name = None, gitMode = 'incremental', install = True, pre_cmd = [], cmake_args = [], build_args = [], ctest_args = [], cmake_env={}, test = True):
"""
Parameters
----------
@@ -336,8 +336,11 @@ def cmakeFactory(mod_name, platform, gitMode = 'incremental', install = True, pr
factory.addStep(MakeDirectory(dir=working_folder, haltOnFailure = True))
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True))
#
if not pre_cmd[-1]=="&&": pre_cmd.append("&&")
cmakeCMD = pre_cmd + ["cmake", "..", "-DCOOLPROP_"+mod_name.upper()+"_MODULE=ON","-DBUILD_TESTING=ON"]+cmake_args
if len(pre_cmd)>0 and not pre_cmd[-1]=="&&": pre_cmd.append("&&")
if mod_name is not None:
cmake_args = ["-DCOOLPROP_"+mod_name.upper()+"_MODULE=ON","-DBUILD_TESTING=ON"]+cmake_args
cmakeCMD = pre_cmd + ["cmake", ".."]+cmake_args
factory.addStep(ShellCommand(
command=' '.join(cmakeCMD),
env = cmake_env,
@@ -365,7 +368,34 @@ def cmakeFactory(mod_name, platform, gitMode = 'incremental', install = True, pr
compress="bz2"))
return factory
def fortranFactory(platform=1):
working_folder = "build/build" # Same as in cmakeFactory
fortran_folder = "build/wrappers/Fortran/detailed_example" #
#
if platform==platformID["windows"]:
cmake_args = ["-DCOOLPROP_EXTERNC_STATIC_LIBRARY=ON","-G", "\"MinGW Makefiles\""]
cp_cmd = "copy /Y *.f90 ..\\..\\..\\build"
build_cmd = "gfortran -c -Wall cpinterface.f90 cool_fortran_bind.f90"
link_cmd = "gfortran -o main *.o libCoolProp.a -lstdc++"
exec_cmd = "main"
elif platform==platformID["linux"]:
cmake_args = ["-DCOOLPROP_EXTERNC_STATIC_LIBRARY=ON"]
cp_cmd = "cp *.f90 ../../../build/"
build_cmd = "gfortran -c -Wall cpinterface.f90 cool_fortran_bind.f90"
link_cmd = "gfortran -o main *.o libCoolProp.a -lstdc++ -ldl"
exec_cmd = "./main"
else:
raise ValueError("Unknown Fortran platform: {0}".format(platform))
# Create the factory to add the actions to
factory = cmakeFactory(cmake_args=cmake_args,install=False,test=False)
#
#factory.addStep(CopyDirectory(src=fortran_folder, dest=working_folder))
factory.addStep(ShellCommand(command=cp_cmd, workdir = fortran_folder, haltOnFailure = True))
for cmd in [build_cmd,link_cmd,exec_cmd]:
factory.addStep(ShellCommand(command=cmd, workdir = working_folder, haltOnFailure = True))
return factory
def javascript_slave(platform, cmake_args = [], cmake_env = {}, build_args = [], gitMode = 'incremental'):
@@ -387,43 +417,6 @@ def javascript_slave(platform, cmake_args = [], cmake_env = {}, build_args = [],
return factory
def python_slave(key, platform, conda_env, cmake_args = [], cmake_env = {}, build_args = [], gitMode = 'incremental', bitness = 64):
working_folder = "build/wrappers/Python"
# Create the factory to add the actions to
factory = getBaseFactory(gitMode=gitMode)
# Remove the temporary folder for installs
factory.addStep(RemoveDirectory(dir="build/install_root", haltOnFailure = True))
if platform.find('OSX') > -1:
source = ['source','activate']
elif 'win' in platform.lower() and bitness == 32:
source = ['c:\\Miniconda32bit\\Scripts\\activate']
else:
source = ['activate']
if 'win' in platform.lower():
if conda_env == 'py27':
vc = 'vc9'
else:
vc = 'vc10'
options = ['bdist_wheel','--dist-dir','../../install_root/Python','bdist_wininst','--dist-dir','../../install_root/Python', '--cmake-compiler', vc, '--cmake-bitness', str(bitness)]
elif 'OSX' in platform:
options = ['bdist_wheel','--dist-dir','../../install_root/Python']
else:
raise ValueError()
factory.addStep(ShellCommand(command = ' '.join(source + [conda_env,"&&","python", "setup.py"]+options),
env = cmake_env,
workdir= working_folder,
haltOnFailure = True))
factory.addStep(DirectoryUpload(slavesrc="install_root", masterdest="public_html/binaries", url="binaries", compress="bz2"))
return factory
def python_source_slave(key, platform, conda_env, cmake_args = [], cmake_env = {}, build_args = [], gitMode = 'incremental'):
working_folder = "build/build"
@@ -647,22 +640,6 @@ c['builders'].append(
)
)
for conda_env in ['py33','py27','py34']:
for platform in ['OSX','windows']:
ctest_args, cmake_args = [], []
if platform.startswith('windows'):
ctest_args = ['-C', 'Release']
cmake_args = ['-G', '"Visual Studio 10 2010 Win64"']
c['builders'].append(
BuilderConfig(name="Python-binaries-" + platform + '-' + conda_env,
slavenames=[platform + "-slave"],
factory = python_slave("BINARIES",
platform = platform,
conda_env = conda_env,
cmake_args = cmake_args)
)
)
# We centralise the Python builder configuration here
#
# Setting the appropriate installer options
@@ -673,23 +650,20 @@ windowsDTUslave = PythonSlaveConfig("windows-DTU-slave")
windowsDTUslave.pyact[getIDstr("windows", "32bit", 0 )] = "\"C:\\Program Files (x86)\\Miniconda32_27\\Scripts\\activate.bat\""
windowsDTUslave.pyact[getIDstr("windows", "64bit", 0 )] = "\"C:\\Program Files\\Miniconda64_27\\Scripts\\activate.bat\""
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py27")] = "CoolProp27"
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py33")] = "CoolProp33"
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py34")] = "CoolProp34"
tmpins = baseins + ['bdist_wininst','--dist-dir', relinstFolder+'/Python']
windowsDTUslave.pyins[getIDstr("windows", "32bit", "py27")] = tmpins + ['--cmake-compiler', 'vc9' , '--cmake-bitness', '32']
windowsDTUslave.pyins[getIDstr("windows", "32bit", "py33")] = tmpins + ['--cmake-compiler', 'vc10', '--cmake-bitness', '32']
windowsDTUslave.pyins[getIDstr("windows", "32bit", "py34")] = tmpins + ['--cmake-compiler', 'vc10', '--cmake-bitness', '32']
windowsDTUslave.pyins[getIDstr("windows", "64bit", "py27")] = tmpins + ['--cmake-compiler', 'vc9' , '--cmake-bitness', '64']
windowsDTUslave.pyins[getIDstr("windows", "64bit", "py33")] = tmpins + ['--cmake-compiler', 'vc10', '--cmake-bitness', '64']
windowsDTUslave.pyins[getIDstr("windows", "64bit", "py34")] = tmpins + ['--cmake-compiler', 'vc10', '--cmake-bitness', '64']
windowsIANslave = PythonSlaveConfig("windows-slave")
windowsIANslave.pyact[getIDstr("windows", "32bit", 0 )] = "C:\\Miniconda32bit\\Scripts\\activate"
windowsIANslave.pyact[getIDstr("windows", "64bit", 0 )] = "activate"
windowsIANslave.pyenv[getIDstr("windows", 0 , "py33")] = "py33"
windowsIANslave.pyins[getIDstr("windows", "32bit", "py33")] = tmpins + ['--cmake-compiler', 'vc10', '--cmake-bitness', '32']
windowsIANslave.pyins[getIDstr("windows", "64bit", "py33")] = tmpins + ['--cmake-compiler', 'vc10', '--cmake-bitness', '64']
linuxDTUslave = PythonSlaveConfig("linux32-slave")
linuxDTUslave.pyact[getIDstr( "linux" , "32bit", 0 )] = "source /home/jowr/miniconda/bin/activate"
linuxDTUslave.pyenv[getIDstr( "linux" , 0 , "py27")] = "CoolProp27"
linuxDTUslave.pyenv[getIDstr( "linux" , 0 , "py33")] = "CoolProp33"
linuxDTUslave.pyenv[getIDstr( "linux" , 0 , "py34")] = "CoolProp34"
linuxDTUslave.pyins[getIDstr( "linux" , "32bit", 0 )] = baseins
@@ -700,7 +674,7 @@ osxIANslave.pyenv[getIDstr( "osx" , "64bit", "py33")] = "py33"
osxIANslave.pyenv[getIDstr( "osx" , "64bit", "py34")] = "py34"
osxIANslave.pyins[getIDstr( "osx" , 0 , 0 )] = baseins
pythonSlaves = [windowsDTUslave, windowsIANslave, linuxDTUslave, osxIANslave]
pythonSlaves = [windowsDTUslave, linuxDTUslave, osxIANslave]
for slave in pythonSlaves:
for pyID in slave.getIDs():
@@ -733,7 +707,33 @@ for slave in pythonSlaves:
# )
# )
windowsDTUslave.pyact[getIDstr("windows", "32bit", 0 )] = "\"C:\\Program Files (x86)\\Miniconda32_27\\Scripts\\activate.bat\""
windowsDTUslave.pyact[getIDstr("windows", "64bit", 0 )] = "\"C:\\Program Files\\Miniconda64_27\\Scripts\\activate.bat\""
windowsDTUslave.pyenv[getIDstr("windows", 0 , "py27")] = "CoolProp27"
#c['builders'].append(
#BuilderConfig(name="StaticLibrary-binaries-windows-32bit-MinGW-ExternC",
# slavenames=["windows-DTU-slave"],
# factory = cmakeFactory(cmake_args=[
# "-DCOOLPROP_EXTERNC_STATIC_LIBRARY=ON",
# "-G", "\"MinGW Makefiles\""],
# install = False)
# )
# )
c['builders'].append(
BuilderConfig(
name="Fortran-executable-windows-32bit-MinGW-ExternC",
slavenames=["windows-DTU-slave"],
factory = fortranFactory(platform=platformID["windows"])
)
)
c['builders'].append(
BuilderConfig(
name="Fortran-executable-linux-32bit-GCC-ExternC",
slavenames=["linux32-slave"],
factory = fortranFactory(platform=platformID["linux"])
)
)
#Common boring 64-bit modules for windows, linux and OSX
### OSX
@@ -821,17 +821,6 @@ c['builders'].append(
)
)
for conda_env in ['py33','py27','py34']:
c['builders'].append(
BuilderConfig(name="Python-binaries-windows32bit-" + conda_env,
slavenames=["windows-slave"],
factory = python_slave("BINARIES",
platform = 'windows',
conda_env = conda_env,
bitness = 32)
)
)
swig_matlab_pre = BuilderConfig(name="SWIG-MATLAB-pre", slavenames=["linux-slave"], factory = swig_matlab_pre())
c['builders'].append(swig_matlab_pre)

View File

@@ -0,0 +1,48 @@
# run with cmake -DCMAKE_TOOLCHAIN_FILE=...
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
#######################################
# Choose an appropriate compiler prefix
#######################################
#
# for classical mingw32
# see http://www.mingw.org/
#set(COMPILER_PREFIX "i586-mingw32msvc")
#
# for 32 or 64 bits mingw-w64
# see http://mingw-w64.sourceforge.net/
#set(COMPILER_PREFIX "i686-w64-mingw32")
#set(COMPILER_PREFIX "x86_64-w64-mingw32")
#
set(COMPILER_PREFIX "i686-w64-mingw32")
#
#######################################
# which compilers to use for C and C++
#######################################
#
# Either search for the compiler ...
#find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
#
# ... or rely on the system path
#SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
#
find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
#
#
#######################################
# Where to look for target binaries
#######################################
#
# here is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX})
#
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#

View File

@@ -0,0 +1,51 @@
# run with cmake -DCMAKE_TOOLCHAIN_FILE=...
# the name of the target operating system
SET(CMAKE_SYSTEM_NAME Windows)
#######################################
# Choose an appropriate compiler prefix
#######################################
#
# for classical mingw32
# see http://www.mingw.org/
#set(COMPILER_PREFIX "i586-mingw32msvc")
#
# for 32 or 64 bits mingw-w64
# see http://mingw-w64.sourceforge.net/
#set(COMPILER_PREFIX "i686-w64-mingw32")
#set(COMPILER_PREFIX "x86_64-w64-mingw32")
#
set(COMPILER_PREFIX "x86_64-w64-mingw32")
#
#######################################
# which compilers to use for C and C++
#######################################
#
# Either search for the compiler ...
#find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
#
# ... or rely on the system path
#SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
#
#find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
#find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
#find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
SET(CMAKE_RC_COMPILER ${COMPILER_PREFIX}-windres)
SET(CMAKE_C_COMPILER ${COMPILER_PREFIX}-gcc)
SET(CMAKE_CXX_COMPILER ${COMPILER_PREFIX}-g++)
#
#
#######################################
# Where to look for target binaries
#######################################
#
# here is the target environment located
set(CMAKE_FIND_ROOT_PATH /usr/${COMPILER_PREFIX})
#
# adjust the default behaviour of the FIND_XXX() commands:
# search headers and libraries in the target environment, search
# programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#

View File

@@ -19,3 +19,4 @@ subprocess.check_call('./configure --disable-ccache --with-matlab=/usr/local/MAT
subprocess.check_call('make', shell = True, stdout = sys.stdout, stderr = sys.stderr)
subprocess.check_call('make install', shell = True, stdout = sys.stdout, stderr = sys.stderr)
subprocess.check_call('cp swig swig3.0', shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd='swig-matlab-bin/bin')
subprocess.check_call('cp swig swig2.0', shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd='swig-matlab-bin/bin')

View File

@@ -17,3 +17,4 @@ subprocess.check_call('./configure --disable-ccache --with-scilab-inc=${SCILAB_H
subprocess.check_call('make', shell = True, stdout = sys.stdout, stderr = sys.stderr)
subprocess.check_call('make install', shell = True, stdout = sys.stdout, stderr = sys.stderr)
subprocess.check_call('cp swig swig3.0', shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd='swig-scilab-bin/bin')
subprocess.check_call('cp swig swig2.0', shell = True, stdout = sys.stdout, stderr = sys.stderr, cwd='swig-scilab-bin/bin')