diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8c86e1c5..30a4e54f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,6 +123,24 @@ jobs: PWD=`pwd` ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)" + linux-emscripten-cmake: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + - run: sudo apt -y update && sudo apt -y install cmake ninja-build emscripten + - run: emcmake cmake -H. -B cmake-build -DENABLE_ACTIVERECORD_COMPILER=OFF -DENABLE_PAGECOMPILER=OFF -DENABLE_PAGECOMPILER_FILE2PAGE=off && emmake cmake --build cmake-build --target all -j4 +# TODO: How to run unit tests in emscripten? +# - uses: ./.github/actions/retry-action +# with: +# timeout_minutes: 90 +# max_attempts: 3 +# retry_on: any +# command: >- +# cd cmake-build && +# sudo -s +# PWD=`pwd` +# ctest --output-on-failure -E "(DataMySQL)|(DataODBC)|(PostgreSQL)|(MongoDB)" + linux-gcc-make-cross-armhf: runs-on: ubuntu-22.04 steps: diff --git a/Foundation/include/Poco/Platform.h b/Foundation/include/Poco/Platform.h index 71177472a..97ffacd2b 100644 --- a/Foundation/include/Poco/Platform.h +++ b/Foundation/include/Poco/Platform.h @@ -61,13 +61,16 @@ #elif defined(__NACL__) #define POCO_OS_FAMILY_UNIX 1 #define POCO_OS POCO_OS_NACL -#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) || defined(EMSCRIPTEN) +#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__) || defined(__EMSCRIPTEN__) #define POCO_OS_FAMILY_UNIX 1 #if defined(__ANDROID__) #define POCO_OS POCO_OS_ANDROID #else #define POCO_OS POCO_OS_LINUX #endif + #if defined(__EMSCRIPTEN__) + #define POCO_EMSCRIPTEN + #endif #elif defined(__APPLE__) || defined(__TOS_MACOS__) #define POCO_OS_FAMILY_UNIX 1 #define POCO_OS_FAMILY_BSD 1 @@ -142,7 +145,7 @@ #if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA) #define POCO_ARCH POCO_ARCH_ALPHA #define POCO_ARCH_LITTLE_ENDIAN 1 -#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(EMSCRIPTEN) +#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(POCO_EMSCRIPTEN) #define POCO_ARCH POCO_ARCH_IA32 #define POCO_ARCH_LITTLE_ENDIAN 1 #elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64) diff --git a/Foundation/src/Thread_POSIX.cpp b/Foundation/src/Thread_POSIX.cpp index 5e1c58442..ecbca6050 100644 --- a/Foundation/src/Thread_POSIX.cpp +++ b/Foundation/src/Thread_POSIX.cpp @@ -364,7 +364,9 @@ ThreadImpl::TIDImpl ThreadImpl::currentTidImpl() long ThreadImpl::currentOsTidImpl() { -#if POCO_OS == POCO_OS_LINUX +#if defined(POCO_EMSCRIPTEN) + return ::pthread_self(); +#elif POCO_OS == POCO_OS_LINUX return ::syscall(SYS_gettid); #elif POCO_OS == POCO_OS_MAC_OS_X return ::pthread_mach_thread_np(::pthread_self()); diff --git a/MongoDB/include/Poco/MongoDB/MessageHeader.h b/MongoDB/include/Poco/MongoDB/MessageHeader.h index a8ef0b654..3524954ab 100644 --- a/MongoDB/include/Poco/MongoDB/MessageHeader.h +++ b/MongoDB/include/Poco/MongoDB/MessageHeader.h @@ -34,7 +34,7 @@ class MongoDB_API MessageHeader /// MongoDB request or response message. { public: - static const unsigned int MSG_HEADER_SIZE = 16; + static constexpr Int32 MSG_HEADER_SIZE = 16; enum OpCode { diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index 460250da9..f73d8f684 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -1512,7 +1512,7 @@ NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) #include #endif #include -#ifndef POCO_NO_LINUX_IF_PACKET_H +#if !defined(POCO_NO_LINUX_IF_PACKET_H) && !defined(POCO_EMSCRIPTEN) #include #endif #include @@ -1543,7 +1543,7 @@ static NetworkInterface::Type fromNative(unsigned arphrd) } } -#if POCO_OS != POCO_OS_ANDROID +#if (POCO_OS != POCO_OS_ANDROID) && !defined(POCO_EMSCRIPTEN) void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl) { @@ -1552,7 +1552,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl) impl.setAdapterName(iface->ifa_name); impl.setPhyParams(); -#ifndef POCO_NO_LINUX_IF_PACKET_H +#if !defined(POCO_NO_LINUX_IF_PACKET_H) if (iface->ifa_addr->sa_family == AF_PACKET) { struct sockaddr_ll* sdl = (struct sockaddr_ll*) iface->ifa_addr; @@ -1602,7 +1602,7 @@ void setInterfaceParams(struct ifaddrs* iface, NetworkInterfaceImpl& impl) NetworkInterface::Map NetworkInterface::map(bool ipOnly, bool upOnly) { -#if POCO_OS != POCO_OS_ANDROID +#if (POCO_OS != POCO_OS_ANDROID) && !defined(POCO_EMSCRIPTEN) FastMutex::ScopedLock lock(_mutex); Map result; unsigned ifIndex = 0;