mirror of
https://github.com/bkaradzic/bx.git
synced 2026-02-17 20:52:37 +01:00
Updated Emscripten/asm.js toolchain config.
This commit is contained in:
@@ -10,7 +10,13 @@
|
||||
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
# include <windows.h>
|
||||
#elif BX_PLATFORM_NACL || BX_PLATFORM_ANDROID || BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_IOS
|
||||
#elif BX_PLATFORM_NACL \
|
||||
|| BX_PLATFORM_ANDROID \
|
||||
|| BX_PLATFORM_LINUX \
|
||||
|| BX_PLATFORM_OSX \
|
||||
|| BX_PLATFORM_IOS \
|
||||
|| BX_PLATFORM_EMSCRIPTEN
|
||||
|
||||
# include <sched.h> // sched_yield
|
||||
# if BX_PLATFORM_IOS || BX_PLATFORM_OSX || BX_PLATFORM_NACL
|
||||
# include <pthread.h> // mach_port_t
|
||||
@@ -79,7 +85,7 @@ namespace bx
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
return (void*)::LoadLibraryA(_filePath);
|
||||
#elif BX_PLATFORM_NACL
|
||||
#elif BX_PLATFORM_NACL || BX_PLATFORM_EMSCRIPTEN
|
||||
BX_UNUSED(_filePath);
|
||||
return NULL;
|
||||
#else
|
||||
@@ -91,7 +97,7 @@ namespace bx
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
::FreeLibrary( (HMODULE)_handle);
|
||||
#elif BX_PLATFORM_NACL
|
||||
#elif BX_PLATFORM_NACL || BX_PLATFORM_EMSCRIPTEN
|
||||
BX_UNUSED(_handle);
|
||||
#else
|
||||
::dlclose(_handle);
|
||||
@@ -102,7 +108,7 @@ namespace bx
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
return (void*)::GetProcAddress( (HMODULE)_handle, _symbol);
|
||||
#elif BX_PLATFORM_NACL
|
||||
#elif BX_PLATFORM_NACL || BX_PLATFORM_EMSCRIPTEN
|
||||
BX_UNUSED(_handle, _symbol);
|
||||
return NULL;
|
||||
#else
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "bx.h"
|
||||
|
||||
#if BX_PLATFORM_ANDROID
|
||||
#if BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN
|
||||
# include <time.h> // clock, clock_gettime
|
||||
#elif BX_PLATFORM_NACL || BX_PLATFORM_LINUX || BX_PLATFORM_OSX || BX_PLATFORM_IOS || BX_PLATFORM_QNX
|
||||
# include <sys/time.h> // gettimeofday
|
||||
@@ -26,9 +26,7 @@ namespace bx
|
||||
// http://support.microsoft.com/kb/274323
|
||||
QueryPerformanceCounter(&li);
|
||||
int64_t i64 = li.QuadPart;
|
||||
#elif BX_PLATFORM_EMSCRIPTEN
|
||||
int64_t i64 = clock();
|
||||
#elif BX_PLATFORM_ANDROID
|
||||
#elif BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
int64_t i64 = now.tv_sec*INT64_C(1000000000) + now.tv_nsec;
|
||||
@@ -46,9 +44,7 @@ namespace bx
|
||||
LARGE_INTEGER li;
|
||||
QueryPerformanceFrequency(&li);
|
||||
return li.QuadPart;
|
||||
#elif BX_PLATFORM_EMSCRIPTEN
|
||||
return CLOCKS_PER_SEC;
|
||||
#elif BX_PLATFORM_ANDROID
|
||||
#elif BX_PLATFORM_ANDROID || BX_PLATFORM_EMSCRIPTEN
|
||||
return INT64_C(1000000000);
|
||||
#else
|
||||
return INT64_C(1000000);
|
||||
|
||||
@@ -16,7 +16,7 @@ function toolchain(_buildDir, _libDir)
|
||||
{ "android-arm", "Android - ARM" },
|
||||
{ "android-mips", "Android - MIPS" },
|
||||
{ "android-x86", "Android - x86" },
|
||||
-- { "emscripten-experimental", "Emscripten" },
|
||||
{ "asmjs", "Emscripten/asm.js" },
|
||||
{ "linux-gcc", "Linux (GCC compiler)" },
|
||||
{ "linux-clang", "Linux (Clang compiler)" },
|
||||
{ "mingw", "MinGW" },
|
||||
@@ -86,7 +86,7 @@ function toolchain(_buildDir, _libDir)
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-android-x86")
|
||||
end
|
||||
|
||||
if "emscripten-experimental" == _OPTIONS["gcc"] then
|
||||
if "asmjs" == _OPTIONS["gcc"] then
|
||||
|
||||
if not os.getenv("EMSCRIPTEN") then
|
||||
print("Set EMSCRIPTEN enviroment variables.")
|
||||
@@ -95,7 +95,7 @@ function toolchain(_buildDir, _libDir)
|
||||
premake.gcc.cc = "$(EMSCRIPTEN)/emcc"
|
||||
premake.gcc.cxx = "$(EMSCRIPTEN)/em++"
|
||||
premake.gcc.ar = "$(EMSCRIPTEN)/emar"
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-emscripten")
|
||||
location (_buildDir .. "projects/" .. _ACTION .. "-asmjs")
|
||||
end
|
||||
|
||||
if "linux-gcc" == _OPTIONS["gcc"] then
|
||||
@@ -471,13 +471,13 @@ function toolchain(_buildDir, _libDir)
|
||||
"$(ANDROID_NDK_ROOT)/platforms/android-14/arch-x86/usr/lib/crtend_so.o",
|
||||
}
|
||||
|
||||
configuration { "emscripten-experimental" }
|
||||
targetdir (_buildDir .. "emscripten" .. "/bin")
|
||||
objdir (_buildDir .. "emscripten" .. "/obj")
|
||||
libdirs { _libDir .. "lib/emscripten" }
|
||||
includedirs { "$(EMSCRIPTEN)/system/include" }
|
||||
buildoptions {
|
||||
"-pthread",
|
||||
configuration { "asmjs" }
|
||||
targetdir (_buildDir .. "asmjs" .. "/bin")
|
||||
objdir (_buildDir .. "asmjs" .. "/obj")
|
||||
libdirs { _libDir .. "lib/asmjs" }
|
||||
includedirs {
|
||||
"$(EMSCRIPTEN)/system/include",
|
||||
"$(EMSCRIPTEN)/system/include/libc",
|
||||
}
|
||||
|
||||
configuration { "nacl or nacl-arm or pnacl" }
|
||||
|
||||
Reference in New Issue
Block a user