Skip to content

Commit

Permalink
Re-add linux back compat test
Browse files Browse the repository at this point in the history
Enable building on older versions of CMake.
Add warning for Windows shared library test configuration.
  • Loading branch information
jeremy-lunarg authored and arcady-lunarg committed Dec 16, 2024
1 parent 8ad28db commit b3a6aa7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 15 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/continuous_integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ jobs:
UBSAN_OPTIONS: 'halt_on_error=1:print_stacktrace=1'
run: ctest --output-on-failure --test-dir build

# Ensure we can compile/run on an older distro
linux_min:
name: Linux Backcompat
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.7'
- uses: lukka/get-cmake@5979409e62bdf841487c5fb3c053149de97a86d3 # v3.31.2
with:
cmakeVersion: 3.17.2
- name: Setup ccache
uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14
with:
key: linux_backcompat
- run: ./update_glslang_sources.py
- name: Configure
run: cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D GLSLANG_TESTS=ON
env:
CMAKE_C_COMPILER_LAUNCHER: ccache
CMAKE_CXX_COMPILER_LAUNCHER: ccache
- name: Build
run: cmake --build build
- name: Install
run: cmake --install build --prefix build/install
- name: Test
run: ctest --output-on-failure --test-dir build

macos:
runs-on: ${{matrix.os}}
strategy:
Expand Down
24 changes: 14 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
cmake_minimum_required(VERSION 3.27)
cmake_minimum_required(VERSION 3.17.2)
project(glslang)

if (CMAKE_VERSION VERSION_LESS "3.21")
Expand Down Expand Up @@ -348,16 +348,20 @@ if(GLSLANG_TESTS)
set(REMAP_PATH ${CMAKE_CURRENT_BINARY_DIR}/StandAlone/spirv-remap)
endif()

add_test(NAME glslang-testsuite
COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} ${REMAP_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Test/)

# Prepend paths to DLLs for Windows tests.
if(WIN32)
set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:glslang-standalone>,\;>")
set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:spirv-remap>,\;>")
# The TARGET_RUNTIME_DLL_DIRS feature requires CMake 3.27 or greater.
if(WIN32 AND BUILD_SHARED_LIBS AND CMAKE_VERSION VERSION_LESS "3.27")
message(WARNING "The Windows shared library test configuration requires CMake 3.27 or greater")
else()
add_test(NAME glslang-testsuite
COMMAND bash ${IGNORE_CR_FLAG} runtests ${RESULTS_PATH} ${VALIDATOR_PATH} ${REMAP_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Test/)

# Prepend paths to shared libraries.
if (BUILD_SHARED_LIBS)
set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:glslang-standalone>,\;>")
set_tests_properties(glslang-testsuite PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:spirv-remap>,\;>")
endif()
endif()

endif(GLSLANG_TESTS)

if (GLSLANG_ENABLE_INSTALL)
Expand Down
15 changes: 10 additions & 5 deletions gtests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,17 @@ if(GLSLANG_TESTS)

target_link_libraries(glslangtests PRIVATE ${LIBRARIES} gmock)

add_test(NAME glslang-gtests
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")
# The TARGET_RUNTIME_DLL_DIRS feature requires CMake 3.27 or greater.
if(WIN32 AND BUILD_SHARED_LIBS AND CMAKE_VERSION VERSION_LESS "3.27")
message(WARNING "The Windows shared library test configuration requires CMake 3.27 or greater")
else()
add_test(NAME glslang-gtests
COMMAND glslangtests --test-root "${GLSLANG_TEST_DIRECTORY}")

# Prepend paths to DLLs for Windows tests.
if(WIN32)
set_tests_properties(glslang-gtests PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:glslangtests>,\;>")
# Prepend paths to shared libraries.
if (BUILD_SHARED_LIBS)
set_tests_properties(glslang-gtests PROPERTIES ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<JOIN:$<TARGET_RUNTIME_DLL_DIRS:glslangtests>,\;>")
endif()
endif()
endif()
endif()

0 comments on commit b3a6aa7

Please sign in to comment.