Skip to content

Commit 9f8601d

Browse files
authored
Use generator expressions
Use generator expressions instead of if-else.
1 parent 1d54a59 commit 9f8601d

File tree

1 file changed

+6
-33
lines changed

1 file changed

+6
-33
lines changed

CMakeLists.txt

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,7 @@ set(PT_LIBS
163163
)
164164

165165
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
166-
if(${RHEL_BUILD})
167-
set(PT_LIBS
168-
${PT_LIBS}
169-
"libtorchvision.so"
170-
)
171-
else()
172-
set(PT_LIBS
173-
${PT_LIBS}
174-
"libtorchvision.so.1"
175-
)
176-
endif()
166+
$<IF:${RHEL_BUILD},libtorchvision.so,libtorchvision.so.1>
177167
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
178168

179169
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})
@@ -223,20 +213,9 @@ set(OPENCV_LIBS
223213
"libopencv_calib3d.so"
224214
"libopencv_flann.so"
225215
"libopencv_features2d.so"
216+
$<IF:${RHEL_BUILD},libjpeg.so.62,libjpeg.so>
217+
$<IF:${RHEL_BUILD},libpng16.so.16,libpng16.so>
226218
)
227-
if(${RHEL_BUILD})
228-
set(OPENCV_LIBS
229-
${OPENCV_LIBS}
230-
"libjpeg.so.62" # RHEL uses only .so.62 version
231-
"libpng16.so.16" # RHEL uses .so.16 version
232-
)
233-
else()
234-
set(OPENCV_LIBS
235-
${OPENCV_LIBS}
236-
"libjpeg.so"
237-
"libpng16.so"
238-
)
239-
endif()
240219

241220
# The patchelf commands ensure the MKL libraries are loaded correctly during runtime
242221
# Without these, the framework/backend complains of missing libraries / symbols and
@@ -399,15 +378,9 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
399378
set(TRITON_PYTORCH_LIBS "${CMAKE_CURRENT_BINARY_DIR}/libtorch.so")
400379

401380
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
402-
if(${RHEL_BUILD})
403-
set(TRITON_PYTORCH_LIBS
404-
${TRITON_PYTORCH_LIBS}
405-
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so")
406-
else()
407-
set(TRITON_PYTORCH_LIBS
408-
${TRITON_PYTORCH_LIBS}
409-
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so.1")
410-
endif()
381+
set(TRITON_PYTORCH_LIBS
382+
${TRITON_PYTORCH_LIBS}
383+
"${CMAKE_CURRENT_BINARY_DIR}/$<IF:${RHEL_BUILD},libtorchvision.so,libtorchvision.so.1>"
411384
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
412385

413386
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})

0 commit comments

Comments
 (0)