Skip to content

Commit

Permalink
core: fix emscripten support
Browse files Browse the repository at this point in the history
  • Loading branch information
zpl-zak committed Sep 11, 2022
1 parent c17d5ca commit b640b9c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
18.0.3 - fix emscripten support
18.0.2 - fix global-buffer-overflow in print module
- raise ZPL_PRINTF_MAXLEN to 64kb
18.0.1 - fix ADT parser wrongly assuming that an IP address is a real number
Expand Down
2 changes: 1 addition & 1 deletion code/apps/examples/jobs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define ZPL_NANO
#define ZPL_ENABLE_JOBS
#define ZPL_JOBS_ENABLE_DEBUG
#define ZPL_ENFORCE_THREADING
// #define ZPL_ENFORCE_THREADING
#include <zpl.h>

int rand(void);
Expand Down
5 changes: 4 additions & 1 deletion code/source/core/file_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# include <dirent.h>
#endif

#if defined(ZPL_SYSTEM_UNIX) && !defined(ZPL_SYSTEM_FREEBSD) && !defined(ZPL_SYSTEM_OPENBSD) && !defined(ZPL_SYSTEM_CYGWIN)
#if defined(ZPL_SYSTEM_UNIX) && !defined(ZPL_SYSTEM_FREEBSD) && !defined(ZPL_SYSTEM_OPENBSD) && !defined(ZPL_SYSTEM_CYGWIN) && !defined(ZPL_SYSTEM_EMSCRIPTEN)
# include <sys/sendfile.h>
#endif

Expand Down Expand Up @@ -109,6 +109,9 @@ ZPL_BEGIN_C_DECLS
# elif defined(ZPL_SYSTEM_OPENBSD)
ZPL_NOT_IMPLEMENTED;
return 0;
# elif defined(ZPL_SYSTEM_EMSCRIPTEN)
ZPL_NOT_IMPLEMENTED;
return 0;
# else
int existing_fd = open(existing_filename, O_RDONLY, 0);
struct stat stat_existing;
Expand Down
1 change: 0 additions & 1 deletion code/zpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ Version History:
# ifdef ZPL_MODULE_JOBS
# undef ZPL_MODULE_JOBS /* user */
# endif

# undef ZPL_MODULE_THREADING
# endif
# if defined(ZPL_DISABLE_JOBS) && defined(ZPL_MODULE_JOBS)
Expand Down
4 changes: 4 additions & 0 deletions misc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ foreach(example_source ${examples})

if (WIN32)
target_link_libraries(${example_name} winmm)
elseif (EMSCRIPTEN)
target_link_libraries(${example_name} pthread m dl)
elseif (UNIX)
target_link_libraries(${example_name} pthread m dl atomic)
endif()
Expand All @@ -27,6 +29,8 @@ if (WIN32)
target_link_libraries(tester winmm)
elseif (APPLE)
target_link_libraries(tester pthread m dl)
elseif (EMSCRIPTEN)
target_link_libraries(tester pthread m dl)
elseif (UNIX)
target_link_libraries(tester pthread m dl atomic)
endif()

0 comments on commit b640b9c

Please sign in to comment.