Skip to content

Commit

Permalink
build(c): set -Og -ggdb and warn about Conda setting -O2
Browse files Browse the repository at this point in the history
  • Loading branch information
lidavidm committed Mar 12, 2024
1 parent 7b185fe commit 2e51ccc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ DOTNET=7.0
# ci/scripts/install_vcpkg.sh script. Keep in sync with apache/arrow .env.
# When updating, also update the docs, which list the version of libpq/SQLite
# that vcpkg (and hence our wheels) ship
VCPKG="501db0f17ef6df184fcdbfbe0f87cde2313b6ab1"
VCPKG="a42af01b72c28a8e1d7b48107b33e4f286a55ef6"

# These are used to tell tests where to find services for integration testing.
# They are valid if the services are started with the docker-compose config.
Expand Down
13 changes: 12 additions & 1 deletion c/cmake_modules/AdbcDefines.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ if(CXX_LINKER_SUPPORTS_VERSION_SCRIPT)
endif()

# Set common build options
string(TOLOWER "${CMAKE_BUILD_TYPE}" _lower_build_type)
if("${ADBC_BUILD_WARNING_LEVEL}" STREQUAL "")
string(TOLOWER "${CMAKE_BUILD_TYPE}" _lower_build_type)
if("${_lower_build_type}" STREQUAL "release")
set(ADBC_BUILD_WARNING_LEVEL "PRODUCTION")
else()
Expand Down Expand Up @@ -92,6 +92,17 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang"
-Werror
-Wno-unused-parameter)
set(ADBC_C_CXX_FLAGS_PRODUCTION -Wall)

string(APPEND C_DEBUG_FLAGS " -Og -ggdb")
string(APPEND CXX_DEBUG_FLAGS " -Og -ggdb")
string(APPEND C_RELWITHDEBINFO_FLAGS " -Og -ggdb")
string(APPEND CXX_RELWITHDEBINFO_FLAGS " -Og -ggdb")

if("${_lower_build_type}" STREQUAL "debug" AND "${CMAKE_CXX_FLAGS}" MATCHES "-O2")
# Activate scripts for Conda compilers set CXXFLAGS etc. with -O2.
message(WARNING "This is a debug build, but your CXXFLAGS have -O2. This is common in Conda environments.\nReset your CFLAGS, CPPFLAGS, and CXXFLAGS to -Og for debugging."
)
endif()
else()
message(WARNING "Unknown compiler: ${CMAKE_CXX_COMPILER_ID}")
endif()
Expand Down

0 comments on commit 2e51ccc

Please sign in to comment.