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
|
# Shave and a Haircut
# (c) 2019 Epic Games
# US Patent 6720962
include ../config-osx.mak
ifndef SHAVE_VRAY_SDKS
$(error "SHAVE_VRAY_SDKS is not defined")
endif
ifndef VRAY_VERSION
$(error "VRAY_VERSION is not defined")
endif
####################################################################
#
# OSX Version
#
####################################################################
osVersion := $(shell ../utils/getos.sh)
ifeq ($(findstring osx,$(osVersion)),)
$(error This Makefile is only for use on OSX)
endif
osVersion := $(subst osx,,$(osVersion))
osVersionMajor := $(word 1,$(subst ., ,$(osVersion)))
osVersionMinor := $(word 2,$(subst ., ,$(osVersion)))
osVersion := $(osVersionMajor).$(osVersionMinor)
####################################################################
#
# Maya Version & Location
#
####################################################################
versionInfo := $(shell ../utils/getMayaAPIVersion.sh)
mayaAPI := $(word 1,$(versionInfo))
mayaVersion := $(word 2,$(versionInfo))
mayaMajorVersion := $(word 3, $(versionInfo))
mayaMinorVersion := $(word 4, $(versionInfo))
# Maya requires OSX 10.4 or better.
ifeq ($(osVersionMajor),10)
ifeq ($(filter-out 0 1 2 3,$(osVersionMinor)),)
$(error Maya $(mayaVersion) requires OSX 10.4 or better)
endif
endif
####################################################################
#
# Compiler & Linker
#
####################################################################
mayaShared = /Users/Shared/Autodesk/maya/$(mayaVersion)
mayaIncludeDir = $(MAYA_LOCATION)/include
CFLAGS += -DCC_GNU_ -DOSMac_ -DOSMacOSX_ \
-DOSMac_MachO_ -fno-gnu-keywords -fpascal-strings \
-DVRAY_DUAL -DVRAY_EXPORTS
C++FLAGS += $(CFLAGS) $(WARNFLAGS) $(ERROR_FLAGS) \
-D_LANGUAGE_C_PLUS_PLUS -DREQUIRE_IOSTREAM
ifeq ($(shell echo '$(mayaMajorVersion) < 2017' | bc),1)
C++FLAGS += -Dnullptr=0
endif
INCLUDES = -I. -I../libexe/sample/include -I"$(mayaIncludeDir)"
####################### Vray stuff #################################
# vlad |23Apr2010
#
# 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
ifeq ($(vrayTag),36)
C++FLAGS += -DVRAY30 -Wno-c++11-extensions
else
C++FLAGS += -DVRAY40 -arch x86_64 -std=c++11
endif
INCLUDES += -I$(SHAVE_VRAY_SDKS)/$(VRAY_VERSION)/include
LIBS += -stdlib=libstdc++ -L$(SHAVE_VRAY_SDKS)/$(VRAY_VERSION)/lib/osx -lplugman_s -lvutils_s -lvray
####################################################################
DYNLIB_LOCATION = $(MAYA_LOCATION)/Maya.app/Contents/MacOS
LDFLAGS = -dynamiclib -single_module -fno-gnu-keywords -fpascal-strings \
-multiply_defined suppress -dead_strip
LIBS += -L$(DYNLIB_LOCATION) -lFoundation -lOpenMaya
####################################################################
#
# Generic Build Rules
#
####################################################################
.SUFFIXES: .c .cpp .o .io .po .xo
.c.o:
$(error Attempt to build $< into a .o file: should be .io or .po or .xo)
.cpp.o:
$(error Attempt to build $< into a .o file: should be .io or .po or .xo)
.cpp.xo:
$(C++) -c -o $@ $(X86_64_INCLUDES) $(X86_64_C++FLAGS) $<
####################################################################
#
# Specific Build Rules
#
####################################################################
OBJFILE := shaveVray$(vrayTag)Exporter.o
TARGET := libShaveVray$(vrayTag)Exporter.so
all: $(TARGET)
$(TARGET): $(OBJFILE)
-rm -f $@
$(LD) -o $@ $(LDFLAGS) $(OBJFILE) $(LIBS)
$(OBJFILE): shaveVrayExporterImpl.cpp
$(C++) -c $(INCLUDES) $(C++FLAGS) -o $(OBJFILE) $<
####################################################################
#
# Cleanup
#
####################################################################
.PHONY: clean
clean:
-rm -f $(OBJFILE)
.PHONY: Clean
Clean: clean
-rm -f $(TARGET)
|