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

[workspace] Deprecate the csdp external #19894

Merged
merged 1 commit into from
Aug 2, 2023
Merged
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
7 changes: 5 additions & 2 deletions solvers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,10 @@ drake_cc_optional_library(
srcs = ["csdp_solver_error_handling.cc"],
hdrs = ["csdp_solver_error_handling.h"],
copts = ["-fvisibility=hidden"],
visibility = ["@csdp//:__pkg__"],
visibility = [
"@csdp//:__pkg__",
"@csdp_internal//:__pkg__",
],
)

drake_cc_optional_library(
Expand All @@ -1005,7 +1008,7 @@ drake_cc_optional_library(
srcs = ["csdp_cpp_wrapper.cc"],
hdrs = ["csdp_cpp_wrapper.h"],
interface_deps = [
"@csdp",
"@csdp_internal//:csdp",
],
deps = [
":csdp_solver_error_handling",
Expand Down
2 changes: 1 addition & 1 deletion tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [
"gflags",
"optitrack_driver",
]] + select({
"//conditions:default": ["@csdp//:install"],
"//conditions:default": ["@csdp_internal//:install"],
"//tools:no_csdp": [],
}) + select({
"//tools:with_gurobi": ["@gurobi//:install"],
Expand Down
11 changes: 1 addition & 10 deletions tools/workspace/csdp/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# -*- bazel -*-

load("@drake//tools/install:install.bzl", "install")

licenses(["notice"]) # EPL-2.0

package(default_visibility = ["//visibility:private"])
Expand Down Expand Up @@ -71,12 +69,5 @@ cc_library(
"@lapack",
],
visibility = ["//visibility:public"],
)

# We do not install the header file (its a private dependency), but we still
# need to install its license file.
install(
name = "install",
docs = ["LICENSE"],
visibility = ["//visibility:public"],
deprecation = "DRAKE DEPRECATED: The @csdp external is deprecated in Drake's WORKSPACE and will be removed on or after 2023-11-01.", # noqa
)
7 changes: 5 additions & 2 deletions tools/workspace/csdp/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ load("@drake//tools/workspace:github.bzl", "github_archive")
def csdp_repository(
name,
mirrors = None):
"""The @csdp external is deprecated in Drake's WORKSPACE and will be
removed on or after 2023-11-01.
"""
github_archive(
name = name,
repository = "coin-or/Csdp",
commit = "releases/6.2.0",
sha256 = "3d341974af1f8ed70e1a37cc896e7ae4a513375875e5b46db8e8f38b7680b32f", # noqa
build_file = ":package.BUILD.bazel",
patches = [
":patches/params_pathname.patch",
":patches/printlevel.patch",
"@drake//tools/workspace/csdp_internal:patches/params_pathname.patch", # noqa
"@drake//tools/workspace/csdp_internal:patches/printlevel.patch",
],
patch_cmds = [
# Move the headers into a subdirectory, so they don't pollute the
Expand Down
3 changes: 3 additions & 0 deletions tools/workspace/csdp_internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
83 changes: 83 additions & 0 deletions tools/workspace/csdp_internal/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# -*- bazel -*-

load("@drake//tools/install:install.bzl", "install")

licenses(["notice"]) # EPL-2.0

package(default_visibility = ["//visibility:private"])

cc_library(
name = "csdp",
srcs = [
"lib/Fnorm.c",
"lib/add_mat.c",
"lib/addscaledmat.c",
"lib/allocmat.c",
"lib/calc_dobj.c",
"lib/calc_pobj.c",
"lib/chol.c",
"lib/copy_mat.c",
"lib/easysdp.c",
"lib/freeprob.c",
"lib/initparams.c",
"lib/initsoln.c",
"lib/linesearch.c",
"lib/make_i.c",
"lib/makefill.c",
"lib/mat_mult.c",
"lib/mat_multsp.c",
"lib/matvec.c",
"lib/norms.c",
"lib/op_a.c",
"lib/op_at.c",
"lib/op_o.c",
"lib/packed.c",
"lib/psd_feas.c",
"lib/qreig.c",
"lib/readprob.c",
"lib/readsol.c",
"lib/sdp.c",
"lib/solvesys.c",
"lib/sortentries.c",
"lib/sym_mat.c",
"lib/trace_prod.c",
"lib/tweakgap.c",
"lib/user_exit.c",
"lib/writeprob.c",
"lib/writesol.c",
"lib/zero_mat.c",
],
hdrs = [
"includes/csdp/blockmat.h",
"includes/csdp/declarations.h",
"includes/csdp/index.h",
"includes/csdp/parameters.h",
],
copts = [
"-Wno-unknown-pragmas",
"-Wno-unused-variable",
"-fvisibility=hidden",
# CSDP calls exit() for error handling. That doesn't suit our needs for
# embedding it within Drake, so we'll redirect calls to exit() to our
# own setjmp/longjmp handler instead.
"-Dexit=drake_csdp_cpp_wrapper_exit",
# Because we use longjmp, we must forbid CSDP's OpenMP-based threads.
"-fno-openmp",
],
includes = ["includes"],
linkstatic = 1,
deps = [
"@blas",
"@drake//solvers:csdp_solver_error_handling",
"@lapack",
],
visibility = ["//visibility:public"],
)

# We do not install the header file (its a private dependency), but we still
# need to install its license file.
install(
name = "install",
docs = ["LICENSE"],
visibility = ["//visibility:public"],
)
26 changes: 26 additions & 0 deletions tools/workspace/csdp_internal/repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
load("@drake//tools/workspace:github.bzl", "github_archive")

def csdp_internal_repository(
name,
mirrors = None):
github_archive(
name = name,
repository = "coin-or/Csdp",
commit = "releases/6.2.0",
sha256 = "3d341974af1f8ed70e1a37cc896e7ae4a513375875e5b46db8e8f38b7680b32f", # noqa
build_file = ":package.BUILD.bazel",
patches = [
":patches/params_pathname.patch",
":patches/printlevel.patch",
],
patch_cmds = [
# Move the headers into a subdirectory, so they don't pollute the
# top-level include path.
"mkdir includes",
"mv include includes/csdp",
"sed -i -e 's|^#include \"|#include \"csdp/|g;' lib/*.c",
# Add include guards.
"sed -i -e $'1s/^/#pragma once\\\n/' includes/csdp/*.h",
],
mirrors = mirrors,
)
5 changes: 5 additions & 0 deletions tools/workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ load("@drake//tools/workspace/commons_io:repository.bzl", "commons_io_repository
load("@drake//tools/workspace/conex:repository.bzl", "conex_repository")
load("@drake//tools/workspace/conex_internal:repository.bzl", "conex_internal_repository") # noqa
load("@drake//tools/workspace/csdp:repository.bzl", "csdp_repository")
load("@drake//tools/workspace/csdp_internal:repository.bzl", "csdp_internal_repository") # noqa
load("@drake//tools/workspace/curl_internal:repository.bzl", "curl_internal_repository") # noqa
load("@drake//tools/workspace/double_conversion:repository.bzl", "double_conversion_repository") # noqa
load("@drake//tools/workspace/doxygen:repository.bzl", "doxygen_repository")
Expand Down Expand Up @@ -141,7 +142,11 @@ def add_default_repositories(excludes = [], mirrors = DEFAULT_MIRRORS):
if "conex_internal" not in excludes:
conex_internal_repository(name = "conex_internal", mirrors = mirrors)
if "csdp" not in excludes:
# The @csdp external is deprecated in Drake's WORKSPACE and will be
# removed on or after 2023-11-01.
csdp_repository(name = "csdp", mirrors = mirrors)
if "csdp_internal" not in excludes:
csdp_internal_repository(name = "csdp_internal", mirrors = mirrors)
if "curl_internal" not in excludes:
curl_internal_repository(name = "curl_internal", mirrors = mirrors)
if "double_conversion" not in excludes:
Expand Down