-
Notifications
You must be signed in to change notification settings - Fork 118
/
premake.lua
171 lines (153 loc) · 4.16 KB
/
premake.lua
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
170
171
-- TODO: Because there are a few remaining things ...
-- 1. x86/x64 switching
-- 2. clean this file up because I'm sure it could be organized better
-- 3. consider maybe switching to CMake because of the ugly hack below
--
-- NOTE: I am intentionally leaving out a "windows+gmake" configuration
-- as trying to compile against the FBX SDK using MinGW results in
-- compile errors. Some quick googling seems to indicate MinGW is
-- not supported by the FBX SDK?
-- If you try to use this script to build with MinGW you will end
-- up with a Makefile that has god knows what in it
FBX_SDK_ROOT = os.getenv("FBX_SDK_ROOT")
if not FBX_SDK_ROOT then
printf("ERROR: Environment variable FBX_SDK_ROOT is not set.")
printf("Set it to something like: C:\\Program Files\\Autodesk\\FBX\\FBX SDK\\2016.1")
os.exit()
end
BUILD_NUMBER = os.getenv("BUILD_NUMBER")
if not BUILD_NUMBER then
BUILD_NUMBER = 0
end
-- avert your eyes children!
if string.find(_ACTION, "xcode") then
-- TODO: i'm sure we could do some string search+replace trickery to make
-- this more general-purpose
-- take care of the most common case where the FBX SDK is installed to the
-- default location and part of the path contains a space
-- god help you if you install the FBX SDK using a totally different path
-- that contains a space AND you want to use Xcode
-- Premake + Xcode combined fuck this up so badly making it nigh-impossible
-- to do any kind of _proper_ path escaping here (I wasted an hour on this)
-- (maybe I should have used CMake ....)
FBX_SDK_ROOT = string.gsub(FBX_SDK_ROOT, "FBX SDK", "'FBX SDK'")
end
-- ok, you can look again
BUILD_DIR = "build"
if _ACTION == "clean" then
os.rmdir(BUILD_DIR)
end
solution "fbx-conv"
configurations { "Debug", "Release" }
location (BUILD_DIR .. "/" .. _ACTION)
project "fbx-conv"
--- GENERAL STUFF FOR ALL PLATFORMS --------------------------------
kind "ConsoleApp"
language "C++"
location (BUILD_DIR .. "/" .. _ACTION)
files {
"./src/**.c*",
"./src/**.h",
}
includedirs {
(FBX_SDK_ROOT .. "/include"),
"./libs/libpng/include",
"./libs/zlib/include",
}
defines {
"FBXSDK_NEW_API",
"BUILD_NUMBER=" .. BUILD_NUMBER,
}
--- debugdir "."
configuration "Debug"
defines {
"DEBUG",
}
flags { "Symbols" }
configuration "Release"
defines {
"NDEBUG",
}
flags { "Optimize" }
--- VISUAL STUDIO --------------------------------------------------
configuration "vs*"
flags {
"NoPCH",
"NoMinimalRebuild"
}
buildoptions { "/MP" }
defines {
"_CRT_SECURE_NO_WARNINGS",
"_CRT_NONSTDC_NO_WARNINGS"
}
includedirs {
(FBX_SDK_ROOT .. "/include/"),
}
libdirs {
"./libs/libpng/lib/windows/x86",
"./libs/zlib/lib/windows/x86",
}
links {
"libpng14",
"zlib",
"libfbxsdk-md",
}
configuration { "vs*", "Debug" }
libdirs {
(FBX_SDK_ROOT .. "/lib/vs2015/x86/debug"),
}
configuration { "vs*", "Release" }
libdirs {
(FBX_SDK_ROOT .. "/lib/vs2015/x86/release"),
}
--- LINUX ----------------------------------------------------------
configuration { "linux" }
kind "ConsoleApp"
buildoptions { "-Wall" }
-- TODO: while using x64 will likely be fine for most people nowadays,
-- we still need to make this configurable
libdirs {
"./libs/libpng/lib/linux/x64",
"./libs/zlib/lib/linux/x64",
}
links {
"png",
"z",
"pthread",
"fbxsdk",
"dl",
}
configuration { "linux", "Debug" }
libdirs {
(FBX_SDK_ROOT .. "/lib/gcc4/x64/debug"),
}
configuration { "linux", "Release" }
libdirs {
(FBX_SDK_ROOT .. "/lib/gcc4/x64/release"),
}
--- MAC ------------------------------------------------------------
configuration { "macosx" }
kind "ConsoleApp"
buildoptions { "-Wall" }
xcodebuildsettings {
["ALWAYS_SEARCH_USER_PATHS"] = "YES"
}
libdirs {
(FBX_SDK_ROOT .. "/lib/clang"),
"./libs/libpng/lib/macosx",
"./libs/zlib/lib/macosx",
}
links {
"png",
"z",
"CoreFoundation.framework",
"fbxsdk",
}
configuration { "macosx", "Debug" }
libdirs {
(FBX_SDK_ROOT .. "/lib/clang/debug"),
}
configuration { "macosx", "Release" }
libdirs {
(FBX_SDK_ROOT .. "/lib/clang/release"),
}