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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
|
# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962
####################################################################
#
# Maya/V-Ray Version & Location
#
####################################################################
ifndef MAYA_LOCATION
$(error "MAYA_LOCATION is not defined")
endif
ifeq ($(wildcard $(MAYA_LOCATION)),)
$(error "MAYA_LOCATION contains '$(MAYA_LOCATION)', which does not exist.")
endif
ifndef SHAVE_VRAY_SDKS
$(error "SHAVE_VRAY_SDKS is not defined")
endif
ifndef VRAY_VERSION
$(error "VRAY_VERSION is not defined")
endif
# We use two-digit tags to identify build products which serve a range
# of V-Ray versions.
#
vrayTag := $(shell ../vrayPlug/getVersionTag.sh $(VRAY_VERSION))
ifeq ($(vrayTag),)
$(error "Unrecognized V-Ray version '$(VRAY_VERSION)'.")
endif
versionInfo := $(shell ../utils/getMayaAPIVersion.sh)
mayaAPI := $(word 1,$(versionInfo))
mayaVersion := $(word 2,$(versionInfo))
mayaMajorVersion := $(word 3, $(versionInfo))
mayaMinorVersion := $(word 4, $(versionInfo))
mayaDirVersion := $(word 6, $(versionInfo))
bits := 64
####################################################################
#
# Linux Version
#
####################################################################
osVersion := $(shell ../utils/getos.sh)
ifeq ($(osVersion),)
$(error "Operating system type not recognized. Is /etc/issue present?")
endif
arch := $(shell ../utils/getarch.sh)
####################################################################
#
# Compiler & Linker
#
####################################################################
#
# Some versions of Maya use non-standard versions of gcc, which are
# expected to be installed in /opt (e.g. /opt/gcc322)
#
CFLAGS = -pipe -D_BOOL -DUNIX -DLINUX -DFUNCPROTO -D_GNU_SOURCE \
-DREQUIRE_IOSTREAM -Wall -Wall \
-Wno-deprecated -fno-gnu-keywords
C++ = $(shell ../utils/getg++vray.sh $(mayaVersion) $(vrayTag))
ifeq ($(C++),)
$(error "Maya version $(mayaVersion) not supported.")
endif
CFLAGS += -fPIC -DBits64_ -DLINUX_64 -march=athlon64 -m64 -fpermissive \
-Dnullptr=0
ifdef debug
_DEBUG=1
endif
ifdef DEBUG
_DEBUG=1
endif
ifdef _DEBUG
# It's tempting to add -gstabs+ here to get more C++ specific info, but
# that confuses gdb with the result that it gives 'Cannot access memory'
# errors when you try to print local vars or member vars.
CFLAGS += -D_DEBUG -O0 -g -ggdb -fno-inline
else
CFLAGS += -O3
endif
ifdef _INSECURE
CFLAGS += -D_INSECURE
endif
ifdef _BETA
CFLAGS += -D_BETA
endif
ifdef SHAVE_PROFILE
profile = 1
endif
ifdef profile
CFLAGS += -g
endif
C++FLAGS = $(CFLAGS) $(WARNFLAGS)
ifeq ($(vrayTag),40)
CFLAGS += -std=c++11
else
ifeq ($(shell echo '$(mayaAPI) >= 20180000' | bc),1)
C++FLAGS += -std=c++0x
endif
endif
INCLUDES = -I. -isystem $(MAYA_LOCATION)/include -isystem /usr/X11R6/include
LD = $(C++) -shared $(C++FLAGS)
LIBS = -L$(MAYA_LOCATION)/lib -L/usr/X11R6/lib -lOpenMaya -lOpenMayaFX -lOpenMayaRender -lOpenMayaUI -lOpenMayaAnim -lFoundation -lGLU -lGL -lpthread
####################### Vray stuff #################################
# vlad |23Apr2010
#
INCLUDES += -I$(SHAVE_VRAY_SDKS)/$(VRAY_VERSION)/include
VRAY_LIBS := $(firstword $(wildcard ../vrayPlug/libs/vray$(vrayTag)/linux_x64/*))
LIBS += -L$(SHAVE_VRAY_SDKS)/$(VRAY_VERSION)/lib/linux -l plugman_s -lvutils_s
####################################################################
####################################################################
#
# Specific Build Rules
#
####################################################################
OBJFILE := shaveVray$(vrayTag)Exporter.o
TARGET := vray/libShaveVray$(vrayTag)Exporter.so
all: $(TARGET)
$(TARGET): $(OBJFILE)
-rm -f $@
$(LD) -o $@ $(OBJFILE) \
-Wl,-Bsymbolic -Wl,--allow-shlib-undefined \
$(LIBS)
$(OBJFILE): shaveVrayExporterImpl.cpp
$(C++) -c $(INCLUDES) $(C++FLAGS) -o $(OBJFILE) $<
####################################################################
#
# Cleanup
#
####################################################################
clean:
-rm -f *.o
Clean:
-rm -f *.o *.so *.bak
|