Hi Andre, Attached is a patch for adding CGAL to the build system. Please let me know how it works for you.
Johannes On Tue, Dec 1, 2009 at 2:25 PM, Johannes Ring <[email protected]> wrote: > On Tue, Dec 1, 2009 at 1:33 PM, Andre Massing <[email protected]> wrote: >> Johannes Ring wrote: >>> >>> On Tue, Dec 1, 2009 at 11:34 AM, Anders Logg <[email protected]> wrote: >>>> >>>> Johannes, could you help Andre to add CGAL detection and build flag to >>>> his CGAL branch of DOLFIN: >>>> >>>> https://code.launchpad.net/~massing/dolfin/cgal_branch >>>> >>>> Andre can give detailed instructions on which flags are needed. >>> >>> Yes, of course. Andre: It would be great if you also have a tiny >>> example of CGAL that I can compile and run in the pkg-config >>> generator. >> >> Ok, attached a mini file printing out the CGAL version nummer. >> Additonally scons must assure that CGAL >= 3.5 is used. > > OK, thanks. > > Johannes > >>> >>> Johannes >>> >>>> The plan is to merge the CGAL branch into DOLFIN main after the >>>> release of 0.9.5 and then make a quick release of DOLFIN 0.9.6 >>>> with the CGAL stuff. >>>> >>>> -- >>>> Anders >>>> >>>> -----BEGIN PGP SIGNATURE----- >>>> Version: GnuPG v1.4.9 (GNU/Linux) >>>> >>>> iEYEARECAAYFAksU8T0ACgkQTuwUCDsYZdE2RgCfb3cyn8WMBIw2E945h2meOi3H >>>> mxcAoJG09J5SMFd/wRDU6981tL0AFV4V >>>> =+et7 >>>> -----END PGP SIGNATURE----- >>>> >>>> >> >
# Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: [email protected] # target_branch: bzr+ssh://bazaar.launchpad.net/~massing/dolfin\ # /cgal_branch/ # testament_sha1: ae672a2eb2c5a8a648be7c72762ca9e9a3a39c6b # timestamp: 2009-12-03 10:51:51 +0100 # base_revision_id: [email protected] # # Begin patch === modified file 'SConstruct' --- SConstruct 2009-11-18 09:53:57 +0000 +++ SConstruct 2009-12-03 09:44:38 +0000 @@ -103,6 +103,7 @@ BoolVariable("enableParmetis", "Compile with support for ParMETIS", "yes"), BoolVariable("enableGmp", "Compile with support for GMP", "no"), BoolVariable("enableZlib", "Compile with support for zlib", "yes"), + BoolVariable("enableCgal", "Compile with support for CGAL", "yes"), BoolVariable("enablePython", "Compile the Python wrappers", "yes"), BoolVariable("enablePydolfin", "Compile the Python wrappers of DOLFIN *deprecated*", "yes"), # some of the above may need extra options (like petscDir), should we @@ -123,6 +124,7 @@ PathVariable("withLibxml2Dir", "Specify path to libXML2", None, path_validator), PathVariable("withGtsDir", "Specify path to GTS", None, path_validator), PathVariable("withZlibDir", "Specify path to zlib", None, path_validator), + PathVariable("withCgalDir", "Specify path to CGAL", None, path_validator), # # a few more options originally from PyCC: #BoolVariable("autoFetch", "Automatically fetch datafiles from (password protected) SSH repository", 0), === modified file 'dolfin/SConscript' --- dolfin/SConscript 2009-10-19 10:41:27 +0000 +++ dolfin/SConscript 2009-12-03 09:44:38 +0000 @@ -60,6 +60,8 @@ disabled_packages.append("gmp") if not env["enableZlib"]: disabled_packages.append("zlib") + if not env["enableCgal"]: + disabled_packages.append("cgal") # Find modules in the project and dependencies: # only modules and configuredPackages will be used in this code: === modified file 'dolfin/scons.cfg' --- dolfin/scons.cfg 2009-11-04 10:46:13 +0000 +++ dolfin/scons.cfg 2009-12-03 09:44:38 +0000 @@ -17,7 +17,8 @@ 'mtl4': '4', 'parmetis': '3.1', 'gmp': '4.2.4', - 'zlib': '1.2.3'} + 'zlib': '1.2.3', + 'cgal': '3.5'} SwigDependencies = ['python-2', 'numpy-1','ufc-1'] # List of components === added file 'scons/simula-scons/simula_scons/pkgconfiggenerators/cgal.py' --- scons/simula-scons/simula_scons/pkgconfiggenerators/cgal.py 1970-01-01 00:00:00 +0000 +++ scons/simula-scons/simula_scons/pkgconfiggenerators/cgal.py 2009-12-03 09:44:38 +0000 @@ -0,0 +1,122 @@ +#!/usr/bin/env python +import os,sys +import string +import os.path + +from commonPkgConfigUtils import * + +def getCgalDir(sconsEnv=None): + return getPackageDir("cgal", sconsEnv=sconsEnv, default="/usr") + +def pkgVersion(compiler=None, linker=None, + cflags=None, libs=None, sconsEnv=None): + # This is a bit special. It is given in the library as + # a 10 digit number, like 1030511000. We have to do some arithmetics + # to find the real version: + # (VERSION / 1000 - 1000001) / 10000 => major version (3 in this case) + # (VERSION / 1000 - 1000001) / 100 % 100 => minor version (5 in this case) + # (VERSION / 1000 - 1000001) / 10 % 10 => sub-minor version (1 in this case). + # + # The version check also verify that we can include some CGAL headers. + cpp_test_version_str = r""" +#include <CGAL/version.h> +#include <iostream> + +int main() { + #ifdef CGAL_VERSION_NR + std::cout << CGAL_VERSION_NR; + #endif + return 0; +} +""" + cppfile = "cgal_config_test_version.cpp" + write_cppfile(cpp_test_version_str, cppfile); + + if not compiler: + compiler = get_compiler(sconsEnv=sconsEnv) + if not cflags: + cflags = pkgCflags(sconsEnv=sconsEnv) + + cmdstr = "%s -o a.out %s %s" % (compiler, cflags, cppfile) + compileFailed, cmdoutput = getstatusoutput(cmdstr) + if compileFailed: + remove_cppfile(cppfile) + raise UnableToCompileException("CGAL", cmd=cmdstr, + program=cpp_test_version_str, + errormsg=cmdoutput) + + cmdstr = os.path.join(os.getcwd(), "a.out") + runFailed, cmdoutput = getstatusoutput(cmdstr) + if runFailed: + remove_cppfile(cppfile, execfile=True) + raise UnableToRunException("CGAL", errormsg=cmdoutput) + cgal_version_nr = int(cmdoutput) + cgal_major = (cgal_version_nr / 1000 - 1000001) / 10000 + cgal_minor = (cgal_version_nr / 1000 - 1000001) / 100 % 100 + cgal_subminor = (cgal_version_nr / 1000 - 1000001) / 10 % 10 + full_cgal_version = "%s.%s.%s" % (cgal_major, cgal_minor, cgal_subminor) + + remove_cppfile(cppfile, execfile=True) + + return full_cgal_version + +def pkgCflags(sconsEnv=None): + return "-I%s -frounding-math" % \ + os.path.join(getCgalDir(sconsEnv=sconsEnv), "include") + +def pkgLibs(sconsEnv=None): + return "-L%s -lCGAL -lCGAL_Core" % \ + os.path.join(getCgalDir(sconsEnv), "lib") + +def pkgTests(forceCompiler=None, sconsEnv=None, + cflags=None, libs=None, version=None, **kwargs): + """Run the tests for this package + + If Ok, return various variables, if not we will end with an exception. + forceCompiler, if set, should be a tuple containing (compiler, linker) + or just a string, which in that case will be used as both + """ + + if not forceCompiler: + compiler = get_compiler(sconsEnv) + linker = get_linker(sconsEnv) + else: + compiler, linker = set_forced_compiler(forceCompiler) + + if not cflags: + cflags = pkgCflags(sconsEnv=sconsEnv) + if not libs: + libs = pkgLibs(sconsEnv=sconsEnv) + if not version: + version = pkgVersion(sconsEnv=sconsEnv, compiler=compiler, + linker=linker, cflags=cflags, libs=libs) + else: + # FIXME: Add a real test for this package + pkgVersion(sconsEnv=sconsEnv, compiler=compiler, + linker=linker, cflags=cflags, libs=libs) + + return version, libs, cflags + +def generatePkgConf(directory=None, sconsEnv=None, **kwargs): + if directory is None: + directory = suitablePkgConfDir() + + version, libs, cflags = pkgTests(sconsEnv=sconsEnv) + + pkg_file_str = r"""Name: cgal +Version: %s +Description: Computational Geometry Algorithms Library +Libs: %s +Cflags: %s +""" % (version, repr(libs)[1:-1], repr(cflags)[1:-1]) + # FIXME: ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ + # Is there a better way to handle this on Windows? + + pkg_file = open(os.path.join(directory, "cgal.pc"), 'w') + pkg_file.write(pkg_file_str) + pkg_file.close() + print "done\n Found cgal and generated pkg-config file in\n '%s'" \ + % directory + +if __name__ == "__main__": + generatePkgConf(directory=".") # Begin bundle IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWROFEw4ABhd/gHW9gCB69/// /7ffz7////pgDG59Gxu7VwkFACrdx1cs2zZoq664UFSAVuEkU1T9VN6DUeg01Gmm0mk8TTKNAAA0 ZANGmQ00AGSmKntSP1NqnqfqGo09QBkANAAaAGhoAAaAOBo0Yg0aZMIMQGIxNGjRoA000AAAASJB BGjQRiam0akzTU2kaEfqnqejU8U9I09MoaNMg8p6T1DgaNGINGmTCDEBiMTRo0aANNNAAAAEkQEA ImFPQhPRptKntMibRID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FFnO1hpHgHwHwFypeRBSnVbHyEsha 0hNDdV4zHNwVMHWIS5Ix9y9bCZsduzB2tc2SPlYevlyFrrfkcOE005szaipPepi6wVSxtjGM3USF dl4d/0PynW022mtqYDnNu1Zi05M7Ws1dN5sIXdZ0BP8BBoW1CysbTBtpUDUjY/NhcYDZjnUQKpw5 86V5kGMb03mpXKJjK+6KZM+ELRF4TlHO66aDcqvo7t1jRmmTJ9eu2qUwcwMoZJxcyjnSpDlrM2gG gvuBVwtIE2UBQapTyZ/LqMQrcDzJPQaGMZglNCk1e1fIUFhV0qnFeVMgqtti0Bj9k5dnOINfUrsv 0lpI32DSjGDidszlGxewFCV6Et9plmuWinRp/NB09+diCdLYStcku+RnWBzEmRl2Jp7VryGtBila joMakSnC5lIEFsgSm1YKw+cR0i2g8ipJCLT/xdyRThQkBOFEw4A=
_______________________________________________ Mailing list: https://launchpad.net/~dolfin Post to : [email protected] Unsubscribe : https://launchpad.net/~dolfin More help : https://help.launchpad.net/ListHelp

