From 22cdaf67f926fd0fb0204ef8084372780acc0a73 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Fri, 7 Oct 2022 17:35:16 +0900 Subject: [PATCH] ARROW-15678: [C++] Add support for -DCMAKE_BUILD_TYPE=MinSizeRel If we build with -DCMAKE_BUILD_TYPE=MinSizeRel, our SIMD related code may violate the one-definition-rule. See also ARROW-15664 and https://issues.apache.org/jira/browse/ARROW-15678?focusedCommentId=17613909#comment-17613909 for details. This change prevents the one-definition-rule violation by forcing inlining as much as possible. --- cpp/cmake_modules/SetupCxxFlags.cmake | 3 +++ dev/tasks/r/github.macos-linux.local.yml | 6 ++++++ dev/tasks/tasks.yml | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cpp/cmake_modules/SetupCxxFlags.cmake b/cpp/cmake_modules/SetupCxxFlags.cmake index a9e23be538614..cef4eb0b1617d 100644 --- a/cpp/cmake_modules/SetupCxxFlags.cmake +++ b/cpp/cmake_modules/SetupCxxFlags.cmake @@ -683,6 +683,9 @@ elseif("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE_GEN") elseif("${CMAKE_BUILD_TYPE}" STREQUAL "PROFILE_BUILD") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_PROFILE_BUILD}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_PROFILE_BUILD}") +elseif("${CMAKE_BUILD_TYPE}" STREQUAL "MINSIZEREL") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_FLAGS_MINSIZEREL}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS_MINSIZEREL}") else() message(FATAL_ERROR "Unknown build type: ${CMAKE_BUILD_TYPE}") endif() diff --git a/dev/tasks/r/github.macos-linux.local.yml b/dev/tasks/r/github.macos-linux.local.yml index 27c67657ba4d4..aaefafdce16d6 100644 --- a/dev/tasks/r/github.macos-linux.local.yml +++ b/dev/tasks/r/github.macos-linux.local.yml @@ -23,6 +23,12 @@ jobs: autobrew: name: "install from local source" runs-on: {{ "${{ matrix.os }}" }} + {% if env is defined %} + env: + {% for key, value in env.items() %} + {{ key }}: "{{ value }}" + {% endfor %} + {% endif %} strategy: fail-fast: false matrix: diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml index 1fe42168a4914..2cad64296bebc 100644 --- a/dev/tasks/tasks.yml +++ b/dev/tasks/tasks.yml @@ -1314,6 +1314,13 @@ tasks: ci: github template: r/github.macos-linux.local.yml + test-r-install-local-minsizerel: + ci: github + template: r/github.macos-linux.local.yml + params: + env: + CMAKE_BUILD_TYPE: MinSizeRel + test-r-devdocs: ci: github template: r/github.devdocs.yml @@ -1355,7 +1362,6 @@ tasks: ci: github template: r/github.linux.offline.build.yml - test-r-rhub-debian-gcc-release-custom-ccache: ci: azure template: r/azure.linux.yml