leetal / ios-cmake

A CMake toolchain file for iOS/iPadOS, visionOS, macOS, watchOS & tvOS C/C++/Obj-C++ development
BSD 3-Clause "New" or "Revised" License
1.89k stars 448 forks source link

the compiled framework contains only arm64 #195

Closed xuhaodong1 closed 2 months ago

xuhaodong1 commented 10 months ago

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.

leetal commented 2 months ago

You are missing the cmake --install . --config Release step which is mentioned in the README. Closing.