-
-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* serial: add package * serial: fix windows and macosx * serial: disable plat * serial: enable mingw
- Loading branch information
1 parent
246d2c2
commit 1402481
Showing
1 changed file
with
59 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,59 @@ | ||
package("serial") | ||
set_homepage("http://wjwwood.github.io/serial") | ||
set_description("Cross-platform, Serial Port library written in C++") | ||
set_license("MIT") | ||
|
||
add_urls("https://github.com/wjwwood/serial.git") | ||
add_versions("2022.3.9", "69e0372cf0d3796e84ce9a09aff1d74496f68720") | ||
|
||
if is_plat("windows", "mingw") then | ||
add_syslinks("advapi32", "setupapi") | ||
elseif is_plat("linux") then | ||
add_syslinks("rt", "pthread") | ||
elseif is_plat("macosx") then | ||
add_frameworks("IOKit", "Foundation") | ||
end | ||
|
||
on_install("windows", "linux", "macosx", "mingw", "cross", "wasm", function (package) | ||
local configs = {} | ||
io.writefile("xmake.lua", [[ | ||
add_rules("mode.debug", "mode.release") | ||
target("serial") | ||
set_kind("$(kind)") | ||
add_files("src/serial.cc") | ||
add_includedirs("include") | ||
add_headerfiles("include/(serial/*.h)") | ||
if is_plat("windows", "mingw") then | ||
add_files("src/impl/win.cc") | ||
add_files("src/impl/list_ports/list_ports_win.cc") | ||
add_syslinks("advapi32", "setupapi") | ||
if is_plat("windows") and is_kind("shared") then | ||
add_rules("utils.symbols.export_all", {export_classes = true}) | ||
end | ||
else | ||
add_files("src/impl/unix.cc") | ||
if is_plat("macosx") then | ||
add_files("src/impl/list_ports/list_ports_osx.cc") | ||
add_frameworks("IOKit", "Foundation") | ||
else | ||
add_files("src/impl/list_ports/list_ports_linux.cc") | ||
if is_plat("linux") then | ||
add_syslinks("rt", "pthread") | ||
end | ||
end | ||
end | ||
]]) | ||
if package:config("shared") then | ||
configs.kind = "shared" | ||
end | ||
import("package.tools.xmake").install(package, configs) | ||
end) | ||
|
||
on_test(function (package) | ||
assert(package:check_cxxsnippets({test = [[ | ||
#include <serial/serial.h> | ||
void test() { | ||
serial::list_ports(); | ||
} | ||
]]})) | ||
end) |