use unity build

Update build_ios.sh

update build scripts
This commit is contained in:
blueloveTH 2025-03-03 19:30:06 +08:00
parent 698a7b7f4f
commit 4434bfcf23
3 changed files with 15 additions and 13 deletions

View File

@ -5,15 +5,11 @@ project(pocketpy)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
# use IPO
option(PK_BUILD_WITH_IPO "" TRUE)
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if(result AND PK_BUILD_WITH_IPO)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
# use UNITY_BUILD if CMake version >= 3.16
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.16")
option(PK_BUILD_WITH_UNITY "" TRUE)
else()
message(WARNING ">> IPO disabled. You will not get the best performance.")
option(PK_BUILD_WITH_UNITY "" FALSE)
endif()
if(WIN32)
@ -94,13 +90,20 @@ else()
target_link_libraries(main ${PROJECT_NAME})
endif()
if(UNIX)
if(UNIX AND NOT APPLE)
target_link_libraries(${PROJECT_NAME} m)
if(PK_ENABLE_OS)
target_link_libraries(${PROJECT_NAME} dl)
endif()
endif()
if(PK_BUILD_WITH_UNITY)
set_source_files_properties(${POCKETPY_SRC} PROPERTIES UNITY_GROUP "pocketpy")
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD_MODE GROUP)
set_target_properties(${PROJECT_NAME} PROPERTIES UNITY_BUILD ON)
endif()
############################################
if(PK_BUILD_MODULE_LZ4)
target_link_libraries(${PROJECT_NAME} lz4)
endif()

View File

@ -8,10 +8,7 @@ cd build
FLAGS="-DCMAKE_TOOLCHAIN_FILE=3rd/ios.toolchain.cmake \
-DDEPLOYMENT_TARGET=13.0 \
-DPK_BUILD_STATIC_LIB=ON \
-DPK_BUILD_WITH_IPO=OFF \
-DPK_BUILD_MODULE_LZ4=ON \
-DPK_BUILD_MODULE_LIBHV=ON"
-DPK_BUILD_STATIC_LIB=ON"
cmake -B os64 -G Xcode $FLAGS -DPLATFORM=OS64 ..
cmake --build os64 --config Release

View File

@ -1,3 +1,5 @@
#pragma once
#include "pocketpy/objects/object.h"
#include "pocketpy/interpreter/objectpool.h"