xref: /petsc/config/BuildSystem/config/packages/egads.py (revision 7b5fd022a6ba26727040df7457b27566b4c6742d)
1a8ededdfSMatthew G. Knepleyimport config.package
2a8ededdfSMatthew G. Knepleyimport os
3a8ededdfSMatthew G. Knepley
4a8ededdfSMatthew G. Knepleyclass Configure(config.package.GNUPackage):
5a8ededdfSMatthew G. Knepley  def __init__(self, framework):
6a8ededdfSMatthew G. Knepley    config.package.GNUPackage.__init__(self, framework)
7*5552b385SBrandon    self.gitcommit         = 'ee0890bb2ce96bdd878fc2b628602640027eaa85'
8*5552b385SBrandon    self.download          = ['git://https://github.com/bldenton/EGADSlite.git']
91474a711SMatthew G. Knepley    self.functions         = ['EG_open']
101474a711SMatthew G. Knepley    self.includes          = ['egads.h']
11a8ededdfSMatthew G. Knepley    self.hastests          = 1
12c9b04d1eSJunchao Zhang    self.buildLanguages    = ['Cxx']
130f2d2bceSMatthew G. Knepley    self.hasegadslite      = 1
140f2d2bceSMatthew G. Knepley    self.hasegads          = 1
15fa5e6ec9SPierre Jolivet    self.skippackagelibincludedirs = 1
16a8ededdfSMatthew G. Knepley    return
17a8ededdfSMatthew G. Knepley
18a8ededdfSMatthew G. Knepley  def setupDependencies(self, framework):
19a8ededdfSMatthew G. Knepley    config.package.GNUPackage.setupDependencies(self, framework)
201474a711SMatthew G. Knepley    self.pthread = self.framework.require('config.packages.pthread',self)
210f2d2bceSMatthew G. Knepley    self.oce     = self.framework.require('config.packages.opencascade',self)
221474a711SMatthew G. Knepley    self.deps    = [self.pthread]
230f2d2bceSMatthew G. Knepley    self.odeps   = [self.oce]
24a8ededdfSMatthew G. Knepley    return
25a8ededdfSMatthew G. Knepley
260f2d2bceSMatthew G. Knepley  def setupHelp(self, help):
270f2d2bceSMatthew G. Knepley    config.package.GNUPackage.setupHelp(self,help)
280f2d2bceSMatthew G. Knepley    import nargs
290f2d2bceSMatthew G. Knepley    help.addArgument('EGADS', '-egads-full', nargs.ArgBool(None, 1, 'Install EGADS in addition to EGADSLite'))
300f2d2bceSMatthew G. Knepley    return
310f2d2bceSMatthew G. Knepley
320f2d2bceSMatthew G. Knepley  def createEGADSLiteMakefile(self):
330f2d2bceSMatthew G. Knepley    if not self.hasegadslite: return
340f2d2bceSMatthew G. Knepley    makeinc = os.path.join(self.packageDir, 'make_lite.inc')
35a8ededdfSMatthew G. Knepley    g = open(makeinc,'w')
36a8ededdfSMatthew G. Knepley    g.write('''
37a8ededdfSMatthew G. Knepleyinclude $(PETSC_DIR)/lib/petsc/conf/variables
38a8ededdfSMatthew G. Knepley
390f2d2bceSMatthew G. KnepleyEGADSFLAGS = -DLITE -IEGADSlite/include
40a8ededdfSMatthew G. Knepley
410f2d2bceSMatthew G. KnepleyINCDIR     = EGADSlite/include
420f2d2bceSMatthew G. KnepleySRCDIR     = EGADSlite/src
43a8ededdfSMatthew G. KnepleyLIBBASE    = libegadslite
44a8ededdfSMatthew G. KnepleyLIBNAME    = ${LIBBASE}.${AR_LIB_SUFFIX}
45*5552b385SBrandonLIBSRC.h   = $(INCDIR)/egads_lite.h $(INCDIR)/egadsErrors.h \
46*5552b385SBrandon             $(INCDIR)/egadsInternals_lite.h $(INCDIR)/egadsTris_lite.h $(INCDIR)/egadsTypes.h \
470f2d2bceSMatthew G. Knepley             $(INCDIR)/emp_lite.h $(INCDIR)/liteClasses.h $(INCDIR)/liteString.h \
480f2d2bceSMatthew G. Knepley             $(INCDIR)/regQuads_lite.h
49a8ededdfSMatthew G. KnepleyLIBSRC.c   = $(SRCDIR)/liteAttrs.c $(SRCDIR)/liteBase.c $(SRCDIR)/liteGeom.c $(SRCDIR)/liteImport.c \
500f2d2bceSMatthew G. Knepley             $(SRCDIR)/liteMemory.c $(SRCDIR)/liteString.c $(SRCDIR)/egadsTess_lite.c $(SRCDIR)/egadsTessInp_lite.c \
510f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsTris_lite.c $(SRCDIR)/liteTopo.c $(SRCDIR)/egadsQuads_lite.c $(SRCDIR)/regQuads_lite.c \
520f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsRobust_lite.c $(SRCDIR)/emp_lite.c $(SRCDIR)/evaluate_lite.c $(SRCDIR)/rational_lite.c \
530f2d2bceSMatthew G. Knepley             $(SRCDIR)/limitTessBody_lite.c $(SRCDIR)/liteTest.c \
540f2d2bceSMatthew G. Knepley             $(SRCDIR)/retessFaces_lite.c
55a8ededdfSMatthew G. KnepleyLIBSRC.o   = $(LIBSRC.c:%.c=%.o)
56a8ededdfSMatthew G. Knepley
57a8ededdfSMatthew G. Knepleylib : $(LIBNAME) ;
58a8ededdfSMatthew G. Knepley
59a8ededdfSMatthew G. Knepley$(LIBSRC.o) : $(LIBSRC.h)
60a8ededdfSMatthew G. Knepley
61a8ededdfSMatthew G. Knepleydefine ARCHIVE_RECIPE_WIN32FE_LIB
62a8ededdfSMatthew G. Knepley  @$(RM) $@ $@.args
63a8ededdfSMatthew G. Knepley  @cygpath -w $^ > $@.args
64a8ededdfSMatthew G. Knepley  $(AR) $(AR_FLAGS) $@ @$@.args
65a8ededdfSMatthew G. Knepley  @$(RM) $@.args
66a8ededdfSMatthew G. Knepleyendef
67a8ededdfSMatthew G. Knepley
68a8ededdfSMatthew G. Knepleydefine ARCHIVE_RECIPE_DEFAULT
69a8ededdfSMatthew G. Knepley  @$(RM) $@
70a8ededdfSMatthew G. Knepley  $(AR) $(AR_FLAGS) $@ $^
71a8ededdfSMatthew G. Knepley  $(RANLIB) $@
72a8ededdfSMatthew G. Knepleyendef
73a8ededdfSMatthew G. Knepley
74a8ededdfSMatthew G. Knepley$(LIBNAME) : $(LIBSRC.o)
75a8ededdfSMatthew G. Knepley	$(if $(findstring win32fe lib,$(AR)),$(ARCHIVE_RECIPE_WIN32FE_LIB),$(ARCHIVE_RECIPE_DEFAULT))
76a8ededdfSMatthew G. Knepley
770f2d2bceSMatthew G. KnepleyCOMPILE.c   = $(CC)  $(CC_FLAGS)  $(FLAGS)    $(CPPFLAGS)    $(EGADSFLAGS) $(TARGET_ARCH) -c
780f2d2bceSMatthew G. KnepleyCOMPILE.cpp = $(CXX) $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(EGADSFLAGS) $(TARGET_ARCH) -c
790f2d2bceSMatthew G. Knepley
800f2d2bceSMatthew G. Knepley# This is unusual; usually prefix would default to /usr/local
810f2d2bceSMatthew G. Knepleyprefix ?= $(PETSC_DIR)/$(PETSC_ARCH)
820f2d2bceSMatthew G. Knepleylibdir = $(prefix)/lib
830f2d2bceSMatthew G. Knepleyincludedir = $(prefix)/include
840f2d2bceSMatthew G. KnepleyINSTALL = install
850f2d2bceSMatthew G. KnepleyINSTALL_DATA = $(INSTALL) -m644
860f2d2bceSMatthew G. KnepleyMKDIR_P = mkdir -p
870f2d2bceSMatthew G. Knepley
880f2d2bceSMatthew G. Knepleyinstall-egads: $(LIBNAME)
890f2d2bceSMatthew G. Knepley	$(MKDIR_P) "$(DESTDIR)$(includedir)" "$(DESTDIR)$(libdir)"
900f2d2bceSMatthew G. Knepley	$(INSTALL_DATA) $(LIBSRC.h) "$(DESTDIR)$(includedir)/"
910f2d2bceSMatthew G. Knepley	$(INSTALL_DATA) $(LIBNAME) "$(DESTDIR)$(libdir)/"
920f2d2bceSMatthew G. Knepley
930f2d2bceSMatthew G. Knepleyclean:
940f2d2bceSMatthew G. Knepley	$(RM) $(LIBNAME) $(LIBSRC.o)
950f2d2bceSMatthew G. Knepley
960f2d2bceSMatthew G. Knepley.PHONY: lib clean install-egads
970f2d2bceSMatthew G. Knepley    ''')
980f2d2bceSMatthew G. Knepley    g.close()
990f2d2bceSMatthew G. Knepley    return
1000f2d2bceSMatthew G. Knepley
1010f2d2bceSMatthew G. Knepley  def createEGADSMakefile(self):
1020f2d2bceSMatthew G. Knepley    if not self.hasegads: return
1030f2d2bceSMatthew G. Knepley    makeinc = os.path.join(self.packageDir, 'make.inc')
1040f2d2bceSMatthew G. Knepley    g = open(makeinc,'w')
1050f2d2bceSMatthew G. Knepley    g.write('''
1060f2d2bceSMatthew G. Knepleyinclude $(PETSC_DIR)/lib/petsc/conf/variables
1070f2d2bceSMatthew G. Knepley
108*5552b385SBrandonEGADSFLAGS = -IEGADS/include -IEGADS/src -IEGADS/util -IEGADS/util/uvmap -IEGADSlite/include '''+self.headers.toStringNoDupes(self.oce.include)+'/opencascade'+
1090f2d2bceSMatthew G. Knepley'''
1100f2d2bceSMatthew G. Knepley
1110f2d2bceSMatthew G. KnepleyINCDIR     = EGADS/include
112*5552b385SBrandonELIDIR     = EGADSlite/include
1130f2d2bceSMatthew G. KnepleySRCDIR     = EGADS/src
1140f2d2bceSMatthew G. KnepleyUTLDIR     = EGADS/util
115*5552b385SBrandonUVLDIR     = EGADS/util/uvmap
1160f2d2bceSMatthew G. KnepleyLIBBASE    = libegads
1170f2d2bceSMatthew G. KnepleyLIBNAME    = ${LIBBASE}.${AR_LIB_SUFFIX}
1180f2d2bceSMatthew G. KnepleyLIBSRC.h   = $(INCDIR)/egads.h $(INCDIR)/egads_dot.h $(INCDIR)/egadsErrors.h \
1190f2d2bceSMatthew G. Knepley             $(INCDIR)/egadsTypes.h $(INCDIR)/emp.h $(INCDIR)/prm.h $(INCDIR)/wsserver.h $(INCDIR)/wsss.h \
1200f2d2bceSMatthew G. Knepley             $(SRCDIR)/Surreal/SurrealD.h $(SRCDIR)/Surreal/SurrealD_Lazy.h $(SRCDIR)/Surreal/SurrealD_Trad.h \
1210f2d2bceSMatthew G. Knepley             $(SRCDIR)/Surreal/SurrealS.h $(SRCDIR)/Surreal/SurrealS_Lazy.h $(SRCDIR)/Surreal/SurrealS_Trad.h \
122*5552b385SBrandon             $(SRCDIR)/Surreal/always_inline.h $(UTLDIR)/regQuads.h $(SRCDIR)/BRepLib_FuseEdges.h \
123*5552b385SBrandon             $(SRCDIR)/egadsInternals.h $(SRCDIR)/egadsStack.h $(SRCDIR)/egadsTris.h $(SRCDIR)/egadsOCC.h \
124*5552b385SBrandon             $(SRCDIR)/egadsClasses.h $(SRCDIR)/egadsSplineFit.h $(INCDIR)/egads.inc $(INCDIR)/wsserver.inc \
125*5552b385SBrandon             $(SRCDIR)/egadsSplineVels.h $(INCDIR)/egadsf90.inc \
126*5552b385SBrandon             $(UVLDIR)/EG_uvmapFindUV.h $(UVLDIR)/EG_uvmapGen.h $(UVLDIR)/EG_uvmapStructFree.h \
127*5552b385SBrandon             $(UVLDIR)/EG_uvmap_Read.h $(UVLDIR)/EG_uvmap_Write.h $(UVLDIR)/EG_uvmapTest.h \
128*5552b385SBrandon             $(UVLDIR)/uvmap_add.h $(UVLDIR)/uvmap_bnd_adj.h $(UVLDIR)/uvmap_chk_area_uv.h \
129*5552b385SBrandon             $(UVLDIR)/uvmap_chk_edge_ratio.h $(UVLDIR)/uvmap_cpu_message.h $(UVLDIR)/uvmap_find_uv.h \
130*5552b385SBrandon             $(UVLDIR)/uvmap_from_egads.h $(UVLDIR)/uvmap_gen.h $(UVLDIR)/uvmap_gen_uv.h \
131*5552b385SBrandon             $(UVLDIR)/uvmap_ibeibe.h $(UVLDIR)/uvmap_ibfibf.h $(UVLDIR)/uvmap_ibfin.h \
132*5552b385SBrandon             $(UVLDIR)/uvmap_iccibe.h $(UVLDIR)/uvmap_iccin.h $(UVLDIR)/uvmap_idibe.h \
133*5552b385SBrandon             $(UVLDIR)/uvmap_inibe.h $(UVLDIR)/uvmap_inl_uv_bnd.h $(UVLDIR)/uvmap_malloc.h \
134*5552b385SBrandon             $(UVLDIR)/uvmap_mben_disc.h $(UVLDIR)/uvmap_message.h $(UVLDIR)/uvmap_norm_uv.h \
135*5552b385SBrandon             $(UVLDIR)/uvmap_read.h $(UVLDIR)/uvmap_solve.h $(UVLDIR)/uvmap_struct.h \
136*5552b385SBrandon             $(UVLDIR)/uvmap_struct_tasks.h $(UVLDIR)/uvmap_test.h $(UVLDIR)/uvmap_to_egads.h \
137*5552b385SBrandon             $(UVLDIR)/uvmap_version.h $(UVLDIR)/uvmap_write.h \
138*5552b385SBrandon             $(UVLDIR)/UVMAP_LIB.h $(UVLDIR)/UVMAP_LIB_INC.h \
139*5552b385SBrandon             $(ELIDIR)/liteString.h $(ELIDIR)/liteClasses.h
1400f2d2bceSMatthew G. Knepley
1410f2d2bceSMatthew G. KnepleyLIBSRC.c   = $(SRCDIR)/egadsAttrs.c $(SRCDIR)/egadsBase.c $(SRCDIR)/egadsCopy.c $(SRCDIR)/egadsExport.c \
1420f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsFit.c $(SRCDIR)/egadsGeom.c $(SRCDIR)/egadsHLevel.c $(SRCDIR)/egadsIO.c \
1430f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsMemory.c $(SRCDIR)/egadsQuads.c $(SRCDIR)/egadsRobust.c $(SRCDIR)/egadsSBO.c \
1440f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsSkinning.c $(SRCDIR)/egadsSolids.c $(SRCDIR)/egadsSpline.c $(SRCDIR)/egadsSplineFit.c \
1450f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsTess.c $(SRCDIR)/egadsTessInp.c $(SRCDIR)/egadsTessSens.c $(SRCDIR)/egadsTopo.c \
1460f2d2bceSMatthew G. Knepley             $(SRCDIR)/egadsTris.c $(UTLDIR)/emp.c $(SRCDIR)/prmCfit.c $(SRCDIR)/prmGrid.c \
147*5552b385SBrandon             $(SRCDIR)/prmUV.c $(UTLDIR)/regQuads.c $(SRCDIR)/egadsEffect.c  $(SRCDIR)/fgadsBase.c \
148*5552b385SBrandon             $(SRCDIR)/fgadsMemory.c $(SRCDIR)/fgadsAttrs.c $(SRCDIR)/fgadsTess.c $(SRCDIR)/fgadsHLevel.c \
149*5552b385SBrandon             $(SRCDIR)/fgadsGeom.c $(SRCDIR)/fgadsTopo.c \
150*5552b385SBrandon             $(UVLDIR)/main/uvmap.c $(UVLDIR)/EG_uvmapFindUV.c $(UVLDIR)/EG_uvmapGen.c \
151*5552b385SBrandon             $(UVLDIR)/EG_uvmap_Read.c $(UVLDIR)/EG_uvmapStructFree.c $(UVLDIR)/EG_uvmapTest.c \
152*5552b385SBrandon             $(UVLDIR)/EG_uvmap_Write.c $(UVLDIR)/uvmap_add.c $(UVLDIR)/uvmap_bnd_adj.c \
153*5552b385SBrandon             $(UVLDIR)/uvmap_chk_area_uv.c $(UVLDIR)/uvmap_chk_area_uv.c $(UVLDIR)/uvmap_chk_edge_ratio.c \
154*5552b385SBrandon             $(UVLDIR)/uvmap_cpu_message.c $(UVLDIR)/uvmap_find_uv.c $(UVLDIR)/uvmap_from_egads.c \
155*5552b385SBrandon             $(UVLDIR)/uvmap_gen.c $(UVLDIR)/uvmap_gen_uv.c $(UVLDIR)/uvmap_ibeibe.c \
156*5552b385SBrandon             $(UVLDIR)/uvmap_ibfibf.c $(UVLDIR)/uvmap_ibfin.c $(UVLDIR)/uvmap_iccibe.c \
157*5552b385SBrandon             $(UVLDIR)/uvmap_iccin.c $(UVLDIR)/uvmap_idibe.c $(UVLDIR)/uvmap_inibe.c \
158*5552b385SBrandon             $(UVLDIR)/uvmap_inl_uv_bnd.c $(UVLDIR)/uvmap_malloc.c $(UVLDIR)/uvmap_mben_disc.c \
159*5552b385SBrandon             $(UVLDIR)/uvmap_message.c $(UVLDIR)/uvmap_norm_uv.c $(UVLDIR)/uvmap_read.c \
160*5552b385SBrandon             $(UVLDIR)/uvmap_solve.c $(UVLDIR)/uvmap_struct_tasks.c $(UVLDIR)/uvmap_to_egads.c \
161*5552b385SBrandon             $(UVLDIR)/uvmap_test.c $(UVLDIR)/uvmap_version.c $(UVLDIR)/uvmap_write.c \
162*5552b385SBrandon             $(UTLDIR)/egadsHOtess.c $(UTLDIR)/egadsUVmap.c \
163*5552b385SBrandon             $(UTLDIR)/extractTess.c $(UTLDIR)/limitTessBody.c $(UTLDIR)/retessFaces.c \
164*5552b385SBrandon             $(UTLDIR)/ThreadTest.c $(UTLDIR)/triServer.c $(UTLDIR)/vHOtess.c
165*5552b385SBrandonLIBSRC.cpp = $(UTLDIR)/evaluate.cpp $(UTLDIR)/rational.cpp $(SRCDIR)/BRepLib_FuseEdges.cpp \
166*5552b385SBrandon             $(UTLDIR)/SurrealD1_btest.cpp $(UTLDIR)/SurrealD4_btest.cpp $(UTLDIR)/SurrealS1_btest.cpp \
167*5552b385SBrandon             $(UTLDIR)/SurrealS4_btest.cpp $(SRCDIR)/egadsCopy.cpp $(SRCDIR)/egadsGeom.cpp \
168*5552b385SBrandon             $(SRCDIR)/egadsHLevel.cpp $(SRCDIR)/egadsIO.cpp $(SRCDIR)/egadsSkinning.cpp \
169*5552b385SBrandon             $(SRCDIR)/egadsSpline.cpp $(SRCDIR)/egadsSplineFit.cpp $(SRCDIR)/egadsTessSens.cpp \
170*5552b385SBrandon             $(SRCDIR)/egadsTopo.cpp
1710f2d2bceSMatthew G. KnepleyLIBSRC.o   = $(LIBSRC.c:%.c=%.o) $(LIBSRC.cpp:%.cpp=%.o)
1720f2d2bceSMatthew G. Knepley
1730f2d2bceSMatthew G. Knepleylib : $(LIBNAME) ;
1740f2d2bceSMatthew G. Knepley
1750f2d2bceSMatthew G. Knepley$(LIBSRC.o) : $(LIBSRC.h)
1760f2d2bceSMatthew G. Knepley
1770f2d2bceSMatthew G. Knepleydefine ARCHIVE_RECIPE_WIN32FE_LIB
1780f2d2bceSMatthew G. Knepley  @$(RM) $@ $@.args
1790f2d2bceSMatthew G. Knepley  @cygpath -w $^ > $@.args
1800f2d2bceSMatthew G. Knepley  $(AR) $(AR_FLAGS) $@ @$@.args
1810f2d2bceSMatthew G. Knepley  @$(RM) $@.args
1820f2d2bceSMatthew G. Knepleyendef
1830f2d2bceSMatthew G. Knepley
1840f2d2bceSMatthew G. Knepleydefine ARCHIVE_RECIPE_DEFAULT
1850f2d2bceSMatthew G. Knepley  @$(RM) $@
1860f2d2bceSMatthew G. Knepley  $(AR) $(AR_FLAGS) $@ $^
1870f2d2bceSMatthew G. Knepley  $(RANLIB) $@
1880f2d2bceSMatthew G. Knepleyendef
1890f2d2bceSMatthew G. Knepley
1900f2d2bceSMatthew G. Knepley$(LIBNAME) : $(LIBSRC.o)
1910f2d2bceSMatthew G. Knepley	$(if $(findstring win32fe lib,$(AR)),$(ARCHIVE_RECIPE_WIN32FE_LIB),$(ARCHIVE_RECIPE_DEFAULT))
1920f2d2bceSMatthew G. Knepley
1930f2d2bceSMatthew G. KnepleyCOMPILE.c   = $(CC)  $(CC_FLAGS)  $(FLAGS)    $(CPPFLAGS)    $(EGADSFLAGS) $(TARGET_ARCH) -c
1940f2d2bceSMatthew G. KnepleyCOMPILE.cpp = $(CXX) $(CXX_FLAGS) $(CXXFLAGS) $(CXXCPPFLAGS) $(EGADSFLAGS) $(TARGET_ARCH) -c
195a8ededdfSMatthew G. Knepley
196a8ededdfSMatthew G. Knepley# This is unusual; usually prefix would default to /usr/local
197a8ededdfSMatthew G. Knepleyprefix ?= $(PETSC_DIR)/$(PETSC_ARCH)
198a8ededdfSMatthew G. Knepleylibdir = $(prefix)/lib
199a8ededdfSMatthew G. Knepleyincludedir = $(prefix)/include
200a8ededdfSMatthew G. KnepleyINSTALL = install
201a8ededdfSMatthew G. KnepleyINSTALL_DATA = $(INSTALL) -m644
202a8ededdfSMatthew G. KnepleyMKDIR_P = mkdir -p
203a8ededdfSMatthew G. Knepley
204a8ededdfSMatthew G. Knepleyinstall-egads: $(LIBNAME)
205a8ededdfSMatthew G. Knepley	$(MKDIR_P) "$(DESTDIR)$(includedir)" "$(DESTDIR)$(libdir)"
206a8ededdfSMatthew G. Knepley	$(INSTALL_DATA) $(LIBSRC.h) "$(DESTDIR)$(includedir)/"
207a8ededdfSMatthew G. Knepley	$(INSTALL_DATA) $(LIBNAME) "$(DESTDIR)$(libdir)/"
208a8ededdfSMatthew G. Knepley
209a8ededdfSMatthew G. Knepleyclean:
210a8ededdfSMatthew G. Knepley	$(RM) $(LIBNAME) $(LIBSRC.o)
211a8ededdfSMatthew G. Knepley
212a8ededdfSMatthew G. Knepley.PHONY: lib clean install-egads
213a8ededdfSMatthew G. Knepley    ''')
214a8ededdfSMatthew G. Knepley    g.close()
215a8ededdfSMatthew G. Knepley    return
216a8ededdfSMatthew G. Knepley
217a8ededdfSMatthew G. Knepley  # the install is delayed until postProcess() since egads install requires PETSc to have created its build/makefiles before installing
218a8ededdfSMatthew G. Knepley  # note that egads can (and is) built before PETSc is built.
219a8ededdfSMatthew G. Knepley  def Install(self):
2200f2d2bceSMatthew G. Knepley    self.createEGADSMakefile()
2210f2d2bceSMatthew G. Knepley    self.createEGADSLiteMakefile()
222a8ededdfSMatthew G. Knepley    return self.installDir
223a8ededdfSMatthew G. Knepley
224a8ededdfSMatthew G. Knepley  def configureLibrary(self):
225a8ededdfSMatthew G. Knepley    ''' Since egads cannot be built until after PETSc configure is complete we need to just assume the downloaded library will work'''
226a8ededdfSMatthew G. Knepley    if 'with-egads' in self.framework.clArgDB:
227a8ededdfSMatthew G. Knepley      raise RuntimeError('egads does not support --with-egads; only --download-egads')
228a8ededdfSMatthew G. Knepley    if 'with-egads-dir' in self.framework.clArgDB:
229a8ededdfSMatthew G. Knepley      self.egadsDir = self.framework.argDB['with-egads-dir']
230a8ededdfSMatthew G. Knepley    if 'with-egads-shared' in self.framework.clArgDB:
231a8ededdfSMatthew G. Knepley      raise RuntimeError('egads does not support --with-egads-shared')
232a8ededdfSMatthew G. Knepley
2330f2d2bceSMatthew G. Knepley    self.hasegads = self.framework.argDB['egads-full']
2340f2d2bceSMatthew G. Knepley    if self.hasegads and not self.oce.found:
2350f2d2bceSMatthew G. Knepley      raise RuntimeError('egads requires open cascade if doing a full install\nReconfigure using --download-opencascade')
2360f2d2bceSMatthew G. Knepley
237a8ededdfSMatthew G. Knepley    if not hasattr(self,'egadsDir'):
238a8ededdfSMatthew G. Knepley      self.checkDownload()
239a8ededdfSMatthew G. Knepley      self.egadsDir = self.installDir
240a8ededdfSMatthew G. Knepley    self.include = [os.path.join(self.egadsDir,'include')]
2410f2d2bceSMatthew G. Knepley    self.lib     = []
2420f2d2bceSMatthew G. Knepley    if self.hasegadslite: self.lib.append(os.path.join(self.egadsDir,'lib','libegadslite.a'))
2430f2d2bceSMatthew G. Knepley    if self.hasegads:     self.lib.append(os.path.join(self.egadsDir,'lib','libegads.a'))
244a8ededdfSMatthew G. Knepley    self.found   = 1
245a8ededdfSMatthew G. Knepley    self.dlib    = self.lib
246a8ededdfSMatthew G. Knepley    if not hasattr(self.framework, 'packages'):
247a8ededdfSMatthew G. Knepley      self.framework.packages = []
248a8ededdfSMatthew G. Knepley    self.framework.packages.append(self)
249a8ededdfSMatthew G. Knepley
2500f2d2bceSMatthew G. Knepley  def buildEGADS(self):
251a8ededdfSMatthew G. Knepley    self.logPrintBox('Compiling egads; this may take several minutes')
252a8ededdfSMatthew G. Knepley    # uses the regular PETSc library builder and then moves result
253a8ededdfSMatthew G. Knepley    # turn off any compiler optimizations as they may break egads
254d61f1f11SSatish Balay    self.pushLanguage('C')
255d61f1f11SSatish Balay    cflags = self.checkNoOptFlag()+' '+self.getSharedFlag(self.getCompilerFlags())+' '+self.getPointerSizeFlag(self.getCompilerFlags())+'  '+self.getWindowsNonOptFlags(self.getCompilerFlags())+' '+self.getDebugFlags(self.getCompilerFlags())
256d61f1f11SSatish Balay    self.popLanguage()
257a8ededdfSMatthew G. Knepley    output,err,ret  = config.package.GNUPackage.executeShellCommand(self.make.make+' -f make.inc PETSC_DIR=' + self.petscdir.dir + ' clean lib PCC_FLAGS="' + cflags + '"', timeout=1000, log = self.log, cwd=self.packageDir)
258a8ededdfSMatthew G. Knepley    self.log.write(output+err)
259a8ededdfSMatthew G. Knepley    self.logPrintBox('Installing egads; this may take several minutes')
260f3c5548cSSatish Balay    output,err,ret  = config.package.GNUPackage.executeShellCommand(self.make.make+' -f make.inc PETSC_DIR='+self.petscdir.dir+' prefix='+self.installDir+' install-egads',timeout=1000, log = self.log, cwd=self.packageDir)
261a8ededdfSMatthew G. Knepley    self.log.write(output+err)
2620f2d2bceSMatthew G. Knepley    return
2630f2d2bceSMatthew G. Knepley
2640f2d2bceSMatthew G. Knepley  def buildEGADSLite(self):
2650f2d2bceSMatthew G. Knepley    self.logPrintBox('Compiling egads lite; this may take several minutes')
2660f2d2bceSMatthew G. Knepley    # uses the regular PETSc library builder and then moves result
2670f2d2bceSMatthew G. Knepley    # turn off any compiler optimizations as they may break egads
2680f2d2bceSMatthew G. Knepley    self.pushLanguage('C')
2690f2d2bceSMatthew G. Knepley    cflags = self.checkNoOptFlag()+' '+self.getSharedFlag(self.getCompilerFlags())+' '+self.getPointerSizeFlag(self.getCompilerFlags())+'  '+self.getWindowsNonOptFlags(self.getCompilerFlags())+' '+self.getDebugFlags(self.getCompilerFlags())
2700f2d2bceSMatthew G. Knepley    self.popLanguage()
2710f2d2bceSMatthew G. Knepley    output,err,ret  = config.package.GNUPackage.executeShellCommand(self.make.make+' -f make_lite.inc PETSC_DIR=' + self.petscdir.dir + ' clean lib PCC_FLAGS="' + cflags + '"', timeout=1000, log = self.log, cwd=self.packageDir)
2720f2d2bceSMatthew G. Knepley    self.log.write(output+err)
2730f2d2bceSMatthew G. Knepley    self.logPrintBox('Installing egads lite; this may take several minutes')
274f3c5548cSSatish Balay    output,err,ret  = config.package.GNUPackage.executeShellCommand(self.make.make+' -f make_lite.inc PETSC_DIR='+self.petscdir.dir+' prefix='+self.installDir+' install-egads',timeout=1000, log = self.log, cwd=self.packageDir)
2750f2d2bceSMatthew G. Knepley    self.log.write(output+err)
2760f2d2bceSMatthew G. Knepley    return
2770f2d2bceSMatthew G. Knepley
2780f2d2bceSMatthew G. Knepley  def postProcess(self):
2790f2d2bceSMatthew G. Knepley    if not hasattr(self,'installDir'):
2800f2d2bceSMatthew G. Knepley      return
2810f2d2bceSMatthew G. Knepley    try:
2820f2d2bceSMatthew G. Knepley      self.buildEGADSLite()
2830f2d2bceSMatthew G. Knepley    except RuntimeError as e:
2840f2d2bceSMatthew G. Knepley      raise RuntimeError('Error running make on egads lite: '+str(e))
2850f2d2bceSMatthew G. Knepley    try:
2860f2d2bceSMatthew G. Knepley      self.buildEGADS()
287a8ededdfSMatthew G. Knepley    except RuntimeError as e:
288a8ededdfSMatthew G. Knepley      raise RuntimeError('Error running make on egads: '+str(e))
289