Skip to content

RikkaW/libcxx-prefab

Repository files navigation

libcxx Prefab

Prefab package for https://github.com/topjohnwu/libcxx.

Integration

This is a Prefab library, so you will need to enable it in your project (requires Android Gradle Plugin 4.1+):

android {
    ...
    buildFeatures {
        ...
        prefab true
    }
}

Add dependency:

repositories {
    mavenCentral()
}

dependencies {
    implementation 'dev.rikka.ndk.thirdparty:cxx:1.2.0'
}

Usage

ndk-build

# Remove original stl
APP_STL=none
LOCAL_STATIC_LIBRARIES := cxx

# You can remove this block if you are using NDK r21+.
ifneq ($(call ndk-major-at-least,21),true)
    $(call import-add-path,$(NDK_GRADLE_INJECTED_IMPORT_PATH))
endif

$(call import-module,prefab/cxx)

CMake

android {
    defaultConfig {
        externalNativeBuild {
            cmake {
                // Remove original stl
                arguments '-DANDROID_STL=none'
find_package(cxx REQUIRED CONFIG)
target_link_libraries(<your lib> cxx::cxx)