Files
cocos4/native/cocos/scripting/js-bindings/jswrapper/config.hpp
T

73 lines
1.7 KiB
C++

#pragma once
#define SCRIPT_ENGINE_NONE 0
#define SCRIPT_ENGINE_SM 1
#define SCRIPT_ENGINE_V8 2
#define SCRIPT_ENGINE_JSC 3
#define SCRIPT_ENGINE_CHAKRACORE 4
#if defined(__APPLE__) // macOS and iOS use JavaScriptCore
#define SCRIPT_ENGINE_TYPE SCRIPT_ENGINE_JSC
#elif defined(ANDROID) || (defined(_WIN32) && defined(_WINDOWS)) // Windows and Android use V8
#define SCRIPT_ENGINE_TYPE SCRIPT_ENGINE_V8
#else
#define SCRIPT_ENGINE_TYPE SCRIPT_ENGINE_NONE
#endif
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
#define SE_ENABLE_INSPECTOR 1
#define SE_DEBUG 2
#else
#define SE_ENABLE_INSPECTOR 0
#define SE_DEBUG 0
#endif
#ifdef ANDROID
#include <android/log.h>
#define LOG_TAG "jswrapper"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#elif defined(_WIN32) && defined(_WINDOWS)
#ifndef QUOTEME_
#define QUOTEME_(x) #x
#endif
#ifndef QUOTEME
#define QUOTEME(x) QUOTEME_(x)
#endif
void seLog(const char * format, ...);
#define LOG_TAG "jswrapper"
#define LOGD(fmt, ...) seLog("D/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__)
#define LOGE(fmt, ...) seLog("E/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__)
#else
#define LOGD printf
#define LOGE printf
#endif
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#define __POSIX__
#endif
#if defined(_WIN32) && defined(_WINDOWS)
#include <BaseTsd.h>
#ifndef __SSIZE_T
#define __SSIZE_T
typedef SSIZE_T ssize_t;
#define _SSIZE_T_DEFINED // libuv also defines ssize_t, use the one defined here.
#endif // __SSIZE_T
#endif