build_visitmodule.py 3.62 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
###############################################################################
# Program: build_visitmodule.py
#
# Purpose: This program builds the VisIt Python module.
#
# Programmer: Brad Whitlock
# Creation: Wed Nov 22 12:41:39 PDT 2006
#
# Note: The "visitmodule" module is a self-contained (no library dependencies)
#       module that includes code for the other VisIt libraries on which it
#       would normally depend (comm, state, misc, plugins, ...). We use another
#       lightweight "visit" module to import into Python and that module
#       dynamically loads this module. This does give us the flexibility to
#       let us have a "visit" module that should not change much and allows us
#       to dynamically select at runtime which VisIt Python interface should
#       be loaded.
#
# Modifications:
hrchilds's avatar
hrchilds committed
19 20
#   Brad Whitlock, Wed Mar 14 11:55:31 PDT 2007
#   Modified for new source layout.
hrchilds's avatar
hrchilds committed
21
#
22 23 24
#   Hank Childs, Mon Feb 11 17:13:30 PST 2008
#   Renamed components directory to be avt.
#
25 26 27
#   Brad Whitlock, Wed Jun 25 13:39:45 PST 2008
#   Remove proxyexample from the build.
#
28 29 30 31
#   Cyrus Harrison, Thu Aug 27 08:09:38 PDT 2009
#   "common/Exceptions/VisWindow" no longer exists, removed it from the python
#   module build.
#
32 33 34 35 36
#   Brad Whitlock, Mon Dec 13 11:02:58 PST 2010
#   I changed the build so it works again. Unfortunately, it won't work with
#   plugins anymore since we link plugins against dependent libs now. This
#   module was always kind of a hack anyway.
#
hrchilds's avatar
hrchilds committed
37
###############################################################################
38

hrchilds's avatar
hrchilds committed
39
from distutils.core import setup, Extension
hrchilds's avatar
hrchilds committed
40
import os, string
hrchilds's avatar
hrchilds committed
41 42 43 44 45 46 47

def GetCXXFilesInDirectory(directory):
    import os
    files = os.listdir(directory)
    cxx = []
    for f in files:
       if f[-2:] == ".C":
hrchilds's avatar
hrchilds committed
48
          cxx = cxx + [os.path.realpath(directory + "/" + f)]
hrchilds's avatar
hrchilds committed
49 50 51 52 53 54 55 56 57 58
    return cxx

def RemoveFileFromList(filelist, rm):
    ret = []
    for f in filelist:
        if f != rm:
           ret = ret + [f]
    return ret

# Get all of the VisIt sources that we need to build the VisIt module.
59
srcdirs = ["../../common/comm",
hrchilds's avatar
hrchilds committed
60 61 62 63 64 65 66 67 68
"../../common/state",
"../../common/misc",
"../../common/utility",
"../../common/plugin",
"../../common/Exceptions/Database",
"../../common/Exceptions/Pipeline",
"../../common/Exceptions/Plotter",
"../../common/expr",
"../../common/parser",
69 70
"../../avt/DBAtts/MetaData",
"../../avt/DBAtts/SIL",
hrchilds's avatar
hrchilds committed
71 72 73 74
"../../viewer/rpc",
"../../viewer/proxy",
".",
"../visitpy",
75
"../common"]
hrchilds's avatar
hrchilds committed
76 77 78 79 80
visitmod_sources = []
for d in srcdirs:
   visitmod_sources = visitmod_sources + GetCXXFilesInDirectory(d)

# Remove some of the junk
hrchilds's avatar
hrchilds committed
81 82 83 84 85 86 87 88 89 90 91
rmlist = ("../../common/comm/PipeConnection.C",
"../../common/comm/testcomm.C",
"../../common/comm/test1.C",
"../../common/comm/win32commhelpers.C",
"../../common/expr/test.C",
"../../common/expr/ExprConfig.C",
"../../common/parser/testparser.C",
"../../common/state/TestUtil.C",
"../../common/state/test1.C",
"../../common/state/test2.C",
"../../common/state/test3.C",
92 93
"../../common/state/SimulationCommand.C",
"../../common/utility/MRUCache_test.C",
94 95
"../../common/utility/StringHelpers_test.C",
"../../viewer/proxy/proxyexample.C")
hrchilds's avatar
hrchilds committed
96

hrchilds's avatar
hrchilds committed
97
for rm in rmlist:
hrchilds's avatar
hrchilds committed
98
   visitmod_sources = RemoveFileFromList(visitmod_sources, os.path.realpath(rm))
hrchilds's avatar
hrchilds committed
99 100 101
#print visitmod_sources

# Determine the version
hrchilds's avatar
hrchilds committed
102
f = open("../../VERSION")
hrchilds's avatar
hrchilds committed
103 104 105 106 107 108 109
lines = f.readlines()
f.close()
ver = string.replace(lines[0], "\n", "")

visitmod = Extension("visitmodule",
    language="c++",
    #extra_compile_args="-Wno-deprecated",
110
    include_dirs=srcdirs + ["../../include"],
hrchilds's avatar
hrchilds committed
111 112 113 114 115 116
    sources = visitmod_sources)
setup(name = "visit",
      version = ver,
      description = "This module contains functions to control VisIt.",
      ext_modules = [visitmod])