Skip to content

Commit

Permalink
[GLUTEN-7950][VL] Keep Core module's build flag consistent with Velox (
Browse files Browse the repository at this point in the history
  • Loading branch information
surnaik authored Nov 25, 2024
1 parent 58e7d83 commit 35de38f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
30 changes: 22 additions & 8 deletions cpp/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,29 @@ include(FindPkgConfig)
include(GNUInstallDirs)
include(CheckCXXCompilerFlag)

# Only set arch=native for non-AppleClang compilers.
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-attributes")
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-class-memaccess")
endif()

if(NOT DEFINED VELOX_HOME)
set(VELOX_HOME ${GLUTEN_HOME}/ep/build-velox/build/velox_ep)
message(STATUS "Set VELOX_HOME to ${VELOX_HOME}")
endif()

# Keep same compile option with Velox.
execute_process(
COMMAND
bash -c
"( source ${VELOX_HOME}/scripts/setup-helper-functions.sh && echo -n $(get_cxx_flags $ENV{CPU_TARGET}))"
OUTPUT_VARIABLE SCRIPT_CXX_FLAGS
RESULT_VARIABLE COMMAND_STATUS)
if(COMMAND_STATUS EQUAL "1")
message(FATAL_ERROR "Unable to determine compiler flags!")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SCRIPT_CXX_FLAGS}")
message("Core module final CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

set(BOOST_MIN_VERSION "1.42.0")
find_package(Boost REQUIRED)
Expand Down Expand Up @@ -99,11 +118,6 @@ set_source_files_properties(${GLUTEN_PROTO_OUTPUT_FILES} PROPERTIES GENERATED
TRUE)
get_filename_component(GLUTEN_PROTO_DIR ${GLUTEN_PROTO_SRC_DIR}/ DIRECTORY)

set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-attributes")

message("Core module final CMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}")

set(SPARK_COLUMNAR_PLUGIN_SRCS
${SUBSTRAIT_PROTO_SRCS}
${GLUTEN_PROTO_SRCS}
Expand Down
1 change: 0 additions & 1 deletion ep/build-velox/src/get_velox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ function setup_linux {
local LINUX_VERSION_ID=$(. /etc/os-release && echo ${VERSION_ID})

# apply patches
sed -i 's/-mavx2 -mfma -mavx -mf16c -mlzcnt -std=c++17/-march=native -std=c++17 -mno-avx512f/g' scripts/setup-helper-functions.sh
sed -i 's/SUDO="${SUDO:-""}"/SUDO="${SUDO:-"sudo --preserve-env"}"/g' scripts/setup-helper-functions.sh
if [[ "$LINUX_DISTRIBUTION" == "ubuntu" || "$LINUX_DISTRIBUTION" == "debian" || "$LINUX_DISTRIBUTION" == "pop" ]]; then
process_setup_ubuntu
Expand Down

0 comments on commit 35de38f

Please sign in to comment.