oue it compiles

This commit is contained in:
arthur.jamet
2021-06-22 15:50:38 +02:00
parent 0982c284cb
commit 3223d9195f
5 changed files with 56 additions and 15 deletions
+2 -1
View File
@@ -10,4 +10,5 @@ build_web/*
wasm-python.py
lua54*
include/*
save/*
save/*
lib/Lua/*
+2 -2
View File
@@ -18,8 +18,8 @@ add_subdirectory(${PROJECT_SOURCE_DIR}/lib/Ray)
add_subdirectory(${PROJECT_SOURCE_DIR}/lib/LuaGate)
if (EMSCRIPTEN)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s INITIAL_MEMORY=33554432")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_GLFW=3 -s ASSERTIONS=1 -s WASM=1 -s ASYNCIFY -s INITIAL_MEMORY=33554432")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_DISABLE_EXCEPTION_CATCHING --shell-file ../sources/wasm/frontend.html --preload-file ../assets")
set(CMAKE_EXECUTABLE_SUFFIX ".html")
endif ()
+25 -9
View File
@@ -17,17 +17,33 @@ set(SRC
sources/LuaGate.cpp
)
include(FindLua)
if (NOT LUA_FOUND)
if (EXISTS ${CMAKE_SOURCE_DIR}/include/lua.hpp)
message("Using local lua")
set(LUA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/)
set(LUA_LIBRARIES ${CMAKE_SOURCE_DIR}/lua54.lib)
else()
message(FATAL_ERROR "Lua could not be found.")
add_library(LuaGate STATIC ${SRC} ${HEADERS})
if (EMSCRIPTEN)
include(ExternalProject)
ExternalProject_Add(LUA
SOURCE_DIR ${CMAKE_SOURCE_DIR}/lib/Lua
URL http://www.lua.org/ftp/lua-5.4.3.tar.gz
DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/lib/Lua
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND echo "Trololol"
BUILD_COMMAND make generic CC="emcc" 'AR="emar rcu"' RANLIB="emranlib"
INSTALL_COMMAND cmake -E echo "Ta mere en slip"
)
set(LUA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/lib/Lua/src)
set(LUA_LIBRARIES ${CMAKE_SOURCE_DIR}/lib/Lua/src/liblua.a)
add_dependencies(LuaGate LUA)
else()
include(FindLua)
if (NOT LUA_FOUND)
if (EXISTS ${CMAKE_SOURCE_DIR}/include/lua.hpp)
message("Using local lua")
set(LUA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/include/)
set(LUA_LIBRARIES ${CMAKE_SOURCE_DIR}/lua54.lib)
else()
message(FATAL_ERROR "Lua could not be found.")
endif()
endif()
endif()
add_library(LuaGate STATIC ${SRC} ${HEADERS})
target_include_directories(LuaGate PUBLIC ${LUA_INCLUDE_DIR})
target_link_libraries(LuaGate ${LUA_LIBRARIES})
+3 -3
View File
@@ -15,10 +15,10 @@ namespace BBM {
private:
//! @brief The number of chars for endl
#ifdef __linux__
static constexpr int endlNbChars = 1;
#elif _WIN32
#ifdef _WIN32
static constexpr int endlNbChars = 2;
#else
static constexpr int endlNbChars = 1;
#endif
//!@brief file block of the parser
+24
View File
@@ -0,0 +1,24 @@
# Python 3
import sys
import socketserver
from http.server import SimpleHTTPRequestHandler
class WasmHandler(SimpleHTTPRequestHandler):
def end_headers(self):
# Include additional response headers here. CORS for example:
#self.send_header('Access-Control-Allow-Origin', '*')
SimpleHTTPRequestHandler.end_headers(self)
# Python 3.7.5 adds in the WebAssembly Media Type. If this is an older
# version, add in the Media Type.
if sys.version_info < (3, 7, 5):
WasmHandler.extensions_map['.wasm'] = 'application/wasm'
if __name__ == '__main__':
PORT = 8080
with socketserver.TCPServer(("", PORT), WasmHandler) as httpd:
print("Listening on port {}. Press Ctrl+C to stop.".format(PORT))
httpd.serve_forever()