Skip to content

Commit

Permalink
Merge branch 'xingyu/unified_lib' of github.com:NexaAI/nexaai-sdk-cpp…
Browse files Browse the repository at this point in the history
… into xingyu/unified_lib
  • Loading branch information
xyyimian committed Aug 22, 2024
2 parents 8924455 + 32452de commit 8cb48b5
Showing 1 changed file with 0 additions and 52 deletions.
52 changes: 0 additions & 52 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,55 +132,3 @@ if (LLAMA_BUILD)
endif()
endif()
endif()

# Project: stable_diffusion_cpp
project(stable_diffusion_cpp)

option(STABLE_DIFFUSION_BUILD "Build stable-diffusion.cpp shared library and install alongside python package" ON)

if (STABLE_DIFFUSION_BUILD)
set(BUILD_SHARED_LIBS "ON")
option(SD_BUILD_SHARED_LIBS "" "ON")

# Building llama
if (APPLE AND NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
# Need to disable these llama.cpp flags on Apple x86_64,
# otherwise users may encounter invalid instruction errors
set(GGML_AVX "Off" CACHE BOOL "ggml: enable AVX" FORCE)
set(GGML_AVX2 "Off" CACHE BOOL "ggml: enable AVX2" FORCE)
set(GGML_FMA "Off" CACHE BOOL "ggml: enable FMA" FORCE)
set(GGML_F16C "Off" CACHE BOOL "ggml: enable F16C" FORCE)
endif()

add_subdirectory(dependency/stable-diffusion.cpp)
install(
TARGETS stable-diffusion
LIBRARY DESTINATION ${SKBUILD_PLATLIB_DIR}/nexa/gguf/lib
RUNTIME DESTINATION ${SKBUILD_PLATLIB_DIR}/nexa/gguf/lib
ARCHIVE DESTINATION ${SKBUILD_PLATLIB_DIR}/nexa/gguf/lib
FRAMEWORK DESTINATION ${SKBUILD_PLATLIB_DIR}/nexa/gguf/lib
RESOURCE DESTINATION ${SKBUILD_PLATLIB_DIR}/nexa/gguf/lib
)

message(STATUS "SKBUILD_PLATLIB_DIR: ${SKBUILD_PLATLIB_DIR}")
# Temporary fix for https://github.com/scikit-build/scikit-build-core/issues/374
install(
TARGETS stable-diffusion
LIBRARY DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/nexa/gguf/lib
RUNTIME DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/nexa/gguf/lib
ARCHIVE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/nexa/gguf/lib
FRAMEWORK DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/nexa/gguf/lib
RESOURCE DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/nexa/gguf/lib
)
# Workaround for Windows + CUDA
if (WIN32)
install(
FILES $<TARGET_RUNTIME_DLLS:stable-diffusion>
DESTINATION ${SKBUILD_PLATLIB_DIR}/nexa/gguf/lib
)
install(
FILES $<TARGET_RUNTIME_DLLS:stable-diffusion>
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/nexa/gguf/lib
)
endif()
endif()

0 comments on commit 8cb48b5

Please sign in to comment.