Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
skhaz committed Dec 22, 2024
1 parent e83cc3d commit 60263cf
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 16 deletions.
44 changes: 30 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,41 @@ elseif (CMAKE_BUILD_TYPE MATCHES "Release")
if (MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /O2 /GL)
else()
target_compile_options(${PROJECT_NAME} PRIVATE -O3 -flto)
target_compile_options(${PROJECT_NAME} PRIVATE -O2 -flto)
endif()
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Emscripten")
if (${CMAKE_SYSTEM_NAME} MATCHES Emscripten)
set(EMSCRIPTEN_OPTIONS
"-s EVAL_CTORS=1"
"-s WASM_BIGINT=1"
"-s ALLOW_MEMORY_GROWTH=1"
"-s INITIAL_MEMORY=128MB"
"-l websocket.js"
"-s USE_SDL=2"
"-s WEBSOCKET_SUBPROTOCOL=text"
"-s EXPORTED_RUNTIME_METHODS=['callMain']"
# Debug
"-s ASSERTIONS=1"
"-s NO_DISABLE_EXCEPTION_CATCHING"
-sEVAL_CTORS=1
-sWASM_BIGINT=1
-sALLOW_MEMORY_GROWTH=1
-sINITIAL_MEMORY=128MB
-lwebsocket.js
-sUSE_SDL=2
-sWEBSOCKET_SUBPROTOCOL=text
-sEXPORTED_RUNTIME_METHODS=['callMain']
)
target_link_libraries(${PROJECT_NAME} PRIVATE ${EMSCRIPTEN_OPTIONS})

if (ENABLE_PROFILING)
list(APPEND EMSCRIPTEN_OPTIONS
-O0
-g
-gsource-map
-sDEMANGLE_SUPPORT=1
-sASSERTIONS=1
-sNO_DISABLE_EXCEPTION_CATCHING
--profiling-funcs
-sSAFE_HEAP=0
-sSTACK_OVERFLOW_CHECK=2
)
else()
list(APPEND EMSCRIPTEN_OPTIONS
-O2
)
endif()

target_link_options(${PROJECT_NAME} PRIVATE ${EMSCRIPTEN_OPTIONS})
endif()

option(LOCAL "Use local environment" OFF)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ build: ## Build
configure: clean ## Configure
conan remote update conancenter --url https://center2.conan.io
conan install . --output-folder=build --build=missing --profile=webassembly --settings compiler.cppstd=20 --settings build_type=Release
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DSDL2_DIR=generators -DCMAKE_BUILD_TYPE=Release -DLOCAL=ON -DSANDBOX=OFF
cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DSDL2_DIR=generators -DCMAKE_BUILD_TYPE=Release -DLOCAL=ON -DSANDBOX=OFF -DENABLE_PROFILING=OFF
4 changes: 3 additions & 1 deletion src/entitymanager.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "entitymanager.hpp"
#include "common.hpp"
#include <ostream>

using namespace framework;

Expand Down Expand Up @@ -86,8 +87,9 @@ void entitymanager::update(float_t delta) noexcept {
}

for (const auto &entity1 : _entities) {
if (entity1->_collisionmapping.empty()) [[unlikely]]
if (entity1->_collisionmapping.empty()) [[likely]] {
continue;
}

const auto &pos1 = entity1->position();
const auto &size1 = entity1->size().resized();
Expand Down

0 comments on commit 60263cf

Please sign in to comment.