diff --git a/packages/c/crossguid/patches/warnings.patch b/packages/c/crossguid/patches/warnings.patch new file mode 100644 index 000000000..29ec75f2b --- /dev/null +++ b/packages/c/crossguid/patches/warnings.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 76b5a62..174d981 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,15 +40,6 @@ else() + target_compile_definitions(crossguid PRIVATE GUID_LIBUUID) + endif() + +-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") +- set(WARNINGS "-Werror" "-Wall") +-elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(WARNINGS "-Werror" "-Wall") +-elseif(MSVC) +- set(WARNINGS "/WX" "/W4") +-endif() +-target_compile_options(crossguid PRIVATE ${WARNINGS}) +- + set_target_properties(crossguid + PROPERTIES + VERSION ${PROJECT_VERSION} \ No newline at end of file diff --git a/packages/c/crossguid/xmake.lua b/packages/c/crossguid/xmake.lua new file mode 100644 index 000000000..2f311813b --- /dev/null +++ b/packages/c/crossguid/xmake.lua @@ -0,0 +1,37 @@ +package("crossguid") + set_homepage("https://github.com/graeme-hill/crossguid") + set_description("Lightweight cross platform C++ GUID/UUID library") + set_license("MIT") + + add_urls("https://github.com/graeme-hill/crossguid.git") + add_versions("master", "40aaf2e0e8fddb67dd2e1dc89091a47f1c417459b5afeeb590292fa041650952") + + if is_plat("macosx") then + add_patches("master", path.join(os.scriptdir(), "patches", "warnings.patch"), "52546cb4b33bb467bd901d54a1bc97a467b5861ff54c5e39063de9540313adbb") + elseif is_plat("linux") then + add_deps("libuuid") + end + + add_deps("cmake") + + on_install(function (package) + local configs = {"-DCROSSGUID_TESTS:BOOL=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package: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) + + if package:is_plat("windows") then + if package:config("shared") then + os.trycp(path.join(package:buildir(), "bin", "**.pdb"), package:installdir("bin")) + else + os.trycp(path.join(package:buildir(), "lib", "**.pdb"), package:installdir("lib")) + end + end + end) + + on_test(function (package) + assert(package:check_cxxsnippets({test = [[ + #include + auto g = xg::newGuid(); + ]]})) + end)