Skip to content

Commit

Permalink
Fixed EMSCRIPTEN compilation. It seems like std::filesystem::director…
Browse files Browse the repository at this point in the history
…y_iterator isn't available right now.
  • Loading branch information
Brotcrunsher committed Feb 25, 2024
1 parent 98f154d commit 494a73e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
[Bb]uildNull/
[Bb]uildOpenGL/
[Bb]uildEmscripten/
[Bb]uildEm/
[Bb]uildPortaudio/
[Bb]uildLinuxNull/
[Bb]uildVulkan/
Expand Down
2 changes: 0 additions & 2 deletions BrotBoxEngine/BBE/SerializableList.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "../BBE/SimpleFile.h"
#include <ctime>

#ifndef __EMSCRIPTEN__
namespace bbe
{
enum class Undoable
Expand Down Expand Up @@ -216,4 +215,3 @@ namespace bbe
}
};
}
#endif
4 changes: 2 additions & 2 deletions BrotBoxEngine/BBE/SimpleFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

namespace bbe
{
#ifndef __EMSCRIPTEN__
namespace backup
{
void setBackupPath(const bbe::String& path);
Expand All @@ -18,7 +17,6 @@ namespace bbe
void createDirectory(const bbe::String& path);
void appendBinaryToFile(const bbe::String& filePath, const bbe::ByteBuffer& buffer);
}
#endif

namespace simpleFile
{
Expand All @@ -38,7 +36,9 @@ namespace bbe
bbe::String readFile(const bbe::String& filePath);
bbe::List<bbe::String> readLines(const bbe::String& filePath);

#ifndef __EMSCRIPTEN__
void forEachFile(const bbe::String& filePath, const std::function<void(const bbe::String&)>& func);
#endif

#ifdef WIN32
bbe::String getUserName();
Expand Down
4 changes: 2 additions & 2 deletions BrotBoxEngine/SimpleFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <sstream>
#include <filesystem>

#ifndef __EMSCRIPTEN__
static bbe::String backupPath;

void bbe::backup::setBackupPath(const bbe::String& path)
Expand Down Expand Up @@ -60,7 +59,6 @@ void bbe::backup::appendBinaryToFile(const bbe::String& filePath, const bbe::Byt
bbe::simpleFile::appendBinaryToFile(backupFullPath(filePath), buffer);
}
}
#endif

bbe::ByteBuffer bbe::simpleFile::readBinaryFile(const bbe::String & filepath)
{
Expand Down Expand Up @@ -235,13 +233,15 @@ bbe::List<bbe::String> bbe::simpleFile::readLines(const bbe::String& filePath)
return retVal;
}

#ifndef __EMSCRIPTEN__
void bbe::simpleFile::forEachFile(const bbe::String& filePath, const std::function<void(const bbe::String&)>& func)
{
for (const auto& f : std::filesystem::directory_iterator(filePath.getRaw()))
{
func(f.path().c_str());
}
}
#endif

#ifdef WIN32
#include "windows.h"
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ macro(add_trivial_project name)
install_compiled_shaders(${name})
target_include_directories(${name} PUBLIC .)
if(EMSCRIPTEN)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-s USE_GLFW=3 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s NO_DISABLE_EXCEPTION_CATCHING=1 -s USE_WEBGL2=1")
set_target_properties(${name} PROPERTIES LINK_FLAGS "-s USE_GLFW=3 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s USE_PTHREADS -s NO_DISABLE_EXCEPTION_CATCHING=1 -s USE_WEBGL2=1")
if(BBE_ADD_AUDIO)
set_target_properties(${name} PROPERTIES LINK_FLAGS "-s USE_GLFW=3 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -lopenal -s NO_DISABLE_EXCEPTION_CATCHING=1 -s USE_WEBGL2=1")
set_target_properties(${name} PROPERTIES LINK_FLAGS "-s USE_GLFW=3 -s ASSERTIONS=1 -s ALLOW_MEMORY_GROWTH=1 -s USE_PTHREADS -lopenal -s NO_DISABLE_EXCEPTION_CATCHING=1 -s USE_WEBGL2=1")
endif()
endif()
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Assets")
Expand Down

0 comments on commit 494a73e

Please sign in to comment.