Improve uuid generation on Linux

This commit is contained in:
flakey5 2022-04-28 16:50:31 -07:00
parent 0c6711170c
commit ccf45c14c5
3 changed files with 8 additions and 1 deletions

View File

@ -107,7 +107,7 @@ linux-clean: nix-clean
linux: linux-clean
mkdir -p build/bootstrap
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" $(SRC) -lm -ldl -lrt
$(CC) -o build/bootstrap/premake_bootstrap -DPREMAKE_NO_BUILTIN_SCRIPTS -DLUA_USE_POSIX -DLUA_USE_DLOPEN -I"$(LUA_DIR)" -I"$(LUASHIM_DIR)" $(SRC) -lm -ldl -lrt -luuid
./build/bootstrap/premake_bootstrap embed
./build/bootstrap/premake_bootstrap --to=build/bootstrap gmake2
$(MAKE) -C build/bootstrap -j`getconf _NPROCESSORS_ONLN` config=$(CONFIG)

View File

@ -247,6 +247,9 @@
filter "system:macosx"
defines { "LUA_USE_MACOSX" }
links { "CoreServices.framework", "Foundation.framework", "Security.framework", "readline" }
filter "system:linux or macosx"
links { "uuid" }
filter { "system:macosx", "action:gmake" }
toolset "clang"

View File

@ -8,6 +8,8 @@
#if PLATFORM_WINDOWS
#include <objbase.h>
#elif PLATFORM_LINUX
#include <uuid/uuid.h>
#endif
@ -49,6 +51,8 @@ int os_uuid(lua_State* L)
{
#if PLATFORM_WINDOWS
CoCreateGuid((GUID*)bytes);
#elif PLATFORM_LINUX
uuid_generate(bytes);
#else
int result;