Skip to content

Commit c81f3bb

Browse files
authored
cmake : do not build common library by default when standalone (#9804)
1 parent e702206 commit c81f3bb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ option(LLAMA_SANITIZE_ADDRESS "llama: enable address sanitizer" OFF)
6363
option(LLAMA_SANITIZE_UNDEFINED "llama: enable undefined sanitizer" OFF)
6464

6565
# utils
66-
option(LLAMA_BUILD_COMMON "llama: build common utils library" ON)
66+
option(LLAMA_BUILD_COMMON "llama: build common utils library" ${LLAMA_STANDALONE})
6767

6868
# extra artifacts
6969
option(LLAMA_BUILD_TESTS "llama: build tests" ${LLAMA_STANDALONE})
@@ -201,12 +201,12 @@ if (LLAMA_BUILD_COMMON)
201201
add_subdirectory(common)
202202
endif()
203203

204-
if (LLAMA_BUILD_TESTS AND NOT CMAKE_JS_VERSION)
204+
if (LLAMA_BUILD_COMMON AND LLAMA_BUILD_TESTS AND NOT CMAKE_JS_VERSION)
205205
include(CTest)
206206
add_subdirectory(tests)
207207
endif()
208208

209-
if (LLAMA_BUILD_EXAMPLES)
209+
if (LLAMA_BUILD_COMMON AND LLAMA_BUILD_EXAMPLES)
210210
add_subdirectory(examples)
211211
add_subdirectory(pocs)
212212
endif()

examples/llama.android/llama/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ android {
1818
}
1919
externalNativeBuild {
2020
cmake {
21+
arguments += "-DLLAMA_BUILD_COMMON=ON"
2122
arguments += "-DCMAKE_BUILD_TYPE=Release"
2223
cppFlags += listOf()
2324
arguments += listOf()

0 commit comments

Comments
 (0)