我正在尝试使用Cmake生成ASSIMP的Xcode项目。我知道其中已有一个工作区文件夹。而我只想自己创造。我试着写cmakelist.txt:
cmake_minimum_required(VERSION 2.8)
project(assimp)
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
set(CMAKE_OSX_SYSROOT iphoneos5.1)
set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
add_subdirectory(assimp)
然后我运行了这个命令:
#!/bin/bash
cd "$(dirname "$0")"/assimp
if [ ! -d xcode ]
then
mkdir xcode
fi
cd xcode
cmake -G Xcode ../.. -DINSTALL_LIBS=ON -DCMAKE_INSTALL_PREFIX=../.. -DBUILD_SHARED_LIBS=OFF -DBUILD_ASSIMP_TOOLS:BOOL=OFF -DENABLE_BOOST_WORKAROUND=ON
# Device or simulator
xcodebuild -target install -configuration Release
它生成了Xcode项目,但是在产品中是libassimp.dylib并且" target指定了产品类型&com; apple.product-type.library.dynamic',但是'没有这样的产品类型的“iphoneos'平台"错误。
如何更改' com.apple.product-type.library.dynamic'静电?我设置了-DBUILD_SHARED_LIBS = OFF但它没有工作。
我搜索了网络,无法找到导致问题的原因。
非常感谢您的帮助!
答案 0 :(得分:9)
在/ code /目录下的cmakelist.txt中有一行:ADD_LIBRARY(assimp SHARED只是将SHARED更改为STATIC
我正在使用的cmakelist:
cmake_minimum_required(VERSION 2.8.6)
project(assimp)
# Set the Base SDK (only change the SDKVER value, if for instance, you are building for iOS 5.0):
set(SDKVER "5.1")
set(DEVROOT "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer")
set(SDKROOT "${DEVROOT}/SDKs/iPhoneOS${SDKVER}.sdk")
if(EXISTS ${SDKROOT})
set(CMAKE_OSX_SYSROOT "${SDKROOT}")
else()
message("Warning, iOS Base SDK path not found: " ${SDKROOT})
endif()
# Will resolve to "Standard (armv6 armv7)" on Xcode 4.0.2 and to "Standard (armv7)" on Xcode 4.2:
set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD_32_BIT)")
# seamless toggle between device and simulator
set(CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos;-iphonesimulator")
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
add_subdirectory(assimp)