-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathpremake5.lua
153 lines (121 loc) · 4.77 KB
/
premake5.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
--[[
node9 build configuration: the output of premake5 on this is a
multiplatform Makefile
When you invoke 'premake gmake' you just tell premake to build a makefile for gmake.
If you have gmake on Windows, MacOS and Linux, you can use premake gmake for all
platforms. It's when you actually build that you just need to specify your configuration
and platform, ie: "gmake config=<config_type>_<platform type>"
(on gcc-native systems like Linux and NetBSD, gmake is just 'make')
]]--
-- get a stable build OS type
-- "server" can change
-- "platform" is the user selected target type
local syshost = "unknown"
local ver = os.getversion()
local hosttype = ver.description
if hosttype:sub(1,5) == "Linux" then
syshost = "Linux"
elseif hosttype:sub(1,8) == "Mac OS X" then
syshost = "MacOSX"
elseif hosttype:sub(1,7) == "Windows" then
syshost = "Nt"
else
syshost = hosttype
end
defines ({"SYSHOST=" .. syshost})
print(">>> Building Node9 solutions on host OS '" .. syshost .. "' <<<")
solution "node9-hosted"
language "C"
-- deployment configurations
configurations { "debug", "devel", "release"}
-- supported platforms (all 64 bit)
platforms {
"linux",
"macosx",
"freebsd",
"netbsd",
"openbsd",
"dragonfly",
"solaris",
"windows",
"android"
}
-- GLOBAL BUILD CONFIG SETTINGS --
filter "configurations:Debug"
flags { "Symbols" }
filter {}
-- GLOBAL PLATFORM INDEPENDENT DEFINES --
-- default global cpu types. can be overridden by platform architecture
-- OBJTYPE is just for low-level 9lib
defines {"OBJTYPE=\"386\""}
-- only for windows right now
architecture "x86_64"
-- GLOBAL SOURCE AND TARGET OBJECT LOCATIONS --
objdir("src/build/obj")
libdirs("luajit/src") -- the luajit libraries
libdirs("libuv/.libs") -- the libuv libraries
libdirs("src/build") -- location of the statics that we build
targetdir("src/build")
-- GLOBAL INCLUDE SOURCES --
includedirs {
"libuv/src",
"libuv/include",
"luajit/src",
"src/styx/hosting/libuv/include",
"src/styx/include",
"fs/module"
}
-- GLOBAL PLATFORM SPECIFIC SETTINGS --
-- TARGET BUILDS
-- also specifies target stable build toolchain
-- (platform-specific include dirs might not be needed)
filter "platforms:linux"
defines {"SYSTARG=Linux"}
system "linux"
toolset "gcc" -- not really necessary
includedirs { "src/styx/platform/Linux/include" }
filter { "platforms:windows" }
defines { "SYSTARG=Nt" }
system "windows"
-- by default set toolset to msc.
-- set to gcc/mingw when cross compiling
toolset "msc"
includedirs { "src/styx/platform/Nt/include" }
filter { "platforms:freebsd" }
defines { "SYSTARG=FreeBSD" }
system "bsd" -- does this work for clang vs gcc targets chains?
-- important because luajit, libuv often choose conflicting compilers here
toolset "gcc"
includedirs { "src/styx/platform/FreeBSD/include" }
filter { "platforms:netbsd" }
defines { "SYSTARG=NetBSD" }
system "bsd" -- does this work for clang vs gcc targets chains?
toolset "gcc" -- at least gcc 2.9.5 (last portable version)
includedirs { "src/styx/platform/NetBSD/include" }
filter { "platforms:openbsd" }
defines { "SYSTARG=OpenBSD" }
system "bsd" -- does this work for clang vs gcc targets chains?
toolset "gcc" -- probably at least gcc 4.2.1
includedirs { "src/styx/platform/OpenBSD/include" }
filter { "platforms:dragonfly" }
defines { "SYSTARG=DragonFly" }
system "bsd" -- does this work for clang vs gcc targets chains?
toolset "gcc" -- probably gcc 5 or later
includedirs { "src/styx/platform/Dragonfly/include" }
filter "platforms:macosx"
defines { "SYSTARG=MacOSX"}
system "macosx"
-- but were taking default because luajit, libuv and we all map to clang
--toolset "clang"
includedirs { "src/styx/platform/MacOSX/include" }
-- reset filtering --
filter {}
-- PROJECTS --
-- inferno libs --
include "src/styx/libs/lib9" -- protocol/conversion/formatting
include "src/styx/libs/libbio" -- low-level i/o and rune support
include "src/styx/libs/libsec" -- crypto support
-- utilities --
include "src/styx/utils"
-- the node9 kernel --
include "src"