ios-cmake icon indicating copy to clipboard operation
ios-cmake copied to clipboard

the compiled framework contains only arm64

Open xuhaodong1 opened this issue 1 year ago • 0 comments

hello, I'm new to cmake, I have some problems about this.

I executed the following command

cmake -B build -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=OSCOMBINED
cmake --build build --config Release

However, the compiled framework contains only arm64 This is my CMakeList:

CMAKE_MINIMUM_REQUIRED(VERSION 3.5)

PROJECT(lemon_parser)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g")

SET(lemon_parser_sources
    parse.c
    delete.c
    insert.c
    select.c
    update.c
    util.c
    where.c
    tokenize.c
    printf.c
    expr.c
    build.c
    trigger.c
    alter.c
    os_unix.c   
    callback.c
)

SET(HEADER_FILES
include/sqliteInt.h
include/hash.h
include/keywordhash.h
include/os_common.h
include/os.h
include/parse.h
include/sqlite3.h
)


include_directories(${PROJECT_SOURCE_DIR}/include)

set(CMAKE_SYSTEM_NAME iOS)
set(CMAKE_OSX_SYSROOT "iphoneos")
set(CMAKE_OSX_ARCHITECTURES "x86_64" "arm64")
set(CMAKE_XCODE_ATTRIBUTE_SDKROOT "iphoneos")
set(CMAKE_XCODE_ATTRIBUTE_ARCHS "x86_64" "arm64")

ADD_LIBRARY(lemon_parser STATIC ${lemon_parser_sources} ${HEADER_FILES})

set_target_properties(lemon_parser PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER com.shein.lemon_parser
VERSION 1.0.0
SOVERSION 1.0.0
PUBLIC_HEADER "${HEADER_FILES}"
XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET 12.2
XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym"
)

This is my execution script:

rm -r build-ios

#!/usr/bin/env bash

mkdir -p build-ios
pushd build-ios
cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../ios.toolchain.cmake -DPLATFORM=SIMULATOR64 -DENABLE_BITCODE=FALSE
cmake --build . --config Release

Looking forward to your reply, thank you.

xuhaodong1 avatar Nov 22 '23 13:11 xuhaodong1