]> git.proxmox.com Git - ceph.git/blob - ceph/src/common/options/CMakeLists.txt
import quincy beta 17.1.0
[ceph.git] / ceph / src / common / options / CMakeLists.txt
1 set(common_options_srcs build_options.cc)
2 set(legacy_options_headers)
3 set(options_yamls)
4
5 # to mimic the behavior of file(CONFIGURE ...)
6 file(GENERATE OUTPUT configure_file.cmake
7 CONTENT "configure_file(\${input_file} \${output_file} @ONLY)")
8 function(file_configure input_file output_file)
9 set(cmake_defs
10 -D input_file=${input_file}
11 -D output_file=${output_file})
12 file(STRINGS ${input_file} subvars REGEX "@[^@]+@")
13 foreach(line ${subvars})
14 string(REGEX REPLACE ".*@([^@]+)@.*" "\\1"
15 var "${line}")
16 set(value ${${var}})
17 list(APPEND cmake_defs -D ${var}=${value})
18 endforeach()
19 add_custom_command(OUTPUT ${output_file}
20 COMMAND ${CMAKE_COMMAND} ${cmake_defs} -P configure_file.cmake
21 DEPENDS ${input_file}
22 VERBATIM)
23 endfunction()
24
25 function(add_options name)
26 set(yaml_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${name}.yaml.in)
27 set(yaml_file ${CMAKE_CURRENT_BINARY_DIR}/${name}.yaml)
28 file_configure("${yaml_in_file}"
29 "${yaml_file}" @ONLY)
30 list(APPEND options_yamls ${yaml_file})
31 set(options_yamls ${options_yamls} PARENT_SCOPE)
32 set(cc_file "${name}_options.cc")
33 set(h_file "${PROJECT_BINARY_DIR}/include/${name}_legacy_options.h")
34 add_custom_command(PRE_BUILD
35 OUTPUT ${cc_file} ${h_file}
36 COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/y2c.py
37 --input ${yaml_file}
38 --output ${cc_file}
39 --legacy ${h_file}
40 --name ${name}
41 DEPENDS ${yaml_file})
42 list(APPEND common_options_srcs ${cc_file})
43 set(common_options_srcs ${common_options_srcs} PARENT_SCOPE)
44 list(APPEND legacy_options_headers ${h_file})
45 set(legacy_options_headers ${legacy_options_headers} PARENT_SCOPE)
46 endfunction()
47
48 set(osd_erasure_code_plugins "jerasure" "lrc")
49 if(WITH_EC_ISA_PLUGIN)
50 list(APPEND osd_erasure_code_plugins "isa")
51 endif()
52 string(REPLACE ";" " " osd_erasure_code_plugins "${osd_erasure_code_plugins}")
53
54 set(keyring_paths
55 "/etc/ceph/$cluster.$name.keyring"
56 "/etc/ceph/$cluster.keyring"
57 "/etc/ceph/keyring"
58 "/etc/ceph/keyring.bin")
59 if(FREEBSD)
60 list(APPEND keyring_paths
61 "/usr/local/etc/ceph/$cluster.$name.keyring"
62 "/usr/local/etc/ceph/$cluster.keyring"
63 "/usr/local/etc/ceph/keyring"
64 "/usr/local/etc/ceph/keyring.bin")
65 endif()
66 string(REPLACE ";" "," keyring_paths "${keyring_paths}")
67
68 set(ms_bind_retry_count 3)
69 set(ms_bind_retry_delay 5)
70 if(FREEBSD)
71 # FreeBSD does not use SO_REAUSEADDR so allow for a bit more time per default
72 set(ms_bind_retry_count 6)
73 set(ms_bind_retry_delay 6)
74 endif()
75
76 set(mgr_disabled_modules "")
77 if(WITH_MGR)
78 # https://tracker.ceph.com/issues/45147
79 if(Python3_VERSION VERSION_GREATER_EQUAL 3.8)
80 set(mgr_disabled_modules "diskprediction_local")
81 message(STATUS "mgr module disabled for ${Python3_VERSION}: ${mgr_disabled_modules}")
82 endif()
83 endif()
84
85 add_options(global)
86 add_options(cephfs-mirror)
87 add_options(crimson)
88 add_options(mgr)
89 add_options(mds)
90 add_options(mds-client)
91 add_options(mon)
92 add_options(osd)
93 add_options(rbd)
94 add_options(rbd-mirror)
95 add_options(immutable-object-cache)
96
97 # if set to empty string, system default luarocks package location (if exist) will be used
98 set(rgw_luarocks_location "")
99 if(WITH_RADOSGW_LUA_PACKAGES)
100 set(rgw_luarocks_location "/tmp/luarocks")
101 endif()
102 add_options(rgw)
103
104 add_library(common-options-objs OBJECT
105 ${common_options_srcs})
106 add_custom_target(legacy-option-headers
107 DEPENDS ${legacy_options_headers})
108
109 include(AddCephTest)
110 add_ceph_test(validate-options
111 ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/validate-options.py ${options_yamls})