Compare commits

...

9 Commits

Author SHA1 Message Date
blueloveTH
480a2646e4 Update pubspec.yaml 2024-11-08 20:10:57 +08:00
blueloveTH
ab4ff49eda ... 2024-11-08 18:23:46 +08:00
blueloveTH
eb280910c9 ... 2024-11-08 18:16:15 +08:00
blueloveTH
5cc224cb3e ... 2024-11-08 18:07:48 +08:00
blueloveTH
11868f12b2 Update build_ios.sh 2024-11-08 17:53:55 +08:00
blueloveTH
6541b0faba ... 2024-11-08 17:50:30 +08:00
blueloveTH
4cea396016 ... 2024-11-08 17:43:48 +08:00
blueloveTH
1ea83cf10b add PK_BUILD_WITH_IPO 2024-11-08 17:33:08 +08:00
blueloveTH
8a98208a75 ...
...
2024-11-08 17:09:48 +08:00
4 changed files with 23 additions and 16 deletions

View File

@ -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.")

View File

@ -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

View File

@ -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

View File

@ -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);