-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpremake5.lua
198 lines (165 loc) · 6.42 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
-- premake5.lua
local install_prefix = "/usr/local"
--local pkgconfig = require 'pkgconfig'
--print(pkgconfig.load('zlib'))
--print(pkgconfig.load('glib-2.0'))
local autoconf = require 'autoconf'
local tools = require 'tools'
local PROTO_PATH = "."
local PROTO_CC_PATH = "."
autoconfigure {
['config.h'] = function (cfg)
check_include(cfg, 'HAVE_PTHREAD_H', 'pthread.h')
end
}
local PROTOC_BIN = tools.check_bin ( 'protoc' )
local OPP_MSGC_BIN = tools.check_bin ( 'opp_msgc' )
local INSTALL_BIN = tools.check_bin ( 'install' )
local MKDIR_BIN = tools.check_bin ( 'mkdir' )
workspace "omnetpp-federate"
configurations { "Debug", "Release" }
language "C++"
targetdir "bin/%{cfg.buildcfg}"
newoption {
trigger = "generate-opp-messages",
description = "Generate/Regenerate opp messages with opp message compiler"
}
newoption {
trigger = "generate-protobuf",
description = "Generate/Regenerate protocol buffers with protobuf compiler"
}
newoption {
trigger = "install",
description = "install target into '" .. install_prefix .. "'"
}
-- -------------------------------------
-- target: lib/libomnetpp-federate.so --
-- -------------------------------------
project "omnetpp-federate-LIBRARY"
targetname "omnetpp-federate"
kind "SharedLib"
files { "src/node/*.h"
, "src/node/*.cc"
, "src/msg/MosaicAppPacket_m.h"
, "src/msg/MosaicAppPacket_m.cc"
, "src/msg/MosaicCommunicationCmd_m.h"
, "src/msg/MosaicCommunicationCmd_m.cc"
, "src/msg/MosaicConfigurationCmd_m.h"
, "src/msg/MosaicConfigurationCmd_m.cc"
, "src/msg/MosaicMobilityCmd_m.h"
, "src/msg/MosaicMobilityCmd_m.cc"
, "src/mgmt/*.h"
, "src/mgmt/*.cc"
, PROTO_CC_PATH .. "/ClientServerChannel.h"
, PROTO_CC_PATH .. "/ClientServerChannel.cc"
, "src/util/Log.h"
, "src/util/Log.cc"
, PROTO_CC_PATH .. "/ClientServerChannelMessages.pb.h"
, PROTO_CC_PATH .. "/ClientServerChannelMessages.pb.cc"
}
includedirs { "/usr/include"
, "src"
, "src/mgmt"
, "src/msg"
, "src/node"
, "src/util"
, PROTO_CC_PATH
}
libdirs { "/usr/lib" }
buildoptions { "-std=c++11" }
links { "protobuf" }
filter "configurations:Debug"
defines { "DEBUG" }
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
configuration "generate-opp-messages"
prebuildcommands { OPP_MSGC_BIN .. " --msg6 -I /usr/lib" .. " src/msg/MosaicCommunicationCmd.msg"
, OPP_MSGC_BIN .. " --msg6 -I /usr/lib" .. " src/msg/MosaicConfigurationCmd.msg"
, OPP_MSGC_BIN .. " --msg6 -I /usr/lib" .. " src/msg/MosaicMobilityCmd.msg"
, OPP_MSGC_BIN .. " --msg6 -I /usr/lib" .. " src/msg/MosaicAppPacket.msg"
}
configuration "generate-protobuf"
prebuildcommands { PROTOC_BIN .. " --cpp_out=" .. PROTO_CC_PATH
.. " --proto_path=" .. PROTO_PATH
.." ClientServerChannelMessages.proto"
}
configuration "install"
postbuildcommands { MKDIR_BIN .. " -p " .. install_prefix .. "/lib"
, INSTALL_BIN .. " bin/%{cfg.buildcfg}/libomnetpp-federate.so " .. install_prefix .. "/lib" --strip
, MKDIR_BIN .. " -p " .. install_prefix .. "/share/ned/omnetpp_federate"
, "cp ./src/package.ned " .. install_prefix .. "/share/ned/omnetpp_federate"
, MKDIR_BIN .. " -p " .. install_prefix .. "/share/ned/omnetpp_federate/mgmt"
, "cp ./src/mgmt/MosaicScenarioManager.ned " .. install_prefix .. "/share/ned/omnetpp_federate/mgmt"
, "cp ./src/mgmt/Simulation.ned " .. install_prefix .. "/share/ned/omnetpp_federate/mgmt"
, MKDIR_BIN .. " -p " .. install_prefix .. "/share/ned/omnetpp_federate/node"
, "cp ./src/node/Rsu.ned " .. install_prefix .. "/share/ned/omnetpp_federate/node"
, "cp ./src/node/Vehicle.ned " .. install_prefix .. "/share/ned/omnetpp_federate/node"
, "cp ./src/node/MosaicProxyApp.ned " .. install_prefix .. "/share/ned/omnetpp_federate/node"
, "cp ./src/node/MosaicMobility.ned " .. install_prefix .. "/share/ned/omnetpp_federate/node"
}
configuration "Debug"
libdirs { "bin/Debug" }
configuration "Release"
libdirs { "bin/Release" }
-- -------------------------------
-- target: bin/omnetpp-federate --
-- -------------------------------
project "omnetpp-federate-BINARY"
targetname "omnetpp-federate"
kind "ConsoleApp"
files {"src/omnetpp-federate/**.h"}
buildoptions { "-std=c++17" }
linkoptions { "-Wl,--no-as-needed,-rpath,'$$ORIGIN/lib',-rpath,'$$ORIGIN/../lib'" }
includedirs { "/usr/include"
, "src"
, "src/mgmt"
, "src/msg"
, "src/node"
, "src/util"
}
filter "configurations:Debug"
defines { "DEBUG" }
links { "INET_dbg"
, "omnetpp-federate-LIBRARY"
-- , "oppsim_dbg"
-- , "oppscave_dbg"
-- , "oppnedxml_dbg"
, "oppmain_dbg"
-- , "oppeventlog_dbg"
, "oppenvir_dbg"
, "dl"
-- , "oppcommon_dbg"
, "oppcmdenv_dbg"
}
symbols "On"
filter "configurations:Release"
defines { "NDEBUG" }
links { "INET"
, "omnetpp-federate-LIBRARY"
-- , "oppsim"
-- , "oppscave"
-- , "oppnedxml"
, "oppmain"
-- , "oppeventlog"
, "oppenvir"
, "dl"
-- , "oppcommon"
, "oppcmdenv"
}
optimize "On"
configuration "install"
postbuildcommands { MKDIR_BIN .. " -p " .. install_prefix .. "/bin"
, INSTALL_BIN .. " bin/%{cfg.buildcfg}/omnetpp-federate " .. install_prefix .. "/bin" --strip
}
configuration "Debug"
libdirs { "bin/Debug", "/usr/lib" }
configuration "Release"
libdirs { "bin/Release", "/usr/lib" }
if _ACTION == "clean" then
os.rmdir("bin")
os.rmdir("obj")
os.rmdir("omnetpp-federate-BINARY.make");
os.rmdir("omnetpp-federate-LIBRARY.make");
end