Skip to content

Commit

Permalink
BUILD: Help cmake to find UCC on system (#255)
Browse files Browse the repository at this point in the history
  • Loading branch information
zasdfgbnm authored Jul 14, 2021
1 parent b84590d commit 95707e1
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
if !DOCS_ONLY
SUBDIRS = \
src \
tools/info
tools/info \
cmake

if HAVE_MPICXX
SUBDIRS += \
Expand Down
11 changes: 11 additions & 0 deletions cmake/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED.
#

cmakedir = $(libdir)/cmake/ucc
cmake_DATA = \
ucc-targets.cmake \
ucc-config.cmake \
ucc-config-version.cmake

EXTRA_DIST = $(cmake_DATA)
31 changes: 31 additions & 0 deletions cmake/ucc-config-version.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED.
#

# This is a basic version file for the Config-mode of find_package().
#
# This file sets PACKAGE_VERSION_EXACT if the current version string and
# the requested version string are exactly the same and it sets
# PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version.

set(PACKAGE_VERSION @VERSION@)

if (PACKAGE_FIND_VERSION_RANGE)
# Package version must be in the requested version range
if ((PACKAGE_FIND_VERSION_RANGE_MIN STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MIN)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_GREATER PACKAGE_FIND_VERSION_MAX)
OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_GREATER_EQUAL PACKAGE_FIND_VERSION_MAX))
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
endif()
else()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
endif()
8 changes: 8 additions & 0 deletions cmake/ucc-config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED.
#

set(UCC_LIBRARIES "@prefix@/lib")
set(UCC_INCLUDE_DIRS "@prefix@/include")

include("${CMAKE_CURRENT_LIST_DIR}/ucc-targets.cmake")
10 changes: 10 additions & 0 deletions cmake/ucc-targets.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (C) NVIDIA Corporation. 2021. ALL RIGHTS RESERVED.
#

add_library(ucc::ucc SHARED IMPORTED)

set_target_properties(ucc::ucc PROPERTIES
IMPORTED_LOCATION "@prefix@/lib/libucc.so"
INTERFACE_INCLUDE_DIRECTORIES "@prefix@/include"
)
4 changes: 4 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,10 @@ AC_CONFIG_FILES([
test/mpi/Makefile
tools/info/Makefile
tools/perf/Makefile
cmake/Makefile
cmake/ucc-config-version.cmake
cmake/ucc-config.cmake
cmake/ucc-targets.cmake
])
AC_OUTPUT

Expand Down

0 comments on commit 95707e1

Please sign in to comment.