Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
xyyimian committed Aug 22, 2024
1 parent 8cb48b5 commit 1944e97
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,58 @@ if (GGML_CUDA OR GGML_METAL)
add_custom_target(create_empty_file ALL DEPENDS ${EMPTY_FILE_PATH})
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()

# Project: llama_cpp
project(llama_cpp)

Expand Down Expand Up @@ -132,3 +184,4 @@ if (LLAMA_BUILD)
endif()
endif()
endif()

0 comments on commit 1944e97

Please sign in to comment.