mirror of
https://github.com/pocketpy/pocketpy
synced 2025-11-06 19:50:16 +00:00
Compare commits
9 Commits
b7cda8969e
...
480a2646e4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
480a2646e4 | ||
|
|
ab4ff49eda | ||
|
|
eb280910c9 | ||
|
|
5cc224cb3e | ||
|
|
11868f12b2 | ||
|
|
6541b0faba | ||
|
|
4cea396016 | ||
|
|
1ea83cf10b | ||
|
|
8a98208a75 |
@ -6,10 +6,11 @@ set(CMAKE_C_STANDARD 11)
|
|||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
# use IPO
|
# use IPO
|
||||||
|
option(PK_BUILD_WITH_IPO "" TRUE)
|
||||||
include(CheckIPOSupported)
|
include(CheckIPOSupported)
|
||||||
check_ipo_supported(RESULT result)
|
check_ipo_supported(RESULT result)
|
||||||
|
|
||||||
if(result AND NOT CMAKE_SYSTEM_NAME STREQUAL "iOS")
|
if(result AND PK_BUILD_WITH_IPO)
|
||||||
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
|
||||||
else()
|
else()
|
||||||
message(WARNING ">> IPO disabled. You will not get the best performance.")
|
message(WARNING ">> IPO disabled. You will not get the best performance.")
|
||||||
|
|||||||
@ -6,7 +6,7 @@ rm -rf build
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|
||||||
FLAGS="-DCMAKE_TOOLCHAIN_FILE=3rd/ios.toolchain.cmake -DPK_BUILD_STATIC_LIB=ON -DDEPLOYMENT_TARGET=13.0"
|
FLAGS="-DCMAKE_TOOLCHAIN_FILE=3rd/ios.toolchain.cmake -DPK_BUILD_STATIC_LIB=ON -DDEPLOYMENT_TARGET=13.0 -DPK_BUILD_WITH_IPO=OFF"
|
||||||
|
|
||||||
cmake -B os64 -G Xcode $FLAGS -DPLATFORM=OS64 ..
|
cmake -B os64 -G Xcode $FLAGS -DPLATFORM=OS64 ..
|
||||||
cmake --build os64 --config Release
|
cmake --build os64 --config Release
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
name: pocketpy
|
name: pocketpy
|
||||||
description: A lightweight Python interpreter for game engines. It supports Android/iOS/Windows/Linux/MacOS.
|
description: A lightweight Python interpreter for game engines. It supports Android/iOS/Windows/Linux/MacOS.
|
||||||
version: 2.0.1+7
|
version: 2.0.1+8
|
||||||
homepage: https://pocketpy.dev
|
homepage: https://pocketpy.dev
|
||||||
repository: https://github.com/pocketpy/pocketpy
|
repository: https://github.com/pocketpy/pocketpy
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +1,29 @@
|
|||||||
#include "pocketpy/pocketpy.h"
|
#include "pocketpy/pocketpy.h"
|
||||||
#include "pocketpy/interpreter/vm.h"
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#define NANOS_PER_SEC 1000000000
|
#define NANOS_PER_SEC 1000000000
|
||||||
|
|
||||||
int64_t time_ns() {
|
#ifndef __circle__
|
||||||
struct timespec tms;
|
int64_t time_ns() {
|
||||||
#if defined( __ANDROID__) || defined(__MINGW32__) || defined(__MINGW64__)
|
struct timespec tms;
|
||||||
clock_gettime(CLOCK_REALTIME, &tms);
|
#ifdef CLOCK_REALTIME
|
||||||
|
clock_gettime(CLOCK_REALTIME, &tms);
|
||||||
|
#else
|
||||||
|
/* The C11 way */
|
||||||
|
timespec_get(&tms, TIME_UTC);
|
||||||
|
#endif
|
||||||
|
/* seconds, multiplied with 1 billion */
|
||||||
|
int64_t nanos = tms.tv_sec * NANOS_PER_SEC;
|
||||||
|
/* Add full nanoseconds */
|
||||||
|
nanos += tms.tv_nsec;
|
||||||
|
return nanos;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
/* The C11 way */
|
int64_t time_ns() {
|
||||||
timespec_get(&tms, TIME_UTC);
|
return 0;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/* seconds, multiplied with 1 billion */
|
|
||||||
int64_t nanos = tms.tv_sec * NANOS_PER_SEC;
|
|
||||||
/* Add full nanoseconds */
|
|
||||||
nanos += tms.tv_nsec;
|
|
||||||
return nanos;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool time_time(int argc, py_Ref argv) {
|
static bool time_time(int argc, py_Ref argv) {
|
||||||
PY_CHECK_ARGC(0);
|
PY_CHECK_ARGC(0);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user