|
7 | 7 | if(NOT LSB_RELEASE_ID STREQUAL "fedora")
|
8 | 8 | return()
|
9 | 9 | endif()
|
10 |
| - |
11 |
| -# glslang.pc on fedora is unusable due to leading spaces in the file. Find and |
12 |
| -# fix (which is a no-op elsewhere), then use. |
13 |
| -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/share/pkgconfig) |
14 |
| -foreach(_name IN ITEMS glslang spirv) |
15 |
| - find_file( |
16 |
| - _pc_${_name} ${_name}.pc |
17 |
| - PATHS /usr/lib64/pkgconfig /usr/lib/pkgconfig /usr/share/pkgconfig |
18 |
| - /usr/lib/x86_64-linux-gnu/pkgconfig |
19 |
| - /usr/lib64/x86_64-linux-gnu/pkgconfig) |
20 |
| - if(EXISTS ${_pc_${_name}}) |
21 |
| - execute_process( |
22 |
| - COMMAND sed "-e" "s/^ *//g" "${_pc_${_name}}" |
23 |
| - OUTPUT_FILE ${PROJECT_BINARY_DIR}/share/pkgconfig/${_name}.pc |
24 |
| - COMMAND_ERROR_IS_FATAL ANY) |
25 |
| - endif() |
26 |
| -endforeach() |
| 10 | +if(LSB_RELEASE_VERSION_ID LESS_EQUAL 38) |
| 11 | + # glslang.pc on fedora is unusable due to leading spaces in the file. Find and |
| 12 | + # fix (which is a no-op elsewhere), then use. This error seems to be fixed in |
| 13 | + # a later version of pkgconf. |
| 14 | + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/share/pkgconfig) |
| 15 | + foreach(_name IN ITEMS glslang spirv) |
| 16 | + find_file( |
| 17 | + _pc_${_name} ${_name}.pc |
| 18 | + PATHS /usr/lib64/pkgconfig /usr/lib/pkgconfig /usr/share/pkgconfig |
| 19 | + /usr/lib/x86_64-linux-gnu/pkgconfig |
| 20 | + /usr/lib64/x86_64-linux-gnu/pkgconfig) |
| 21 | + if(EXISTS ${_pc_${_name}}) |
| 22 | + execute_process( |
| 23 | + COMMAND sed "-e" "s/^ *//g" "${_pc_${_name}}" |
| 24 | + OUTPUT_FILE ${PROJECT_BINARY_DIR}/share/pkgconfig/${_name}.pc |
| 25 | + COMMAND_ERROR_IS_FATAL ANY) |
| 26 | + endif() |
| 27 | + endforeach() |
| 28 | +else() |
| 29 | + # Fedora fixed the above error in version 39, but they introduced a new one. |
| 30 | + # The version of glslang shipped in this versions no longer contains the HLSL |
| 31 | + # or OGLCompiler libraries, but those libraries are still listed in the |
| 32 | + # pkg-config file as libraries that need to be linked. |
| 33 | + # https://bugzilla.redhat.com/show_bug.cgi?id=2308904 |
| 34 | + file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/share/pkgconfig) |
| 35 | + foreach(_name IN ITEMS glslang spirv) |
| 36 | + find_file( |
| 37 | + _pc_${_name} ${_name}.pc |
| 38 | + PATHS /usr/lib64/pkgconfig /usr/lib/pkgconfig /usr/share/pkgconfig |
| 39 | + /usr/lib/x86_64-linux-gnu/pkgconfig |
| 40 | + /usr/lib64/x86_64-linux-gnu/pkgconfig) |
| 41 | + if(EXISTS ${_pc_${_name}}) |
| 42 | + execute_process( |
| 43 | + COMMAND sed "-e" "s/-lHLSL -lOGLCompiler //g" "${_pc_${_name}}" |
| 44 | + OUTPUT_FILE ${PROJECT_BINARY_DIR}/share/pkgconfig/${_name}.pc |
| 45 | + COMMAND_ERROR_IS_FATAL ANY) |
| 46 | + endif() |
| 47 | + endforeach() |
| 48 | +endif() |
0 commit comments