2022-03-22 11:03:15 -04:00
|
|
|
cmake_minimum_required(VERSION 3.11)
|
2023-03-09 09:23:42 -05:00
|
|
|
project(constellation LANGUAGES C)
|
2022-09-09 07:40:30 -04:00
|
|
|
set(CLI_BUILD_TAGS "" CACHE STRING "Tags passed to go build of Constellation CLI.")
|
2023-03-09 09:23:42 -05:00
|
|
|
set(BAZEL "bazel" CACHE STRING "Path to bazel binary.")
|
2022-07-11 09:19:56 -04:00
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
enable_testing()
|
|
|
|
|
2022-04-05 09:12:20 -04:00
|
|
|
#
|
2023-03-09 05:22:58 -05:00
|
|
|
# disk-mapper
|
2022-04-05 09:12:20 -04:00
|
|
|
#
|
2022-04-21 09:01:47 -04:00
|
|
|
add_custom_target(disk-mapper ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build //disk-mapper/cmd:cmd
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --output=files //disk-mapper/cmd:cmd\) ${CMAKE_BINARY_DIR}/disk-mapper
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/disk-mapper
|
2022-05-23 04:35:14 -04:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
BYPRODUCTS disk-mapper
|
2022-04-05 09:12:20 -04:00
|
|
|
)
|
|
|
|
|
2023-03-09 05:22:58 -05:00
|
|
|
#
|
|
|
|
# measurement-reader
|
|
|
|
#
|
|
|
|
add_custom_target(measurement-reader ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build //measurement-reader/cmd:cmd
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --output=files //measurement-reader/cmd:cmd\) ${CMAKE_BINARY_DIR}/measurement-reader
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/measurement-reader
|
2023-03-09 05:22:58 -05:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
BYPRODUCTS measurement-reader
|
|
|
|
)
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
#
|
2022-06-29 09:26:29 -04:00
|
|
|
# bootstrapper
|
2022-03-22 11:03:15 -04:00
|
|
|
#
|
2022-06-29 09:26:29 -04:00
|
|
|
add_custom_target(bootstrapper ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build //bootstrapper/cmd/bootstrapper:bootstrapper
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --output=files //bootstrapper/cmd/bootstrapper:bootstrapper\) ${CMAKE_BINARY_DIR}/bootstrapper
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/bootstrapper
|
2022-05-23 04:35:14 -04:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2022-06-29 09:26:29 -04:00
|
|
|
BYPRODUCTS bootstrapper
|
2022-05-23 04:35:14 -04:00
|
|
|
)
|
2022-03-22 11:03:15 -04:00
|
|
|
|
2022-12-25 12:49:45 -05:00
|
|
|
#
|
|
|
|
# upgrade-agent
|
|
|
|
#
|
|
|
|
add_custom_target(upgrade-agent ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build //upgrade-agent/cmd:cmd
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --output=files //upgrade-agent/cmd:cmd\) ${CMAKE_BINARY_DIR}/upgrade-agent
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/upgrade-agent
|
2022-12-25 12:49:45 -05:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
BYPRODUCTS upgrade-agent
|
|
|
|
)
|
|
|
|
|
2022-03-22 11:03:15 -04:00
|
|
|
#
|
|
|
|
# cli
|
|
|
|
#
|
|
|
|
add_custom_target(cli ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build --@io_bazel_rules_go//go/config:tags='${CLI_BUILD_TAGS}' --platforms=@local_config_platform//:host //cli:cli_oss
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --@io_bazel_rules_go//go/config:tags='${CLI_BUILD_TAGS}' --platforms=@local_config_platform//:host --output=files //cli:cli_oss\) ${CMAKE_BINARY_DIR}/constellation
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/constellation
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2022-05-23 04:35:14 -04:00
|
|
|
BYPRODUCTS constellation
|
|
|
|
)
|
2022-03-22 11:03:15 -04:00
|
|
|
|
2022-05-23 06:13:23 -04:00
|
|
|
#
|
|
|
|
# debugd
|
|
|
|
#
|
|
|
|
add_custom_target(debugd ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build //debugd/cmd/debugd:debugd
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --output=files //debugd/cmd/debugd:debugd\) ${CMAKE_BINARY_DIR}/debugd
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/debugd
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2022-05-23 06:13:23 -04:00
|
|
|
BYPRODUCTS debugd
|
|
|
|
)
|
|
|
|
|
|
|
|
#
|
|
|
|
# cdbg
|
|
|
|
#
|
|
|
|
add_custom_target(cdbg ALL
|
2023-03-09 09:23:42 -05:00
|
|
|
COMMAND ${BAZEL} build --platforms=@local_config_platform//:host //debugd/cmd/cdbg:cdbg
|
|
|
|
COMMAND cp \$$\(${BAZEL} cquery --platforms=@local_config_platform//:host --output=files //debugd/cmd/cdbg:cdbg\) ${CMAKE_BINARY_DIR}/cdbg
|
|
|
|
COMMAND chmod +w ${CMAKE_BINARY_DIR}/cdbg
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2022-05-23 06:13:23 -04:00
|
|
|
BYPRODUCTS cdbg
|
|
|
|
)
|
2022-03-22 11:03:15 -04:00
|
|
|
|
2022-09-12 11:37:07 -04:00
|
|
|
add_test(NAME unit COMMAND bash -c "go test -race -count=3 $(go list -f '{{.Dir}}/...' -m | xargs)" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
2022-08-08 09:50:37 -04:00
|
|
|
add_test(NAME integration-node-operator COMMAND make test WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/operators/constellation-node-operator)
|
2022-09-05 02:42:55 -04:00
|
|
|
add_test(NAME integration-csi COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/csi)
|
2022-09-08 08:45:27 -04:00
|
|
|
add_test(NAME integration-dm COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/disk-mapper/internal)
|
2022-08-17 07:50:43 -04:00
|
|
|
add_test(NAME integration-license COMMAND bash -c "go test -tags integration" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/internal/license)
|
2022-11-10 10:31:28 -05:00
|
|
|
|
|
|
|
#
|
|
|
|
# format
|
|
|
|
#
|
|
|
|
add_custom_target(format
|
2023-03-13 13:33:31 -04:00
|
|
|
COMMAND bash -c "${BAZEL} run //:tidy"
|
2022-11-10 10:31:28 -05:00
|
|
|
COMMAND bash -c "shfmt -i 2 -s -w -sr $(shfmt -f ${CMAKE_SOURCE_DIR} | grep -v helm/charts/cilium)"
|
|
|
|
COMMAND bash -c "gofumpt -l -w ${CMAKE_SOURCE_DIR}"
|
|
|
|
VERBATIM
|
|
|
|
)
|