Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "examples/server/frontend"]
path = examples/server/frontend
url = https://github.com/leejet/stable-ui.git
[submodule "thirdparty/libwebp"]
path = thirdparty/libwebp
url = https://github.com/webmproject/libwebp.git
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ endif()
# general
#option(SD_BUILD_TESTS "sd: build tests" ${SD_STANDALONE})
option(SD_BUILD_EXAMPLES "sd: build examples" ${SD_STANDALONE})
option(SD_WEBP "sd: enable WebP image I/O support" ON)
option(SD_CUDA "sd: cuda backend" OFF)
option(SD_HIPBLAS "sd: rocm backend" OFF)
option(SD_METAL "sd: metal backend" OFF)
Expand Down Expand Up @@ -77,6 +78,10 @@ if(SD_MUSA)
add_definitions(-DSD_USE_CUDA)
endif()

if(SD_WEBP)
add_compile_definitions(SD_USE_WEBP)
endif()

set(SD_LIB stable-diffusion)

file(GLOB SD_LIB_SOURCES
Expand Down
12 changes: 12 additions & 0 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ git submodule init
git submodule update
```

## WebP Support in Examples

The example applications (`examples/cli` and `examples/server`) use `libwebp` to support WebP image I/O. This is enabled by default.

If you do not want WebP support, you can disable it at configure time:

```shell
mkdir build && cd build
cmake .. -DSD_WEBP=OFF
cmake --build . --config Release
```

## Build (CPU only)

If you don't have a GPU or CUDA installed, you can build a CPU-only version.
Expand Down
5 changes: 5 additions & 0 deletions examples/cli/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
set(TARGET sd-cli)

add_executable(${TARGET}
../common/log.cpp
../common/media_io.cpp
image_metadata.cpp
main.cpp
)
install(TARGETS ${TARGET} RUNTIME)
target_link_libraries(${TARGET} PRIVATE stable-diffusion zip ${CMAKE_THREAD_LIBS_INIT})
if(SD_WEBP)
target_link_libraries(${TARGET} PRIVATE webp libwebpmux)
endif()
target_compile_features(${TARGET} PUBLIC c_std_11 cxx_std_17)
4 changes: 2 additions & 2 deletions examples/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ usage: ./bin/sd-cli [options]

CLI Options:
-o, --output <string> path to write result image to. you can use printf-style %d format specifiers for image sequences (default:
./output.png) (eg. output_%03d.png)
--preview-path <string> path to write preview image to (default: ./preview.png)
./output.png) (eg. output_%03d.png). For video generation, single-file outputs support .avi and animated .webp
--preview-path <string> path to write preview image to (default: ./preview.png). Multi-frame previews support .avi and animated .webp
--preview-interval <int> interval in denoising steps between consecutive updates of the image preview file (default is 1, meaning updating at
every step)
--output-begin-idx <int> starting index for output image sequence, must be non-negative (default 0 if specified %d in output path, 1 otherwise)
Expand Down
217 changes: 0 additions & 217 deletions examples/cli/avi_writer.h

This file was deleted.

Loading
Loading