Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DNM] [v23.2.x] cmake tweaks for vtools trunk-based development #19886

Open
wants to merge 5 commits into
base: v23.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
cmake_minimum_required(VERSION 3.12.0)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# keep this minimal. modify `cmake/main.cmake` file instead
if(NOT VECTORIZED_CMAKE_DIR)
include(main)
else()
include(${VECTORIZED_CMAKE_DIR}/main.cmake)
# Redirect control for internal Redpanda builds
if(REDPANDA_CMAKE_DIR)
cmake_minimum_required(VERSION 3.22)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(${REDPANDA_CMAKE_DIR}/main.cmake)
return()
endif()

cmake_minimum_required(VERSION 3.24)
project(redpanda LANGUAGES CXX)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(main)
1 change: 0 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ cmake -DCMAKE_BUILD_TYPE=Release \
-GNinja \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_GO_BINARY="$go" \
"$@"

(cd "$root"/build && ninja)
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ find_package(Boost REQUIRED
iostreams
unit_test_framework)
find_package(absl REQUIRED)
find_program(GO_PROGRAM go REQUIRED)
add_subdirectory(v)
add_subdirectory(go/kreq-gen)
8 changes: 4 additions & 4 deletions src/go/kreq-gen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ set(GOPATH ${CMAKE_CURRENT_BINARY_DIR})

function(add_go_dependency NAME MAIN_SRC)
get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE)
add_custom_target(${NAME})
add_custom_command(TARGET ${NAME}
COMMAND env GOPATH=${GOPATH} ${CMAKE_GO_BINARY} build
string(REPLACE "-" "_" target_name ${NAME})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: comments with example name updates and why would be good

add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${NAME}"
COMMAND env GOPATH=${GOPATH} ${GO_PROGRAM} build
-modcacherw -o "${CMAKE_CURRENT_BINARY_DIR}/${NAME}"
${CMAKE_GO_FLAGS} ${MAIN_SRC}
${MAIN_SRC}
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
DEPENDS ${MAIN_SRC_ABS})
add_custom_target(${NAME}_all ALL DEPENDS ${NAME})
Expand Down
4 changes: 2 additions & 2 deletions tools/cmake_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ def _find_addr2lines(self):
# Workstation: find our build directory by searching back from binary
path_parts = self.binary.split("/")
try:
vbuild = "/".join(path_parts[0:path_parts.index("vbuild") + 3])
vbuild = "/".join(path_parts[0:path_parts.index("vbuild") + 5])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: It would be good to have an example path here is a comment to help future generations.

except (ValueError, IndexError):
sys.stderr.write(
f"Could not find vbuild in binary path {self.binary}\n")
return
else:
location = os.path.join(
vbuild,
"v_deps_build/seastar-prefix/src/seastar/scripts/seastar-addr2line"
"deps_build/seastar-prefix/src/seastar/scripts/seastar-addr2line"
)

if not os.path.exists(location):
Expand Down
Loading