Skip to content

Commit 23b712f

Browse files
Merge branch 'branch-25.08' into cvxpyunit
2 parents a8b9323 + 455bdb0 commit 23b712f

File tree

4 files changed

+104
-12
lines changed

4 files changed

+104
-12
lines changed

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ cd $CUOPT_HOME
143143
./build.sh --help
144144
```
145145

146+
#### Deb package
147+
148+
`libcuopt.so` can be packaged as a deb package with option deb. This is a beta-feature and dependecies of libcuopt needs to be installed manually while installing it using deb package.
149+
This is only available to be built through source code and libcuopt is not being released as deb package in any official space.
150+
151+
```bash
152+
./build.sh libmps_parser libcuopt deb
153+
```
154+
146155
#### Building for development
147156

148157
To build all libraries and tests, simply run

build.sh

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ REPODIR=$(cd "$(dirname "$0")"; pwd)
2727
LIBCUOPT_BUILD_DIR=${LIBCUOPT_BUILD_DIR:=${REPODIR}/cpp/build}
2828
LIBMPS_PARSER_BUILD_DIR=${LIBMPS_PARSER_BUILD_DIR:=${REPODIR}/cpp/libmps_parser/build}
2929

30-
VALIDARGS="clean libcuopt libmps_parser cuopt_mps_parser cuopt cuopt_server cuopt_sh_client docs -a -b -g -v -l= --verbose-pdlp [--cmake-args=\\\"<args>\\\"] [--cache-tool=<tool>] -n --allgpuarch --ci-only-arch --show_depr_warn -h --help"
30+
VALIDARGS="clean libcuopt libmps_parser cuopt_mps_parser cuopt cuopt_server cuopt_sh_client docs deb -a -b -g -v -l= --verbose-pdlp [--cmake-args=\\\"<args>\\\"] [--cache-tool=<tool>] -n --allgpuarch --ci-only-arch --show_depr_warn -h --help"
3131
HELP="$0 [<target> ...] [<flag> ...]
3232
where <target> is:
3333
clean - remove all existing build artifacts and configuration (start over)
@@ -38,6 +38,7 @@ HELP="$0 [<target> ...] [<flag> ...]
3838
cuopt_server - build the cuopt_server Python package
3939
cuopt_sh_client - build cuopt self host client
4040
docs - build the docs
41+
deb - build deb package (requires libcuopt to be built first)
4142
and <flag> is:
4243
-v - verbose build mode
4344
-g - build for debug
@@ -316,6 +317,21 @@ if buildAll || hasArg libcuopt; then
316317
fi
317318
fi
318319

320+
################################################################################
321+
# Build deb package
322+
if hasArg deb; then
323+
# Check if libcuopt has been built
324+
if [ ! -d "${LIBCUOPT_BUILD_DIR}" ]; then
325+
echo "Error: libcuopt must be built before creating deb package. Run with 'libcuopt' target first."
326+
exit 1
327+
fi
328+
329+
echo "Building deb package..."
330+
cd "${LIBCUOPT_BUILD_DIR}"
331+
cpack -G DEB
332+
echo "Deb package created in ${LIBCUOPT_BUILD_DIR}"
333+
fi
334+
319335

320336
# Build and install the cuopt Python package
321337
if buildAll || hasArg cuopt; then

conda/recipes/libcuopt/recipe.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ cache:
2929
export CXXFLAGS=$(echo $CXXFLAGS | sed -E 's@\-fdebug\-prefix\-map[^ ]*@@g')
3030
set +x
3131
32-
./build.sh -n -v -a libmps_parser libcuopt --ci-only-arch --cmake-args=\"-DCMAKE_INSTALL_LIBDIR=lib\"
32+
./build.sh -n -v -a libmps_parser libcuopt deb --allgpuarch --cmake-args=\"-DCMAKE_INSTALL_LIBDIR=lib\"
3333
secrets:
3434
- AWS_ACCESS_KEY_ID
3535
- AWS_SECRET_ACCESS_KEY

cpp/CMakeLists.txt

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,49 @@ endif(BUILD_TESTS)
245245

246246
# ##################################################################################################
247247
# - install targets -------------------------------------------------------------------------------
248+
249+
# allows for CPack component builds and install location
250+
set(CPACK_DEB_COMPONENT_INSTALL ON)
251+
set(CPACK_COMPONENTS_ALL runtime dev)
252+
set(CPACK_PACKAGING_INSTALL_PREFIX "/usr/local")
253+
254+
#If using cpack to create a deb package
255+
if(CPACK_GENERATOR STREQUAL "DEB")
256+
set(_BIN_DEST "bin")
257+
set(_LIB_DEST "lib")
258+
set(_INCLUDE_DEST "lib/cuopt")
259+
260+
#If building locally use the Default install paths(e.g. for local development or other package types)
261+
else()
262+
set(_BIN_DEST "${CMAKE_INSTALL_BINDIR}")
263+
set(_LIB_DEST "${lib_dir}")
264+
set(_INCLUDE_DEST include/cuopt/)
265+
endif()
266+
267+
# adds the .so files to the runtime deb package
248268
install(TARGETS cuopt mps_parser
249-
DESTINATION ${lib_dir}
250-
EXPORT cuopt-exports)
269+
DESTINATION ${_LIB_DEST}
270+
COMPONENT runtime
271+
EXPORT cuopt-exports
272+
)
273+
274+
# adds the .so files to the development deb package
275+
install(TARGETS cuopt mps_parser
276+
DESTINATION ${_LIB_DEST}
277+
COMPONENT dev
278+
)
251279

280+
# adds the header files to the development deb package
252281
install(DIRECTORY include/cuopt/
253-
DESTINATION include/cuopt)
282+
DESTINATION ${_INCLUDE_DEST}
283+
COMPONENT dev
284+
)
254285

286+
# adds the version header file to the development deb package
255287
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/cuopt/version_config.hpp
256-
DESTINATION include/cuopt)
257-
288+
DESTINATION ${_INCLUDE_DEST}
289+
COMPONENT dev
290+
)
258291
# ###############################################################################################
259292
# - install export -------------------------------------------------------------------------------
260293
set(doc_string
@@ -299,8 +332,6 @@ if(Doxygen_FOUND)
299332
endif()
300333

301334

302-
303-
list(APPEND CUOPT_CXX_FLAGS -g -O0)
304335
add_executable(cuopt_cli cuopt_cli.cpp)
305336
target_compile_options(cuopt_cli
306337
PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS}>"
@@ -323,10 +354,11 @@ target_link_libraries(cuopt_cli
323354
)
324355
set_property(TARGET cuopt_cli PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir}")
325356

326-
# FIXME:: Is this the right way?
357+
# adds the cuopt_cli executable to the runtime deb package
327358
install(TARGETS cuopt_cli
328-
DESTINATION ${CMAKE_INSTALL_BINDIR})
329-
359+
COMPONENT runtime
360+
RUNTIME DESTINATION ${_BIN_DEST}
361+
)
330362

331363
option(BUILD_BENCHMARKS "Build benchmarks" ON)
332364
if(BUILD_BENCHMARKS)
@@ -341,3 +373,38 @@ if(BUILD_BENCHMARKS)
341373
OpenMP::OpenMP_CXX
342374
)
343375
endif()
376+
377+
378+
# ##################################################################################################
379+
# - CPack has to be the last item in the cmake file-------------------------------------------------
380+
# Used to create an installable deb package for cuOpt
381+
382+
set(CPACK_GENERATOR "DEB")
383+
384+
# Runtime package metadata
385+
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE DEB_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
386+
387+
# general package metadata
388+
set(CPACK_DEBIAN_PACKAGE_NAME "cuOpt")
389+
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
390+
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nvidia")
391+
set(CPACK_PACKAGE_FILE_NAME "cuOpt_${CPACK_PACKAGE_VERSION}_${DEB_ARCH}")
392+
393+
# runtime package metadata
394+
set(CPACK_COMPONENT_RUNTIME_DESCRIPTION "cuOpt runtime components (binaries and shared libraries)")
395+
set(CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "cuOpt Runtime")
396+
set(CPACK_COMPONENT_RUNTIME_GROUP "Runtime")
397+
set(CPACK_DEBIAN_RUNTIME_PACKAGE_MAINTAINER "NVIDIA")
398+
set(CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "cuopt")
399+
set(CPACK_DEBIAN_RUNTIME_PACKAGE_FILE_NAME "cuopt_${PROJECT_VERSION}_${DEB_ARCH}")
400+
401+
# Dev package metadata
402+
set(CPACK_COMPONENT_DEV_DESCRIPTION "cuOpt development files (headers, symlinks, etc.)")
403+
set(CPACK_COMPONENT_DEV_DISPLAY_NAME "cuOpt Development")
404+
set(CPACK_COMPONENT_DEV_GROUP "Development")
405+
set(CPACK_DEBIAN_DEV_PACKAGE_MAINTAINER "NVIDIA")
406+
set(CPACK_DEBIAN_DEV_PACKAGE_NAME "cuopt-dev")
407+
set(CPACK_DEBIAN_DEV_PACKAGE_FILE_NAME "cuopt-dev_${PROJECT_VERSION}_${DEB_ARCH}")
408+
409+
# MUST BE THE LAST ITEM IN THE CMAKE FILE!!!
410+
include(CPack)

0 commit comments

Comments
 (0)