forked from chenshuo/muduo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
POC of using premake to compile muduo: use base, net, and simple_echo…
… as examples
- Loading branch information
Showing
4 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
project "simple_echo" | ||
kind "ConsoleApp" | ||
language "C++" | ||
targetdir(bindir) | ||
links{'net', 'base', 'pthread', 'rt'} | ||
files { | ||
'echo/echo.cc', | ||
'echo/main.cc', | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
project "base" | ||
kind "StaticLib" | ||
language "C++" | ||
links{'pthread', 'rt'} | ||
targetdir(libdir) | ||
targetname('muduo_base') | ||
headersdir('muduo/base') | ||
headers('*.h') | ||
files { | ||
'AsyncLogging.cc', | ||
'Condition.cc', | ||
'CountDownLatch.cc', | ||
'Date.cc', | ||
'Exception.cc', | ||
'FileUtil.cc', | ||
'LogFile.cc', | ||
'Logging.cc', | ||
'LogStream.cc', | ||
'ProcessInfo.cc', | ||
'Timestamp.cc', | ||
'TimeZone.cc', | ||
'Thread.cc', | ||
'ThreadPool.cc', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
project "net" | ||
kind "StaticLib" | ||
language "C++" | ||
links('base') | ||
targetdir(libdir) | ||
targetname('muduo_net') | ||
includedirs('../..') | ||
headersdir('muduo/net') | ||
headers { | ||
'Buffer.h', | ||
'Callbacks.h', | ||
'Channel.h', | ||
'Endian.h', | ||
'EventLoop.h', | ||
'EventLoopThread.h', | ||
'EventLoopThreadPool.h', | ||
'InetAddress.h', | ||
'TcpClient.h', | ||
'TcpConnection.h', | ||
'TcpServer.h', | ||
'TimerId.h', | ||
} | ||
|
||
files { | ||
'Acceptor.cc', | ||
'Buffer.cc', | ||
'Channel.cc', | ||
'Connector.cc', | ||
'EventLoop.cc', | ||
'EventLoopThread.cc', | ||
'EventLoopThreadPool.cc', | ||
'InetAddress.cc', | ||
'Poller.cc', | ||
'poller/DefaultPoller.cc', | ||
'poller/EPollPoller.cc', | ||
'poller/PollPoller.cc', | ||
'Socket.cc', | ||
'SocketsOps.cc', | ||
'TcpClient.cc', | ||
'TcpConnection.cc', | ||
'TcpServer.cc', | ||
'Timer.cc', | ||
'TimerQueue.cc', | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
solution "muduo" | ||
projectdir = basedir() | ||
builddir = path.join(projectdir, '../build') | ||
installdir = path.join(projectdir, '../install') | ||
bindir = path.join(installdir, 'bin') | ||
libdir = path.join(installdir, 'lib') | ||
includedir = path.join(installdir, 'include') | ||
curheadersdir = includedir | ||
|
||
-- set the sub header dir to install files | ||
function headersdir(dir) | ||
curheadersdir = dir | ||
end | ||
|
||
-- install header files | ||
function headers(files) | ||
if type(files) == 'string' then | ||
files = { files } | ||
end | ||
local finalfiles = {} | ||
for _, file in ipairs(files) do | ||
if file:find('*') then | ||
file = os.matchfiles(file) | ||
end | ||
finalfiles = table.join(finalfiles, file) | ||
end | ||
local source = table.concat(finalfiles, ' ') | ||
local target = path.join(includedir, curheadersdir) | ||
assert(os.mkdir(target)) | ||
assert(os.execute('cp ' .. source .. ' ' .. target)) | ||
end | ||
|
||
-- solution level settings | ||
configurations { "Debug", "Release" } | ||
location(builddir) | ||
includedirs(includedir) | ||
|
||
defines '_FILE_OFFSET_BITS=64' | ||
flags {"ExtraWarnings", "FatalWarnings"} | ||
buildoptions { '-g', | ||
'-march=native', | ||
'-rdynamic', | ||
'-Wconversion', | ||
'-Wno-unused-parameter', | ||
'-Wold-style-cast', | ||
'-Woverloaded-virtual', | ||
'-Wpointer-arith', | ||
'-Wshadow', | ||
'-Wwrite-strings', | ||
} | ||
|
||
configuration "Debug" | ||
buildoptions {'-O0'} | ||
targetsuffix('-g') | ||
configuration "Release" | ||
buildoptions {'-finline-limit=1000'} | ||
defines { "NDEBUG" } | ||
flags { "Optimize" } | ||
|
||
-- filter by kind not support in premake4.4 .4 .4 .4 beta | ||
-- configuration {"*App"} | ||
-- targetdir(bindir) | ||
-- configuration { "*Lib" } | ||
-- targetdir(libdir) | ||
-- configuration {} | ||
|
||
include 'muduo/base' | ||
include 'muduo/net' | ||
include 'examples/simple' |