xmake.lua 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package("jrtplib")
  2. set_homepage("https://research.edm.uhasselt.be/jori/page/CS/Jrtplib.html")
  3. set_description("JRTPLIB is an object-oriented RTP library written in C++")
  4. set_license("MIT")
  5. set_urls("https://github.com/j0r1/JRTPLIB.git")
  6. add_versions("2023.11.23", "d43c112f693bf663825ff00fbbad4bfe98f8dd5f")
  7. add_deps("cmake", "jthread")
  8. add_includedirs("include", "include/jrtplib3")
  9. if is_plat ("linux") then
  10. add_syslinks("pthread")
  11. elseif is_plat("windows") then
  12. add_syslinks("ws2_32", "advapi32")
  13. end
  14. on_install("windows", "linux", "macosx", function (package)
  15. io.replace("src/CMakeLists.txt", [[option(JRTPLIB_WARNINGSASERRORS "Enable -Wall -Wextra -Werror" ON)]], [[option(JRTPLIB_WARNINGSASERRORS "Enable -Wall -Wextra -Werror" OFF)]], {plain=true})
  16. io.replace("src/CMakeLists.txt", [[NOT MSVC OR JRTPLIB_COMPILE_STATIC]], [[JRTPLIB_COMPILE_STATIC]], {plain=true})
  17. io.replace("src/CMakeLists.txt", [[NOT MSVC OR NOT JRTPLIB_COMPILE_STATIC]], [[NOT JRTPLIB_COMPILE_STATIC]], {plain=true})
  18. local configs = {"-DJRTPLIB_COMPILE_TESTS=NO", "-DJRTPLIB_COMPILE_EXAMPLES=NO"}
  19. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
  20. table.insert(configs, "-DJRTPLIB_COMPILE_STATIC=" .. (package:config("shared") and "OFF" or "ON"))
  21. import("package.tools.cmake").install(package, configs)
  22. end)
  23. on_test(function (package)
  24. assert(package:check_cxxsnippets({test = [[
  25. #include "rtpsession.h"
  26. #include "rtpsessionparams.h"
  27. #include "rtpudpv4transmitter.h"
  28. #include "rtpipv4address.h"
  29. #include "rtptimeutilities.h"
  30. #include "rtppacket.h"
  31. using namespace jrtplib;
  32. void test() {
  33. RTPSession session;
  34. RTPSessionParams sessionparams;
  35. sessionparams.SetOwnTimestampUnit(1.0/8000.0);
  36. RTPUDPv4TransmissionParams transparams;
  37. transparams.SetPortbase(8000);
  38. int status = session.Create(sessionparams,&transparams);
  39. }
  40. ]]}, {configs = {languages = "c++11"}}))
  41. end)