Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

Commit 88d3e63

Browse files
committed
[CMake] Improved ComputeCpp discovery
1. Use multiple hints to find the ComputeCpp binaries 2. Removed unsupported `ComputeCpp_vs2015` 3. Updated copyright format to omit the date
1 parent 0fed859 commit 88d3e63

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

cmake/Modules/FindComputeCpp.cmake

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# FindComputeCpp
33
#---------------
44
#
5-
# Copyright 2016-2018 Codeplay Software Ltd.
5+
# Copyright Codeplay Software Ltd.
66
#
77
# Licensed under the Apache License, Version 2.0 (the "License");
88
# you may not use these files except in compliance with the License.
@@ -73,22 +73,21 @@ find_package(OpenCL REQUIRED)
7373

7474
# Find ComputeCpp package
7575

76-
if(DEFINED ComputeCpp_DIR)
77-
set(computecpp_find_hint ${ComputeCpp_DIR})
78-
elseif(DEFINED ENV{COMPUTECPP_DIR})
79-
set(computecpp_find_hint $ENV{COMPUTECPP_DIR})
80-
endif()
76+
set(computecpp_find_hint
77+
"${ComputeCpp_DIR}"
78+
"$ENV{COMPUTECPP_DIR}"
79+
)
8180

8281
# Used for running executables on the host
8382
set(computecpp_host_find_hint ${computecpp_find_hint})
8483

8584
if(CMAKE_CROSSCOMPILING)
8685
# ComputeCpp_HOST_DIR is used to find executables that are run on the host
87-
if(DEFINED ComputeCpp_HOST_DIR)
88-
set(computecpp_host_find_hint ${ComputeCpp_HOST_DIR})
89-
elseif(DEFINED ENV{COMPUTECPP_HOST_DIR})
90-
set(computecpp_host_find_hint $ENV{COMPUTECPP_HOST_DIR})
91-
endif()
86+
set(computecpp_host_find_hint
87+
"${ComputeCpp_HOST_DIR}"
88+
"$ENV{COMPUTECPP_HOST_DIR}"
89+
${computecpp_find_hint}
90+
)
9291
endif()
9392

9493
find_program(ComputeCpp_DEVICE_COMPILER_EXECUTABLE compute++
@@ -102,13 +101,17 @@ find_program(ComputeCpp_INFO_EXECUTABLE computecpp_info
102101
NO_SYSTEM_ENVIRONMENT_PATH)
103102

104103
find_library(COMPUTECPP_RUNTIME_LIBRARY
105-
NAMES ComputeCpp ComputeCpp_vs2015
104+
NAMES ComputeCpp
106105
HINTS ${computecpp_find_hint}
107106
PATH_SUFFIXES lib
108107
DOC "ComputeCpp Runtime Library")
109108

109+
# Found the library, use only single hint from now on
110+
get_filename_component(computecpp_library_path "${COMPUTECPP_RUNTIME_LIBRARY}" DIRECTORY)
111+
set(computecpp_find_hint "${computecpp_library_path}/..")
112+
110113
find_library(COMPUTECPP_RUNTIME_LIBRARY_DEBUG
111-
NAMES ComputeCpp_d ComputeCpp ComputeCpp_vs2015_d
114+
NAMES ComputeCpp_d ComputeCpp
112115
HINTS ${computecpp_find_hint}
113116
PATH_SUFFIXES lib
114117
DOC "ComputeCpp Debug Runtime Library")

0 commit comments

Comments
 (0)