This repository has been archived by the owner on Apr 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwin32-settings.py
117 lines (96 loc) · 3.29 KB
/
win32-settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import shutil
import re
import os
import globalinfo
srcroot = os.getcwd()
prefix = ''
def init(args):
global prefix
prefix=args.get('prefix',os.getcwd() + os.sep + 'win32pak' )
def get_libpath(args): return prefix
def get_pluginpath(args): return prefix+ os.sep+"plugins"
def get_binpath(args): return prefix
def get_confpath(args): return prefix
def get_cxxflags(args):
debug=args.get('debug',0)
arch=args.get('arch','')
flags = '/DWIN32 /D_WIN32 /D_USE_MATH_DEFINES /EHsc /DHAVE_CONFIG_H'
if debug:
flags+=' /Zi /GS /RTC1 /Yd /MTd'
else:
# flags+=' /Ox /MD /D_STATIC_CPPLIB'
flags+=' /Ogitypb1 /Gs /MD /D_STATIC_CPPLIB'
if arch!='':
flags+=' /'+arch
return flags
class exr(globalinfo.library):
PATH = None
C_ID = 'EXR'
def present(args):
if not zlib.present(args) : return False
exr.PATH = args.get('exr_path',None)
dyn = args.get('dynamic_exr',False)
if exr.PATH is None and dyn : exr.PATH = srcroot + '\\..\\libs\\msvc\\openexr'
if exr.PATH is None and not dyn : exr.PATH = srcroot + '\\..\\libs\\msvc\\openexr_static'
if os.path.exists(exr.PATH + "\\include\\OpenEXR\\half.h"):
return True
else:
return False
def get_include(args): return zlib.get_include(args) + [ exr.PATH + "\\include\\OpenEXR" ]
def get_libpath(args): return zlib.get_libpath(args) + [ exr.PATH + "\\lib" ]
def get_libs(args): return zlib.get_libs(args) + ['IlmImf', 'Imath', 'Iex', 'Half']
class jpeg(globalinfo.library):
PATH = srcroot + "\\..\\libs\\msvc\\jpeg"
C_ID = 'JPEG'
def present(args): return os.path.exists(jpeg.PATH + "\\include\\jpeglib.h")
def get_include(args): return [jpeg.PATH + "\\include"]
def get_libpath(args): return [jpeg.PATH + "\\lib"]
def get_libs(args): return ['libjpeg']
class pthread(globalinfo.library):
C_ID = 'PTHREAD'
PATH = srcroot + "\\..\\libs\\msvc\\pthreads"
def present(args): return os.path.exists(pthread.PATH + "\\include\\pthread.h")
def get_include(args): return [pthread.PATH + "\\include"]
def get_libpath(args): return [pthread.PATH + "\\lib"]
def get_libs(args): return ['pthreadVC']
class zlib(globalinfo.library):
C_ID = 'ZLIB'
PATH = srcroot + "\\..\\libs\\msvc\\zlib"
def present(args): return os.path.exists(zlib.PATH + "\\include\\zlib.h")
def get_include(args): return [zlib.PATH + "\\include"]
def get_libpath(args): return [zlib.PATH + "\\lib"]
def get_libs(args): return ['zlib']
class dynload(globalinfo.library):
C_ID = 'DL'
def present(args): return False
def get_include(args): return []
def get_libpath(args): return []
def get_libs(args): return []
def derive_shared_env(common_env):
return common_env.Copy()
def derive_plugin_env(common_env):
return common_env.Copy()
def derive_program_env(common_env):
return common_env.Copy()
def package_rule(args):
return ('win32installer',makewin32package)
# AUXILIAR
def replaceInFile(remp, name, out):
inf=open(name,'r')
outf=open(out,'w')
line=inf.readline();
while line:
for x in remp:
line=re.sub(x[0],x[1],line)
outf.write(line)
line=inf.readline();
outf.close();
inf.close();
def makewin32package(target,source,env):
print 'building Win32 installer ...'
pak=os.getcwd()+os.sep+'win32pak'
template=pak+os.sep+'yafray_win_iss.tmpl'
result= pak+os.sep+'yafray_win.iss'
if os.path.isfile(result):
os.unlink(result)
replaceInFile([ ['SRCROOT', pak] ], template, result)