@@ -134,6 +134,12 @@ elseif(CMAKE_CUDA_LINEINFO)
134134 set (CMAKE_CUDA_FLAGS_RELEASE "${CMAKE_CUDA_FLAGS_RELEASE} -lineinfo" )
135135endif (CMAKE_BUILD_TYPE MATCHES Debug)
136136
137+ # Undefine NDEBUG if assert mode is on
138+ if (DEFINE_ASSERT)
139+ message (STATUS "Undefining NDEBUG with assert mode enabled" )
140+ add_definitions (-UNDEBUG)
141+ endif ()
142+
137143
138144# ##################################################################################################
139145# - find CPM based dependencies ------------------------------------------------------------------
@@ -245,16 +251,49 @@ endif(BUILD_TESTS)
245251
246252# ##################################################################################################
247253# - install targets -------------------------------------------------------------------------------
254+
255+ # allows for CPack component builds and install location
256+ set (CPACK_DEB_COMPONENT_INSTALL ON )
257+ set (CPACK_COMPONENTS_ALL runtime dev)
258+ set (CPACK_PACKAGING_INSTALL_PREFIX "/usr/local" )
259+
260+ #If using cpack to create a deb package
261+ if (CPACK_GENERATOR STREQUAL "DEB" )
262+ set (_BIN_DEST "bin" )
263+ set (_LIB_DEST "lib" )
264+ set (_INCLUDE_DEST "lib/cuopt" )
265+
266+ #If building locally use the Default install paths(e.g. for local development or other package types)
267+ else ()
268+ set (_BIN_DEST "${CMAKE_INSTALL_BINDIR} " )
269+ set (_LIB_DEST "${lib_dir} " )
270+ set (_INCLUDE_DEST include /cuopt/)
271+ endif ()
272+
273+ # adds the .so files to the runtime deb package
274+ install (TARGETS cuopt mps_parser
275+ DESTINATION ${_LIB_DEST}
276+ COMPONENT runtime
277+ EXPORT cuopt-exports
278+ )
279+
280+ # adds the .so files to the development deb package
248281install (TARGETS cuopt mps_parser
249- DESTINATION ${lib_dir}
250- EXPORT cuopt-exports)
282+ DESTINATION ${_LIB_DEST}
283+ COMPONENT dev
284+ )
251285
286+ # adds the header files to the development deb package
252287install (DIRECTORY include /cuopt/
253- DESTINATION include /cuopt)
288+ DESTINATION ${_INCLUDE_DEST}
289+ COMPONENT dev
290+ )
254291
292+ # adds the version header file to the development deb package
255293install (FILES ${CMAKE_CURRENT_BINARY_DIR} /include /cuopt/version_config.hpp
256- DESTINATION include /cuopt)
257-
294+ DESTINATION ${_INCLUDE_DEST}
295+ COMPONENT dev
296+ )
258297# ###############################################################################################
259298# - install export -------------------------------------------------------------------------------
260299set (doc_string
@@ -299,8 +338,6 @@ if(Doxygen_FOUND)
299338endif ()
300339
301340
302-
303- list (APPEND CUOPT_CXX_FLAGS -g -O0)
304341add_executable (cuopt_cli cuopt_cli.cpp)
305342target_compile_options (cuopt_cli
306343 PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${CUOPT_CXX_FLAGS} >"
@@ -323,10 +360,11 @@ target_link_libraries(cuopt_cli
323360)
324361set_property (TARGET cuopt_cli PROPERTY INSTALL_RPATH "$ORIGIN/../${lib_dir} " )
325362
326- # FIXME:: Is this the right way?
363+ # adds the cuopt_cli executable to the runtime deb package
327364install (TARGETS cuopt_cli
328- DESTINATION ${CMAKE_INSTALL_BINDIR} )
329-
365+ COMPONENT runtime
366+ RUNTIME DESTINATION ${_BIN_DEST}
367+ )
330368
331369option (BUILD_BENCHMARKS "Build benchmarks" ON )
332370if (BUILD_BENCHMARKS)
@@ -341,3 +379,38 @@ if(BUILD_BENCHMARKS)
341379 OpenMP::OpenMP_CXX
342380 )
343381endif ()
382+
383+
384+ # ##################################################################################################
385+ # - CPack has to be the last item in the cmake file-------------------------------------------------
386+ # Used to create an installable deb package for cuOpt
387+
388+ set (CPACK_GENERATOR "DEB" )
389+
390+ # Runtime package metadata
391+ execute_process (COMMAND dpkg --print-architecture OUTPUT_VARIABLE DEB_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE)
392+
393+ # general package metadata
394+ set (CPACK_DEBIAN_PACKAGE_NAME "cuOpt" )
395+ set (CPACK_PACKAGE_VERSION "${PROJECT_VERSION} " )
396+ set (CPACK_DEBIAN_PACKAGE_MAINTAINER "Nvidia" )
397+ set (CPACK_PACKAGE_FILE_NAME "cuOpt_${CPACK_PACKAGE_VERSION} _${DEB_ARCH} " )
398+
399+ # runtime package metadata
400+ set (CPACK_COMPONENT_RUNTIME_DESCRIPTION "cuOpt runtime components (binaries and shared libraries)" )
401+ set (CPACK_COMPONENT_RUNTIME_DISPLAY_NAME "cuOpt Runtime" )
402+ set (CPACK_COMPONENT_RUNTIME_GROUP "Runtime" )
403+ set (CPACK_DEBIAN_RUNTIME_PACKAGE_MAINTAINER "NVIDIA" )
404+ set (CPACK_DEBIAN_RUNTIME_PACKAGE_NAME "cuopt" )
405+ set (CPACK_DEBIAN_RUNTIME_PACKAGE_FILE_NAME "cuopt_${PROJECT_VERSION} _${DEB_ARCH} " )
406+
407+ # Dev package metadata
408+ set (CPACK_COMPONENT_DEV_DESCRIPTION "cuOpt development files (headers, symlinks, etc.)" )
409+ set (CPACK_COMPONENT_DEV_DISPLAY_NAME "cuOpt Development" )
410+ set (CPACK_COMPONENT_DEV_GROUP "Development" )
411+ set (CPACK_DEBIAN_DEV_PACKAGE_MAINTAINER "NVIDIA" )
412+ set (CPACK_DEBIAN_DEV_PACKAGE_NAME "cuopt-dev" )
413+ set (CPACK_DEBIAN_DEV_PACKAGE_FILE_NAME "cuopt-dev_${PROJECT_VERSION} _${DEB_ARCH} " )
414+
415+ # MUST BE THE LAST ITEM IN THE CMAKE FILE!!!
416+ include (CPack)
0 commit comments