Skip to content

Commit c8762b5

Browse files
committed
improve cache runs, validate host exes
1 parent 815ceba commit c8762b5

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

tools/nsc/CMakeLists.txt

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,28 @@ add_test(NAME NBL_NSC_COMPILE_CUSTOM_CWD_TEST
3939
COMMAND_EXPAND_LISTS
4040
)
4141

42+
option(NBL_ENABLE_DOCKER_INTEGRATION "" OFF)
43+
44+
if(NBL_ENABLE_DOCKER_INTEGRATION)
45+
46+
find_program(DOCKER_EXE
47+
NAMES docker
48+
REQUIRED
49+
)
50+
51+
find_program(SPIRV_DIS_EXE
52+
NAMES spirv-dis
53+
HINTS "$ENV{VULKAN_SDK_INSTALL_DIRECTORY}/Bin"
54+
HINTS "$ENV{VK_SDK_PATH}/Bin"
55+
HINTS "$ENV{VULKAN_SDK}/Bin"
56+
REQUIRED
57+
)
58+
59+
find_program(CTEST_EXE
60+
NAMES ctest
61+
REQUIRED
62+
)
63+
4264
set(NBL_DOCKER_NSC_COMPILER_CONFIG_OUTPUT "${NBL_DOCKER_CT_NSC_VOLUME_SOURCE}/hlsl.local.properties.cmake")
4365

4466
set(NBL_DOCKER_CT_NSC_VOLUME_TARGET "C:\\nsc\\install")
@@ -86,14 +108,6 @@ compiler.nsc_debug_upstream.demangler=
86108
]=]
87109
)
88110

89-
find_program(SPIRV_DIS_EXE
90-
NAMES spirv-dis
91-
HINTS "$ENV{VULKAN_SDK_INSTALL_DIRECTORY}/Bin"
92-
HINTS "$ENV{VK_SDK_PATH}/Bin"
93-
HINTS "$ENV{VULKAN_SDK}/Bin"
94-
REQUIRED
95-
)
96-
97111
cmake_path(GET SPIRV_DIS_EXE PARENT_PATH VULKAN_SDK_BIN_DIRECTORY)
98112
cmake_path(GET SPIRV_DIS_EXE FILENAME SPIRV_DIS_EXE)
99113
set(SPIRV_DIS_EXE "C:\\vulkan\\bin\\${SPIRV_DIS_EXE}")
@@ -146,24 +160,26 @@ string(CONFIGURE "${COMPOSE_CONTENT}" COMPOSE_CONTENT @ONLY)
146160
file(WRITE "${NBL_DOCKER_CE_COMPOSE_TARGET}" "${COMPOSE_CONTENT}")
147161

148162
add_custom_target(run-compiler-explorer
149-
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --blue "Performing Pre-Test..."
150-
COMMAND ctest -C $<CONFIG> --stop-on-failure
151-
COMMAND docker compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" down
152-
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "Starting Compiler Explorer!"
153-
COMMAND docker compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" up --build -d compiler-explorer-nsc
154-
COMMAND docker compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" exec compiler-explorer-nsc cmd /c python ce_healthy_check.py --interval 10 --ticks 25
163+
COMMAND "${CMAKE_COMMAND}" -E cmake_echo_color --blue "Performing Pre-Test..."
164+
COMMAND "${CTEST_EXE}" -C $<CONFIG> --stop-on-failure
165+
COMMAND "${CMAKE_COMMAND}" -E cmake_echo_color --green "Starting Compiler Explorer!"
166+
COMMAND "${DOCKER_EXE}" compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" up --build -d compiler-explorer-nsc
167+
COMMAND "${CMAKE_COMMAND}" -E cmake_echo_color --blue "Checking health of Compiler Explorer service..."
168+
COMMAND "${DOCKER_EXE}" compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" exec compiler-explorer-nsc cmd /c python ce_healthy_check.py --interval 10 --ticks 25
155169
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "Compiler Explorer is running, type \"localhost\" in your browser!"
156170
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
157171
VERBATIM
158172
USES_TERMINAL
159173
)
160174

161175
add_custom_target(is-compiler-explorer-running
162-
COMMAND docker compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" exec compiler-explorer-nsc cmd /c python ce_healthy_check.py --ticks 1
176+
COMMAND "${DOCKER_EXE}" compose -f "${NBL_DOCKER_CE_COMPOSE_TARGET}" exec compiler-explorer-nsc cmd /c python ce_healthy_check.py --ticks 1
163177
VERBATIM
164178
USES_TERMINAL
165179
)
166180

167181
add_dependencies(run-compiler-explorer nsc)
168182
set_target_properties(run-compiler-explorer PROPERTIES FOLDER "Godbolt")
169-
set_target_properties(is-compiler-explorer-running PROPERTIES FOLDER "Godbolt")
183+
set_target_properties(is-compiler-explorer-running PROPERTIES FOLDER "Godbolt")
184+
185+
endif()

0 commit comments

Comments
 (0)