Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add jthread repo #5236

Merged
merged 8 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions packages/j/jrtplib/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package("jrtplib")
set_homepage("https://research.edm.uhasselt.be/jori/page/CS/Jrtplib.html")
set_description("JRTPLIB is an object-oriented RTP library written in C++")
set_license("MIT")

set_urls("https://github.com/j0r1/JRTPLIB/archive/refs/tags/v3.11.2.tar.gz",
"https://github.com/j0r1/JRTPLIB.git")

add_versions("v3.11.2", "591bf6cddd0976a4659ed4dd2fada43140e5f5f9c9dbef56b137a3023549673f")
star-hengxing marked this conversation as resolved.
Show resolved Hide resolved

add_deps("cmake", "jthread", "srtp")

on_install(function (package)
io.replace("src/CMakeLists.txt", [[ "Enable -Wall -Wextra -Werror" ON]], [[ "Enable -Wall -Wextra -Werror" OFF]])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是一个 option,直接 -DJRTPLIB_WARNINGSASERRORS=OFF 就行

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
但是这里只要时gcc工具链就会设置为ON, 所以才如此修改

local configs = {"-DJRTPLIB_COMPILE_TESTS=NO", "-DJRTPLIB_COMPILE_EXAMPLES=NO"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))

import("package.tools.cmake").install(package, configs)
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <ada.h>
void test() {
auto url = ada::parse<ada::url_aggregator>("https://xmake.io");
}
]]}, {configs = {languages = "c++17"}}))
end)
13 changes: 13 additions & 0 deletions packages/j/jthread/patches/2023.08.18/cmakelist.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 517e13f..3224c46 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -35,7 +35,7 @@ else ()
set(JTHREAD_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one")
endif ()

-if (NOT MSVC OR JTHREAD_COMPILE_STATIC)
+if (NOT MSVC AND JTHREAD_COMPILE_STATIC)
set(JTHREAD_INSTALLTARGETS jthread-static)
add_library(jthread-static STATIC ${SOURCES} ${HEADERS})
set_target_properties(jthread-static PROPERTIES OUTPUT_NAME jthread)
35 changes: 35 additions & 0 deletions packages/j/jthread/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package("jthread")
set_homepage("https://github.com/j0r1/JThread")
set_description("The JThread package provides some classes to make use of threads easy on different platforms")
set_license("MIT")

add_urls("https://github.com/j0r1/JThread.git")

add_versions("2023.08.18", "719413043807b77448df3ba1c749798fb72ee459")
add_deps("cmake")

add_patches("2023.08.18", "patches/2023.08.18/cmakelist.patch", "d5fc628a66434c377a2d88d27d90e937e9d175669a3452958beaeba6f5bcedee")

add_includedirs("include", "include/jthread")

on_install("windows", "linux", "macosx", function(package)

star-hengxing marked this conversation as resolved.
Show resolved Hide resolved
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
if package:config("shared") then
table.insert(configs, "-DJTHREAD_COMPILE_STATIC=OFF")
table.insert(configs, "-DJTHREAD_COMPILE_STATIC_ONLY=OFF")
else
table.insert(configs, "-DJTHREAD_COMPILE_STATIC_ONLY=ON")
table.insert(configs, "-DJTHREAD_COMPILE_STATIC=ON")
end

import("package.tools.cmake").install(package, configs)
end)

on_test(function (package)
assert(package:check_cxxsnippets({test = [[
using namespace jthread;
JMutex* test = new JMutex();
]]}, {configs = {languages = "c++11"}, includes = "jthread.h"}))
end)
Loading