aboutsummaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2022-09-21 20:17:38 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2022-09-21 20:17:38 +0300
commite6c9b17192c56494adba359d5e132c431b241191 (patch)
tree6f2449871a118a0e8919ce842b1174e06cb470ef /cmake
parent285021ab1aac39e84b269d9bacd4deee69cf63fc (diff)
downloadydb-e6c9b17192c56494adba359d5e132c431b241191.tar.gz
Ydb stable 22-4-2122.4.21
x-stable-origin-commit: e89099581237299a132feafb5b58af59ebd0468a
Diffstat (limited to 'cmake')
-rw-r--r--cmake/global_flags.cmake69
-rw-r--r--cmake/global_vars.cmake2
-rw-r--r--cmake/yandex_common.cmake43
3 files changed, 81 insertions, 33 deletions
diff --git a/cmake/global_flags.cmake b/cmake/global_flags.cmake
index dc68e42d12..653c6c1afa 100644
--- a/cmake/global_flags.cmake
+++ b/cmake/global_flags.cmake
@@ -1,5 +1,4 @@
set(CMAKE_C_FLAGS "\
- -m64 \
-fexceptions \
-fno-common \
-fcolor-diagnostics \
@@ -21,26 +20,11 @@ set(CMAKE_C_FLAGS "\
-D_GNU_SOURCE \
-D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE \
-D__LONG_LONG_SUPPORTED \
- -DSSE_ENABLED=1 \
- -DSSE3_ENABLED=1 \
- -DSSSE3_ENABLED=1 \
- -DSSE41_ENABLED=1 \
- -DSSE42_ENABLED=1 \
- -DPOPCNT_ENABLED=1 \
- -DCX16_ENABLED=1 \
-D_libunwind_ \
-DLIBCXX_BUILDING_LIBCXXRT \
- -msse2 \
- -msse3 \
- -mssse3 \
- -msse4.1 \
- -msse4.2 \
- -mpopcnt \
- -mcx16 \
"
)
set(CMAKE_CXX_FLAGS "\
- -m64 \
-fexceptions \
-fno-common \
-fcolor-diagnostics \
@@ -62,22 +46,8 @@ set(CMAKE_CXX_FLAGS "\
-D_GNU_SOURCE \
-D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE \
-D__LONG_LONG_SUPPORTED \
- -DSSE_ENABLED=1 \
- -DSSE3_ENABLED=1 \
- -DSSSE3_ENABLED=1 \
- -DSSE41_ENABLED=1 \
- -DSSE42_ENABLED=1 \
- -DPOPCNT_ENABLED=1 \
- -DCX16_ENABLED=1 \
-D_libunwind_ \
-DLIBCXX_BUILDING_LIBCXXRT \
- -msse2 \
- -msse3 \
- -mssse3 \
- -msse4.1 \
- -msse4.2 \
- -mpopcnt \
- -mcx16 \
-Woverloaded-virtual \
-Wimport-preprocessor-directive-pedantic \
-Wno-undefined-var-template \
@@ -104,3 +74,42 @@ elseif(UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-init-array")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-init-array")
endif()
+
+if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ set(CMAKE_CXX_FLAGS "\
+ ${CMAKE_CXX_FLAGS} \
+ -m64 \
+ -DSSE_ENABLED=1 \
+ -DSSE3_ENABLED=1 \
+ -DSSSE3_ENABLED=1 \
+ -DSSE41_ENABLED=1 \
+ -DSSE42_ENABLED=1 \
+ -DPOPCNT_ENABLED=1 \
+ -DCX16_ENABLED=1 \
+ -msse2 \
+ -msse3 \
+ -mssse3 \
+ -msse4.1 \
+ -msse4.2 \
+ -mpopcnt \
+ -mcx16 \
+ ")
+ set(CMAKE_C_FLAGS "\
+ ${CMAKE_C_FLAGS} \
+ -m64 \
+ -msse2 \
+ -msse3 \
+ -mssse3 \
+ -msse4.1 \
+ -msse4.2 \
+ -mpopcnt \
+ -mcx16 \
+ -DSSE_ENABLED=1 \
+ -DSSE3_ENABLED=1 \
+ -DSSSE3_ENABLED=1 \
+ -DSSE41_ENABLED=1 \
+ -DSSE42_ENABLED=1 \
+ -DPOPCNT_ENABLED=1 \
+ -DCX16_ENABLED=1 \
+ ")
+endif()
diff --git a/cmake/global_vars.cmake b/cmake/global_vars.cmake
index 9b3d4248d2..71eab249d2 100644
--- a/cmake/global_vars.cmake
+++ b/cmake/global_vars.cmake
@@ -6,7 +6,7 @@
# original buildsystem will not be accepted.
-if(UNIX AND NOT APPLE)
+if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE)
set(YASM_FLAGS -f elf64 -D UNIX -D _x86_64_ -D_YASM_ -g dwarf2)
set(BISON_FLAGS -v)
set(RAGEL_FLAGS -L -I ${CMAKE_SOURCE_DIR}/)
diff --git a/cmake/yandex_common.cmake b/cmake/yandex_common.cmake
index f54398077e..c422bd7766 100644
--- a/cmake/yandex_common.cmake
+++ b/cmake/yandex_common.cmake
@@ -11,7 +11,7 @@ function(target_ragel_lexers TgtName Key Src)
string(APPEND OutPath .cpp)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OutPath}
- COMMAND Python2::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/run_tool.py -- ${RAGEL_BIN} ${RAGEL_FLAGS} ${ARGN} -o ${CMAKE_CURRENT_BINARY_DIR}/${OutPath} ${Src}
+ COMMAND Python3::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/run_tool.py -- ${RAGEL_BIN} ${RAGEL_FLAGS} ${ARGN} -o ${CMAKE_CURRENT_BINARY_DIR}/${OutPath} ${Src}
DEPENDS ${CMAKE_SOURCE_DIR}/build/scripts/run_tool.py ${Src}
)
target_sources(${TgtName} ${Key} ${CMAKE_CURRENT_BINARY_DIR}/${OutPath})
@@ -23,7 +23,7 @@ function(target_yasm_source TgtName Key Src)
string(APPEND OutPath .o)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OutPath}
- COMMAND Python2::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/run_tool.py -- ${YASM_BIN} ${YASM_FLAGS} ${ARGN} -o ${CMAKE_CURRENT_BINARY_DIR}/${OutPath} ${Src}
+ COMMAND Python3::Interpreter ${CMAKE_SOURCE_DIR}/build/scripts/run_tool.py -- ${YASM_BIN} ${YASM_FLAGS} ${ARGN} -o ${CMAKE_CURRENT_BINARY_DIR}/${OutPath} ${Src}
DEPENDS ${CMAKE_SOURCE_DIR}/build/scripts/run_tool.py ${Src}
)
target_sources(${TgtName} ${Key} ${CMAKE_CURRENT_BINARY_DIR}/${OutPath})
@@ -42,6 +42,45 @@ function(target_joined_source TgtName Out)
target_sources(${TgtName} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${Out})
endfunction()
+function(target_sources_custom TgtName CompileOutSuffix)
+ set(opts "")
+ set(oneval_args "")
+ set(multival_args SRCS CUSTOM_FLAGS)
+ cmake_parse_arguments(TARGET_SOURCES_CUSTOM
+ "${opts}"
+ "${oneval_args}"
+ "${multival_args}"
+ ${ARGN}
+ )
+
+ foreach(Src ${TARGET_SOURCES_CUSTOM_SRCS})
+ file(RELATIVE_PATH SrcRealPath ${CMAKE_SOURCE_DIR} ${Src})
+ get_filename_component(SrcDir ${SrcRealPath} DIRECTORY)
+ get_filename_component(SrcName ${SrcRealPath} NAME_WLE)
+ get_filename_component(SrcExt ${SrcRealPath} LAST_EXT)
+ set(SrcCopy "${CMAKE_BINARY_DIR}/${SrcDir}/${SrcName}${CompileOutSuffix}${SrcExt}")
+ add_custom_command(
+ OUTPUT ${SrcCopy}
+ COMMAND ${CMAKE_COMMAND} -E copy ${Src} ${SrcCopy}
+ DEPENDS ${Src}
+ )
+ list(APPEND PreparedSrc ${SrcCopy})
+ set_property(
+ SOURCE
+ ${SrcCopy}
+ APPEND PROPERTY COMPILE_OPTIONS
+ ${TARGET_SOURCES_CUSTOM_CUSTOM_FLAGS}
+ -I${CMAKE_SOURCE_DIR}/${SrcDir}
+ )
+ endforeach()
+
+ target_sources(
+ ${TgtName}
+ PRIVATE
+ ${PreparedSrc}
+ )
+endfunction()
+
function(generate_enum_serilization Tgt Input)
set(opts "")
set(oneval_args INCLUDE_HEADERS)