Skip to content

Commit

Permalink
spdlog for emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
mathis committed Sep 15, 2022
1 parent 0a96b34 commit 7c21319
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "Dependencies/libdatachannel"]
path = Dependencies/libdatachannel
url = https://github.com/paullouisageneau/libdatachannel
[submodule "Dependencies/spdlog"]
path = Dependencies/spdlog
url = https://github.com/gabime/spdlog
1 change: 1 addition & 0 deletions Dependencies/spdlog
Submodule spdlog added at 81de01
11 changes: 9 additions & 2 deletions OpenGL/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,15 @@ target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/OpenGL/s
# glm
target_include_directories(${PROJECT_NAME} SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/Dependencies/glm")

find_package(spdlog REQUIRED)
target_link_libraries(${PROJECT_NAME} spdlog::spdlog)
# spdlog
if(${BUILD_PLATFORM} STREQUAL wasm)
add_subdirectory("${CMAKE_SOURCE_DIR}/Dependencies/spdlog" "spdlog" EXCLUDE_FROM_ALL)
target_compile_options(spdlog PUBLIC -pthread)
target_link_libraries(${PROJECT_NAME} spdlog::spdlog)
else ()
find_package(spdlog REQUIRED)
target_link_libraries(${PROJECT_NAME} spdlog::spdlog)
endif ()

# libdatachannel
if(${BUILD_PLATFORM} STREQUAL wasm)
Expand Down
4 changes: 2 additions & 2 deletions OpenGL/data/wasm/sw.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// credit: https://googlechrome.github.io/samples/service-worker/basic/

const version = 6
const version = 7
const PRECACHE = 'precache-v' + version;
const RUNTIME = 'runtime';
const RUNTIME = 'runtime-v' + version;

const PRECACHE_URLS = [
'/MonCraft.data',
Expand Down
9 changes: 1 addition & 8 deletions OpenGL/src/debug/Debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#include <chrono>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <spdlog/spdlog.h>
#include <spdlog/fmt/ostr.h>
#include <fmt/ostream.h>

class DebugTimer {

Expand Down Expand Up @@ -67,12 +67,5 @@ namespace glm {
}
return os;
}

#if FMT_VERSION >= 90000 // fmt version >= 9 requires explicit formatter definitions.
template<typename T, length_t N>
struct fmt::formatter<vec<N, T>> : ostream_formatter{};
template<typename T>
struct fmt::formatter<tmat4x4<T>> : ostream_formatter{};
#endif
}

1 change: 1 addition & 0 deletions OpenGL/src/multiplayer/server/WebSocketServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <functional>
#include <iostream>
#include <spdlog/spdlog.h>
#include <spdlog/fmt/ostr.h>
#include <utility>
#include "multiplayer/server/Server.hpp"
#include "save/ServerConfig.hpp"
Expand Down

0 comments on commit 7c21319

Please sign in to comment.