Skip to content

When building for iOS corrosion does not respect the XCode output directory #649

@vasilakisfil

Description

@vasilakisfil

Hello, I am trying to build a rust library for iOS.

I have the following snippet:

corrosion_import_crate(
    MANIFEST_PATH Cargo.toml
    CRATE_TYPES staticlib
    CRATES foo
    PROFILE dev
    FEATURES apple
)
add_library(foocpp STATIC support/compat.cpp)
target_link_libraries(foocpp PUBLIC foo)

It's straightforward: a rust library with extern "C" exported functions and a simple cpp snippet that uses those bindings and builds on top of them simple C++ functions that can be used easily from C++ projects.

Then I run the following:

cmake -B cmake_build -G Xcode \
        -DCMAKE_SYSTEM_NAME=iOS \
        -DCMAKE_BUILD_TYPE=Debug \
        -DCMAKE_OSX_ARCHITECTURES=arm64 \
        -DCMAKE_OSX_DEPLOYMENT_TARGET=12.0 \
        -DIOS=true 

and finally:

cmake --build cmake_build --config Debug --target ALL_BUILD

After building finishes, the libfoocpp.a ends up correctly in cmake_build/Debug-iphoneos/libfoocpp.a while the libfoo.a ends up in cmake_build/libfoo.a (wrong). So basically corrosion somehow messes up the xcode output directory as it doesn't take into account theCONFIGURATION (Debug) and the CMAKE_OSX_SYSROOT (iphoneos).

How can we fix this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions