本文整理汇总了Python中conans.CMake.definitions["WITH_SASL"]方法的典型用法代码示例。如果您正苦于以下问题:Python CMake.definitions["WITH_SASL"]方法的具体用法?Python CMake.definitions["WITH_SASL"]怎么用?Python CMake.definitions["WITH_SASL"]使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类conans.CMake
的用法示例。
在下文中一共展示了CMake.definitions["WITH_SASL"]方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
# 需要导入模块: from conans import CMake [as 别名]
# 或者: from conans.CMake import definitions["WITH_SASL"] [as 别名]
def build(self):
self.output.info("cwd=%s" % (os.getcwd()))
# put conan inclusion into CMakeLists.txt file or fail (strict=True)
self.output.info('Patching CMakeLists.txt')
tools.replace_in_file(os.sep.join([self.folder_name, "CMakeLists.txt"]), "project(RdKafka)",
'''project(RdKafka)
include(${CMAKE_BINARY_DIR}/../../conanbuildinfo.cmake)
conan_basic_setup()''')
# Some situations like using a bad passphrase causes rk to never be initialized
# so calling this function would cause a segfault. Input validation would be helpful.
tools.replace_in_file(os.sep.join([self.folder_name, "src", "rdkafka.c"]),
'''static void rd_kafka_destroy_app (rd_kafka_t *rk, int blocking) {
thrd_t thrd;
#ifndef _MSC_VER
int term_sig = rk->rk_conf.term_sig;
#endif''',
'''static void rd_kafka_destroy_app (rd_kafka_t *rk, int blocking) {
if (rk == NULL)
{
return;
}
thrd_t thrd;
#ifndef _MSC_VER
int term_sig = rk->rk_conf.term_sig;
#endif''')
if tools.os_info.is_windows:
# rdkafka C++ library does not export the special partition and offset constants/values
# variables from the DLL, and looks like the library is switching to a preprocessor define
# instead. This change includes the C-header file just to get the macro values, and then
# changes the constants from being used as imported values to read from the macros.
tools.replace_in_file(os.sep.join([self.folder_name, "examples", "rdkafka_example.cpp"]), '#include "rdkafkacpp.h"',
'''#include "rdkafkacpp.h"
#include "rdkafka.h"''')
tools.replace_in_file(os.sep.join([self.folder_name, "examples", "rdkafka_example.cpp"]), 'RdKafka::Topic::PARTITION_UA', 'RD_KAFKA_PARTITION_UA')
tools.replace_in_file(os.sep.join([self.folder_name, "examples", "rdkafka_example.cpp"]), 'RdKafka::Topic::OFFSET_BEGINNING', 'RD_KAFKA_OFFSET_BEGINNING')
tools.replace_in_file(os.sep.join([self.folder_name, "examples", "rdkafka_example.cpp"]), 'RdKafka::Topic::OFFSET_END', 'RD_KAFKA_OFFSET_END')
tools.replace_in_file(os.sep.join([self.folder_name, "examples", "rdkafka_example.cpp"]), 'RdKafka::Topic::OFFSET_STORED', 'RD_KAFKA_OFFSET_STORED')
# src/rd.h includes win32_config.h which is not generated by CMake/Conan
# so it builds librdkafka with fixed settings (!!!).
# This change removes that choice, and both platforms use the generated config.h file
self.output.info('Patching src/rd.h file')
tools.replace_in_file(os.sep.join([self.folder_name, 'src', 'rd.h']),
'''
#ifdef _MSC_VER
/* Visual Studio */
#include "win32_config.h"
#else
/* POSIX / UNIX based systems */
#include "../config.h" /* mklove output */
#endif
''',
'#include "../config.h"')
files.mkdir("./{}/build".format(self.folder_name))
with tools.chdir("./{}/build".format(self.folder_name)):
cmake = CMake(self)
cmake.definitions['RDKAFKA_BUILD_STATIC'] = "OFF" if self.options.shared else "ON"
cmake.definitions['ENABLE_DEVEL'] = "ON" if self.options.with_devel_asserts else "OFF"
cmake.definitions['ENABLE_REFCNT_DEBUG'] = 'ON' if self.options.with_refcount_debug else "OFF"
cmake.definitions['ENABLE_SHAREDPTR_DEBUG'] = 'ON' if self.options.with_sharedptr_debug else "OFF"
cmake.definitions["RDKAFKA_BUILD_EXAMPLES"] = "ON" if self.options.build_examples else "OFF"
cmake.definitions["RDKAFKA_BUILD_TESTS"] = "ON" if self.options.build_tests else "OFF"
cmake.definitions["WITH_LIBDL"] = "OFF"
cmake.definitions["WITH_PLUGINS"] = "OFF"
cmake.definitions["WITH_SASL"] = "OFF"
cmake.definitions["WITH_SSL"] = "ON" if self.options.with_openssl else "OFF"
cmake.definitions["WITH_ZLIB"] = "ON" if self.options.with_zlib else "OFF"
if self.settings.build_type == "Debug":
cmake.definitions["WITHOUT_OPTIMIZATION"] = "ON"
if self.options.shared:
cmake.definitions["BUILD_SHARED_LIBS"] = "ON"
# Enables overridding of default window build settings
cmake.definitions["WITHOUT_WIN32_CONFIG"] = "ON"
cmake.configure(source_dir="..", build_dir=".")
cmake.build(build_dir=".")
else:
configure_args = [
"--prefix=",
"--disable-sasl"
]
if not self.options.with_openssl:
configure_args.append('--disable-ssl')
if not self.options.with_zlib:
configure_args.append('--disable-lz4')
if self.options.shared:
#.........这里部分代码省略.........