Commit 4494c77f authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Updating the compilation scripts for scons

parent 09294e9c
......@@ -17,10 +17,15 @@ if not os.path.exists(configFile):
vars = Variables(configFile)
vars.Add('CXX', 'Compiler')
vars.Add('CCFLAGS', 'Compiler\'s flags')
vars.Add('LINKLAGS', 'Linker\'s flags')
vars.Add('LINKFLAGS', 'Linker\'s flags')
vars.Add('OPENEXR_INC', 'OpenEXR include directory')
vars.Add('OPENEXR_DIR', 'OpenEXR libraries directory')
vars.Add('OPENEXR_LIBS', 'OpenEXR libraries')
vars.Add('OPENMP_FLAGS', 'OpenMP required flags')
vars.Add('OPENMP_LIBS', 'OpenMP libraries')
vars.Add('QUADPROG_INC', 'QUADPROG include directory')
vars.Add('QUADPROG_DIR', 'QUADPROG libraries directory')
vars.Add('QUADPROG_LIBS', 'QUADPROG libraries')
vars.Add('CERES_INC', 'CERES include directory')
vars.Add('CERES_DIR', 'CERES libraries directory')
vars.Add('CERES_LIBS', 'CERES libraries')
......
......@@ -16,8 +16,8 @@ LINKFLAGS = []
## OpenMP flags
##
#OPENMP_FLAGS = ['-fopenmp']
#OPENMP_LIB = ['gomp']
OPENMP_FLAGS = ['-fopenmp']
OPENMP_LIBS = ['gomp']
## OpenEXR library
......@@ -27,6 +27,15 @@ LINKFLAGS = []
#OPENEXR_LIB = ['Half', 'IlmImf', 'IlmThread']
## QUADPROG library
##
## You have to specify the directory of the QuadProg library
##
QUADPROG_INC = ['#external/quadprog++']
QUADPROG_DIR = ['#external/build/lib']
QUADPROG_LIBS = ['quadprog++']
## CERES library
##
## You have to specify both the directory of the CERES library
......@@ -40,8 +49,7 @@ CERES_OPT_LIBS = ['gomp', 'lapack', 'blas']
## NlOpt library
##
## You have to specify both the directory of the NlOpt library
## and the glog library
## You have to specify the directory of the NlOpt library
##
NLOPT_INC = ['#external/build/include']
NLOPT_DIR = ['#external/build/lib']
......
......@@ -13,17 +13,17 @@ else:
##
# CERES dependancies
##
if env['CERES_INC'] == ['#external/build/include'] and env['CERES_DIR'] == ['#external/build/lib']:
if 'CERES_INC' in env and env['CERES_INC'] == ['#external/build/include'] and env['CERES_DIR'] == ['#external/build/lib']:
execfile('obtain_ceres.py')
#end
#end
##
# QuadProg++
##
qp_target = 'build' + os.sep + 'lib' + os.sep + 'quadprog++'
qp_base = 'quadprog++' + os.sep
qp_sources = [qp_base + 'Array.cc', qp_base + 'QuadProg++.cc']
env.Append(CPPPATH = ['build' + os.sep + 'include'])
env.StaticLibrary(target = qp_target, source = qp_sources)
##
# QuadProg++
##
qp_target = 'build' + os.sep + 'lib' + os.sep + 'quadprog++'
qp_base = 'quadprog++' + os.sep
qp_sources = [qp_base + 'Array.cc', qp_base + 'QuadProg++.cc']
env.Append(CPPPATH = ['build' + os.sep + 'include'])
env.StaticLibrary(target = qp_target, source = qp_sources)
#end
env = Environment()
Export('env')
env.SConscript('SConscript')
......@@ -15,7 +15,7 @@ if not os.path.exists('.' + os.sep + 'build' + os.sep + 'include' + os.sep + 'gl
obtain.patch('glog-0.3.3/src/glog/stl_logging.h.in', 'glog.patch')
#end
print '<<INSTALL>> configure and build GLOG v0.3.3'
obtain.configure_build('glog-0.3.3')
obtain.configure_build('glog-0.3.3', '--enable-static=yes --enable-shared=false --with-pic=true')
#end
else:
print '<<INSTALL>> GLOG already installed'
......@@ -33,9 +33,15 @@ print '<<WARNING>> CERES installation requires CMake. You need to run it yoursel
## 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')
with open(os.devnull, 'w') as fnull:
res = subprocess.call(['cmake', '--version'], stdout = fnull, stderr = fnull, shell=True)
compile_test = compile_test and res == 0
res = subprocess.call(['cmake', '--version'], stdout = fnull, stderr = fnull, shell=True)
if res != 0:
compile_test = False
print '<<ERROR>> cmake is not installed'
#end
#end
if compile_test:
print '<<INSTALL>> configure and build CERES'
......@@ -51,7 +57,7 @@ if compile_test:
libname = 'libglog.dylib'
#end
cmake_cmd = 'cmake -DGLOG_LIB=' + build_dir + 'lib' + os.sep + libname + ' -DGLOG_INCLUDE=' + build_dir + 'include -DGFLAGS=OFF ' + '-DEIGEN_INCLUDE=' + build_dir + 'include -DCMAKE_INSTALL_PREFIX=' + build_dir + ' .' + ' -DDISABLE_TR1=ON -DBUILD_EXAMPLES=OFF ' + '-DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DMINIGLOG=ON'
cmake_cmd = 'cmake -DGLOG_LIB=' + build_dir + 'lib' + os.sep + libname + ' -DGLOG_INCLUDE=' + build_dir + 'include -DGFLAGS=OFF ' + '-DEIGEN_INCLUDE=' + build_dir + 'include -DCMAKE_INSTALL_PREFIX=' + build_dir + ' .' + ' -DDISABLE_TR1=ON -DBUILD_EXAMPLES=OFF ' + '-DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DMINIGLOG=OFF'
if os.name == 'nt':
ret = os.system(cmake_cmd + ' -G \"NMake Makefiles\"')
......
......@@ -21,6 +21,11 @@ vars.Add('LINKFLAGS', 'Linker\'s flags')
vars.Add('OPENEXR_INC', 'OpenEXR include directory')
vars.Add('OPENEXR_DIR', 'OpenEXR libraries directory')
vars.Add('OPENEXR_LIBS', 'OpenEXR libraries')
vars.Add('OPENMP_FLAGS', 'OpenMP required flags')
vars.Add('OPENMP_LIBS', 'OpenMP libraries')
vars.Add('QUADPROG_INC', 'QUADPROG include directory')
vars.Add('QUADPROG_DIR', 'QUADPROG libraries directory')
vars.Add('QUADPROG_LIBS', 'QUADPROG libraries')
vars.Add('CERES_INC', 'CERES include directory')
vars.Add('CERES_DIR', 'CERES libraries directory')
vars.Add('CERES_LIBS', 'CERES libraries')
......
......@@ -3,12 +3,10 @@ SConscript('data_merl/SConscript')
SConscript('data_brdf_slice/SConscript')
SConscript('data_interpolant/SConscript')
# Building fitters
# Building nonlinear fitters
SConscript('nonlinear_fitter_ceres/SConscript')
SConscript('nonlinear_fitter_nlopt/SConscript')
SConscript('nonlinear_fitter_eigen/SConscript')
SConscript('rational_fitter_eigen/SConscript')
SConscript('rational_fitter_quadprog/SConscript')
# Building nonlinear functions
SConscript('nonlinear_function_diffuse/SConscript')
......@@ -20,6 +18,11 @@ SConscript('nonlinear_function_isotropic_lafortune/SConscript')
# Building nonlinear masking functions
SConscript('nonlinear_shadowing_smith/SConscript')
# Building rational fitters
SConscript('rational_fitter_eigen/SConscript')
SConscript('rational_fitter_quadprog/SConscript')
SConscript('rational_fitter_parallel/SConscript')
# Building rational functions
SConscript('rational_function_legendre/SConscript')
SConscript('rational_function_chebychev/SConscript')
......
Import('env')
env = env.Clone()
env.AppendUnique(CPPPATH = env['QUADPROG_INC'])
env.AppendUnique(LIBPATH = env['QUADPROG_DIR'])
env.AppendUnique(LIBS = env['QUADPROG_LIBS'])
env.AppendUnique(CCFLAGS = env['OPENMP_FLAGS'])
env.AppendUnique(LIBS = env['OPENMP_LIBS'])
env.AppendUnique(LIBS = ['core'])
conf = Configure(env)
sources = ['rational_fitter.cpp']
if conf.CheckLib(env['QUADPROG_LIBS']) and conf.CheckLib(env['OPENMP_LIBS']):
env.SharedLibrary('../../build/rational_fitter_parallel', sources)
#end
conf.Finish()
Import('env')
env = env.Clone()
#env = Environment()
#env.Append(CPPPATH = ['../../../external/quadprog++', '../../../external/build/include', '../../'])
#env.Append(LIBPATH = ['../../../external/build/lib', '../../build'])
env.AppendUnique(CPPPATH = ['../../../external/quadprog++'])
env.AppendUnique(LIBPATH = env['QUADPROG_DIR'])
env.AppendUnique(CPPPATH = env['QUADPROG_INC'])
env.AppendUnique(LIBS = env['QUADPROG_LIBS'])
env.AppendUnique(LIBS = ['core'])
conf = Configure(env)
sources = ['rational_fitter.cpp']
libs = ['core', 'quadprog++']
if conf.CheckLib('quadprog++'):
env.SharedLibrary('../../build/rational_fitter_quadprog', sources, LIBS=libs)
env.SharedLibrary('../../build/rational_fitter_quadprog', sources)
#end
conf.Finish()
\ No newline at end of file
conf.Finish()
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