Commit 1eb25771 authored by Ludovic Courtès's avatar Ludovic Courtès

build: Remove machinery to download CERES, IpOpt, and NlOpt.

parent c6c12993
......@@ -88,9 +88,9 @@ dependencies are met, and which of the optional dependencies are
available. All the compilation byproducts go to the
<tt>sources/build</tt> sub-directory.
Some of the missing dependencies, such as NlOpt, IpOpt, and CERES, are
automatically downloaded from upstream when they are not found. The
downloaded files are integrity-checked, and then the software is built
If Eigen could not be found, it is
automatically downloaded from upstream. The
downloaded file is integrity-checked, and then the software is built
and installed under the <tt>external/build</tt> sub-directory of the
source tree.
......
# ALTA --- Analysis of Bidirectional Reflectance Distribution Functions
#
# Copyright (C) 2014, 2015 CNRS
# Copyright (C) 2013, 2014, 2015 Inria
# Copyright (C) 2013, 2014, 2015, 2016 Inria
# Copyright (C) 2015 Universite de Montreal
#
# This file is part of ALTA.
......@@ -25,11 +25,7 @@ if env.GetOption('clean'):
#shutil.rmtree('build', True)
# Removing the TP directories
#shutil.rmtree('ceres-solver-1.7.0', True)
#shutil.rmtree('eigen-eigen-ffa86ffb5570', True)
#shutil.rmtree('glog-0.3.3', True)
#shutil.rmtree('Ipopt-3.11.8', True)
#shutil.rmtree('nlopt-2.4.1', True)
else:
##
......@@ -45,47 +41,6 @@ else:
env['EIGEN_INC'] = [Dir('#external/build/include').abspath]
env = conf.Finish()
##
# The env variable is cloned for IpOpt, NlOpt and CERES to avoid
# propagating the link flags for them in the main build script.
##
##
# Check for optional dependencies, downloading them if they
# are not already available in the user's environment.
#
# At this point CCFLAGS and LINKFLAGS already contain the
# right flags if those dependencies if they found via
# 'pkg-config'. Check whether they are usable, and download
# them if not.
#
##
##
# IpOpt dependencies
##
env2 = env.Clone()
if not on_windows and not library_available(env2, pkgspec='ipopt', inc_var='IPOPT_INC', lib_var='IPOPT_DIR', lib='IPOPT_LIB', header='coin/IpTNLP.hpp') and env['DL_EXTERNALS']:
execfile('obtain_ipopt.py')
##
# NlOpt dependencies
##
env2 = env.Clone()
if not library_available(env2, pkgspec='nlopt', inc_var='NLOPT_INC', lib_var='NLOPT_DIR', lib='NLOPT_LIB', header='nlopt.h') and env['DL_EXTERNALS']:
execfile('obtain_nlopt.py')
##
# CERES dependencies
##
env2 = env.Clone()
if not library_available(env2, pkgspec='ceres', inc_var='CERES_INC', lib_var='CERES_DIR', lib='CERES_LIB', header='ceres/ceres.h') and env['DL_EXTERNALS']:
execfile('obtain_ceres.py')
C.progress_display("external libraries are built as shared libraries")
C.progress_display("please adjust the shared library search path \
before running ALTA")
##
# QuadProg++
# TODO: Change to the QuadProg v2 code
......
import obtain
import os
import sys
import shutil
import subprocess
import SCons.Warnings as W
import SCons.SConf as C
# Download GLOG
version = '0.3.3'
base = 'glog'
name = 'GLOG v' + version
directory = base + '-' + version
url = 'http://google-glog.googlecode.com/files/glog-' + version + '.tar.gz'
filename = 'glog-' + version + '.tar.gz'
sha256 = 'fbf90c2285ba0561db7a40f8a4eefb9aa963e7d399bd450363e959929fe849d0'
glog_obtained = False
glog_compiled = False
if os.name != 'nt':
glog_obtained = obtain.obtain(name, directory, url, filename, sha256)
glog_compiled = os.path.exists('.' + os.sep + 'build' + os.sep + 'include' + os.sep + 'glog')
if glog_obtained and not glog_compiled:
if sys.platform == 'darwin':
obtain.patch('glog-0.3.3/src/glog/stl_logging.h.in', 'glog.patch')
C.progress_display('configuring and building GLOG for CERES')
glog_compiled = obtain.configure_build(directory,
['--disable-shared',
'--enable-static', '--with-pic'])
# Download CERES. Assume Eigen is already available.
version = '1.9.0'
base = 'ceres-solver'
name = 'CERES v' + version
directory = base + '-' + version
url = 'http://ceres-solver.org/ceres-solver-' + version + '.tar.gz'
filename = 'ceres-solver-' + version + '.tar.gz'
sha256 = '30ac0729249f908afe80cb6fd06ae6d037f25a60d9fac54f61344389adab9c1a'
obtained = obtain.obtain(name, directory, url, filename, sha256)
## Test for the presence of already compiled ceres version in
## the $ALTA/external/build directory. Then test for the
## presence of cmake.
compile_test = not os.path.exists('.' + os.sep + 'build' + os.sep + 'include' + os.sep + 'ceres')
if obtained and compile_test:
C.progress_display('configuring and building ' + name)
# Build cmake script
build_dir = os.pardir + os.sep + 'build' + os.sep
options = ''
if glog_compiled:
options = '-DGLOG_LIBRARY=' + build_dir + 'lib' + os.sep + 'libglog.a' + ' -DGLOG_INCLUDE_DIR=' + build_dir + 'include' + ' -DMINIGLOG=OFF'
else:
options = '-DMINIGLOG=ON'
options = options + ' include -DGFLAGS=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF'
# When Eigen was not found by pkg-config (i.e., it was built
# locally under externals/, or the user specified 'EIGEN_INC' in
# the config file), then we need to tell CMake where to find it.
if env['EIGEN_INC']:
options += '-DEIGEN_INCLUDE_DIR=' + env['EIGEN_INC'][0] + '/include'
if not sys.platform.startswith('win'):
# Build PIC so we can link it into our DSOs.
options = options + ' -DCMAKE_CXX_FLAGS=-fPIC'
if obtain.cmake_build(directory, options):
if not glog_compiled:
# When CERES builds miniglog, it installs its headers under
# $includedir/ceres/internal/miniglog. Move it to the right
# place.
includedir = Dir('#external/build/include').abspath
os.rename(includedir + '/ceres/internal/miniglog/glog',
includedir + '/glog')
# CERES's CMakeLists.txt chooses to install to lib64/ or lib/
# depending on the phase of the moon. Rectify that by moving
# things to lib/ if need be.
libdir = Dir('#external/build/lib').abspath
lib64dir = Dir('#external/build/lib64').abspath
if os.access(lib64dir, os.R_OK):
os.rename(lib64dir + '/libceres.a', libdir + '/libceres.a')
if not glog_compiled:
os.rename(lib64dir + '/libminiglog.a', libdir + '/libminiglog.a')
os.rmdir(lib64dir)
# When building miniglog, rename it to libglog.a, which is what the
# rest of the build system expects.
if not glog_compiled:
if not sys.platform.startswith('win'):
os.rename(libdir + '/libminiglog.a', libdir + '/libglog.a')
else:
os.rename(libdir + '/miniglog.lib', libdir + '/libglog.lib')
#end ifelse
#end if
#end if
else:
W.warn(obtain.AltaDependencyWarning,
'CERES already installed or cannot be installed automatically')
import obtain
import os
import sys
import shutil
import subprocess
import SCons.Warnings as W
import SCons.SConf as C
from subprocess import Popen, PIPE
def getThirdParty(name) :
path = os.getcwd()
third = path + os.sep + directory + os.sep + 'ThirdParty' + os.sep
os.chdir(third + name)
ret = Popen(['./get.' + name]).wait()
if(ret != 0):
C.progress_display('Failed to get IpOpt third party \'' + name + '\'')
os.chdir(path)
# Download IpOpt.
version = '3.12.4'
base = 'Ipopt'
name = 'IpOpt v' + version
directory = base + '-' + version
url = 'http://www.coin-or.org/download/source/Ipopt/Ipopt-' + version + '.tgz'
filename = 'Ipopt-' + version + '.tgz'
sha256 = '292afd952c25ec9fe6225041683dcbd3cb76e15a128764671927dbaf881c2e89'
obtained = obtain.obtain(name, directory, url, filename, sha256)
compiled = os.path.exists('.' + os.sep + 'build' + os.sep + 'include' + os.sep + 'coin/IpIpoptNLP.hpp')
if obtained and not compiled:
if os.name == 'nt':
W.warn(obtain.AltaDependencyWarning, 'sorry, no automatic installation of IpOpt')
else:
C.progress_display('configuring and building ' + name + ' and its dependencies')
getThirdParty('Blas')
getThirdParty('Lapack')
getThirdParty('ASL')
getThirdParty('Mumps')
obtain.configure_build(directory,
['--enable-static', '--with-pic',
'--enable-dependency-linking'])
else:
C.progress_display('IpOpt is already installed')
C.progress_display('if the plugins using IpOpt fail to build, check its installation')
import obtain
import os
import sys
import shutil
import SCons.SConf as C
# Download NlOpt.
version = '2.4.1'
base = 'nlopt'
name = 'NlOpt v' + version
directory = base + '-' + version
baseurl = 'http://ab-initio.mit.edu/nlopt/'
url = baseurl + 'nlopt-' + version + '.tar.gz'
filename = 'nlopt-' + version + '.tar.gz'
sha256 = 'fe9ade54ed79c87f682540c34ad4e610ff32c9a43c52c6ea78cef6adcd5c1319'
obtained = obtain.obtain(name, directory, url, filename, sha256)
compiled = os.path.exists('.' + os.sep + 'build' + os.sep + 'include' + os.sep + 'nlopt.hpp')
if obtained and not compiled:
C.progress_display('configuring and building ' + name)
if os.name == 'nt':
# Get the CMakeList file
obtain.download(baseurl + 'CMakeLists.txt', directory+os.sep+'CMakeLists.txt')
# Get the Additional CMake script
obtain.download(baseurl + 'config.cmake.h.in', directory+os.sep+'config.cmake.h.in')
# Build cmake script
obtain.cmake_build(directory)
else:
obtain.configure_build(directory,
['--enable-static', '--with-pic',
'--without-matlab',
'--without-octave', '--without-python',
'--without-guile'])
else:
print '<<INSTALL>> NlOpt already installed'
......@@ -94,6 +94,8 @@ if not GetOption('silent') and not GetOption('clean'):
# of directories that contain several plugins. (FIXME)
map(display_status, omitted)
print ""
print " See 'documents/install.dox' or <http://alta.gforge.inria.fr/install.html>"
print " for a list of optional dependencies and associated plugins."
print " See 'config.log' for details."
print ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment