compile native on OSX

This commit is contained in:
proddy
2024-08-02 12:20:09 +02:00
parent de582f2f61
commit 3159561cfb
6 changed files with 6 additions and 9 deletions

View File

@@ -47,7 +47,7 @@ the LICENSE file.
#include <mutex> // NOLINT [build/c++11]
#define EMC_SEMAPHORE_TAKE() mtx.lock();
#define EMC_SEMAPHORE_GIVE() mtx.unlock();
#elif defined(_WIN32)
#elif defined(_WIN32) || defined(__APPLE__)
#include <Arduino.h>
#define EMC_SEMAPHORE_TAKE()
#define EMC_SEMAPHORE_GIVE()

View File

@@ -6,8 +6,6 @@ For a copy, see <https://opensource.org/licenses/MIT> or
the LICENSE file.
*/
#if defined(__linux__) || defined(_WIN32)
#include "ClientPosixIPAddress.h"
IPAddress::IPAddress()
@@ -28,5 +26,3 @@ IPAddress::IPAddress(uint32_t address)
IPAddress::operator uint32_t() {
return _address;
}
#endif

View File

@@ -120,7 +120,7 @@ espMqttClient::espMqttClient()
, _client() {
_transport = &_client;
}
#elif defined(_WIN32)
#elif defined(_WIN32) || defined(__APPLE__)
// Windows
espMqttClient::espMqttClient()
: MqttClientSetup(espMqttClientTypes::UseInternalTask::NO) {

View File

@@ -76,7 +76,7 @@ class espMqttClient : public MqttClientSetup<espMqttClient> {
protected:
espMqttClientInternals::ClientPosix _client;
};
#elif defined(_WIN32)
#elif defined(_WIN32) || defined(__APPLE__)
class espMqttClient : public MqttClientSetup<espMqttClient> {
public:
espMqttClient();

View File

@@ -260,7 +260,7 @@ lib_ignore = Module EMS-ESP-Modules
; unit tests
; pio run -e native-test -t exec
; works on Linux and Windows
; works on Linux, Windows, and MacOS
[env:native-test]
platform = native
test_build_src = true

View File

@@ -532,7 +532,8 @@ static void setup_commands(std::shared_ptr<Commands> & commands) {
JsonDocument doc;
int8_t id = -1;
const char * cmd = Helpers::toLower(arguments[1]).c_str();
auto arg = Helpers::toLower(arguments[1]);
const char * cmd = arg.c_str(); // prevent loosing pointer after object destruction
uint8_t return_code = CommandRet::OK;
JsonObject json = doc.to<JsonObject>();
bool has_data = false;