Skip to content

Commit 066a198

Browse files
committed
cmake: Simplify INSTALL_ICD logic
1 parent 6807aa5 commit 066a198

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

icd/CMakeLists.txt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO)
8989
target_compile_definitions(VkICD_mock_icd PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}")
9090
endif()
9191

92-
# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation.
93-
# Require the user to ask that it be installed if they really want it.
94-
option(INSTALL_ICD "Install icd")
95-
if (INSTALL_ICD)
96-
message(STATUS "Installing Mock ICD")
97-
endif()
98-
9992
# There are 2 primary deliverables for the mock driver.
10093
# - The actual library (lib)VkICD_mock_icd.(dll|so|dylib)
10194
# - The respective json file, VkICD_mock_icd.json
@@ -124,6 +117,15 @@ add_custom_command(TARGET VkICD_mock_icd POST_BUILD
124117
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INTERMEDIATE_FILE} $<TARGET_FILE_DIR:VkICD_mock_icd>/${OUTPUT_FILE_FINAL_NAME}
125118
)
126119

120+
# Installing the Mock ICD to system directories is probably not desired since this ICD is not a very complete implementation.
121+
# Require the user to ask that it be installed if they really want it.
122+
option(INSTALL_ICD "Install Mock icd")
123+
if (INSTALL_ICD)
124+
message(NOTICE "Installing Mock ICD")
125+
else()
126+
return()
127+
endif()
128+
127129
# For UNIX-based systems, `library_path` should not contain a relative path (indicated by "./") before installing to system directories
128130
# This json isn't used for regular local development, it's used for installation
129131
if (UNIX)
@@ -137,15 +139,11 @@ if (UNIX)
137139

138140
configure_file(${INPUT_FILE} ${UNIX_INTERMEDIATE_FILE} @ONLY)
139141

140-
if (INSTALL_ICD)
141-
install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME})
142-
endif()
142+
install(FILES ${UNIX_INTERMEDIATE_FILE} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/icd.d RENAME ${OUTPUT_FILE_FINAL_NAME})
143143
endif()
144144

145-
if (WIN32 AND INSTALL_ICD)
145+
if (WIN32)
146146
install(FILES ${INTERMEDIATE_FILE} DESTINATION ${LAYER_INSTALL_DIR} RENAME ${OUTPUT_FILE_FINAL_NAME})
147147
endif()
148148

149-
if (INSTALL_ICD)
150-
install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR})
151-
endif()
149+
install(TARGETS VkICD_mock_icd DESTINATION ${LAYER_INSTALL_DIR})

0 commit comments

Comments
 (0)