-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
96 lines (74 loc) · 2.16 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# Copyright (c) Alpaca Core
# SPDX-License-Identifier: MIT
#
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
project(ilib-sd.cpp
VERSION 1.0.0
DESCRIPTION "Stable-diffusion.cpp plugin for the Alpaca Core Local SDK"
LANGUAGES CXX
)
include(./get-ac-build.cmake)
#################
# cmake lib
CPMAddPackage(gh:iboB/[email protected])
list(APPEND CMAKE_MODULE_PATH
"${icm_SOURCE_DIR}"
)
include(icm_add_lib)
include(init_ac_prj)
include(ac_build_prj_util)
include(ac_build_plugin_util)
#################
# options
option(AC_SD_BUILD_TESTS "${PROJECT_NAME}: build tests" ${testsDefault})
option(AC_SD_BUILD_EXAMPLES "${PROJECT_NAME}: build examples" ${examplesDefault})
mark_as_advanced(AC_SD_BUILD_TESTS AC_SD_BUILD_EXAMPLES)
init_ac_plugin_option(SD)
#######################################
# packages
add_ac_local(0.1.4)
CPMAddPackage(gh:iboB/[email protected])
CPMAddPackage(gh:iboB/[email protected])
#######################################
# submodule and config
find_package(CUDAToolkit)
if(CUDAToolkit_FOUND)
set(haveCuda YES)
enable_language(CUDA)
set(CMAKE_CUDA_ARCHITECTURES 70)
message(STATUS "${CMAKE_PROJECT_NAME}: system CUDA found")
# we should add -forward-unknown-to-host-compiler but it somehow works without it
# could it be that it depends on the CMake version?
endif()
if(haveCuda)
set(SD_CUBLAS ON)
endif()
if(APPLE)
set(SD_METAL ON)
endif()
set(GGML_CCACHE OFF)
add_subdirectory(stable-diffusion.cpp)
#######################################
# subdirs
add_subdirectory(code)
if(AC_SD_BUILD_TESTS OR AC_SD_BUILD_EXAMPLES)
CPMAddPackage(
NAME ac-test-data-stable-diffusion
VERSION 1.0.0
GIT_REPOSITORY https://huggingface.co/alpaca-core/ac-test-data-stable-diffusion
GIT_TAG 1c6409643e3756c98b8d117d9de134ffe6ef0218
)
endif()
if(AC_SD_BUILD_TESTS)
CPMAddPackage(gh:iboB/[email protected])
set_target_properties(doctest PROPERTIES FOLDER test)
set_target_properties(doctest-main PROPERTIES FOLDER test)
enable_testing()
add_subdirectory(test)
endif()
if(AC_SD_BUILD_EXAMPLES)
add_subdirectory(example)
endif()
if(BUILD_AC_SD_PLUGIN)
add_subdirectory(ac-local-plugin)
endif()