Commit Graph

176 Commits

Author SHA1 Message Date
Daniel Story
4f01996c9d Merge ancillary libraries into main glslang library and stub originals 2024-08-15 17:32:47 -04:00
Arcady Goldmints-Orlov
78e5d7976e cmake: Enable implicit fallthrough warnings for gcc and clang 2024-02-20 19:12:06 -05:00
Chris Djali
6340ba901a
Document that the only supported dependency commits are the ones in known_good.json 2024-02-19 11:26:07 -05:00
David Neto
b4a6efcda2 Allow external control of whether Glslang will be tested or installed
Expose GLSLANG__TESTS and GLSLANG_ENABLE_INSTALL as options
that can be controlled from an enclosing project, or from the
command line.

They retain the prior default behaviour. In particular, if Glslang
is not the top level project, then they default to OFF.

Fixes: #3507
2024-02-13 15:35:02 -08:00
Alexandre Bouvier
82e0d00b32 cmake: add missing SPIRV-Tools-opt dependency 2024-02-02 17:52:16 -05:00
Juan Ramos
cf1fbbff44 Only install/test if PROJECT_IS_TOP_LEVEL
Further remove installing glslangtests. There isn't a need to do
that. glslangtests isn't a deliverable.
2023-12-01 18:35:36 -05:00
Juan Ramos
3b99124593 Add GLSLANG_TESTS option
1 variable instead of ENABLE_CTEST and BUILD_TESTING.

OFF by default. See README.md for explanation.
2023-12-01 13:43:54 -05:00
Nathaniel Cesario
3f615ad93e Add BUILD_WERROR option
Adds a cmake BUILD_WERROR option to enable warnings as errors. This
option is off by default.

This change also cleans up a few more compiler warnings.
2023-11-29 17:34:53 -05:00
Juan Ramos
6be56e45e5 Remove OGLCompiler and HLSL stub libraries from build
Fixes ranlib warnings complaining about empty archive libraries.

Simplifie build/code.
2023-11-29 08:20:27 -05:00
Juan Ramos
a3069e1df4 cmake: Remove SPIRV-Tools workaround
As of KhronosGroup/SPIRV-Tools/pull/5482

SPIRV-Tools builds cleanly for Android/iOS by default
2023-11-28 19:17:51 -05:00
Juan Ramos
7c5fb5c1a8
cmake: Cleanup ENABLE_PCH
Min is 3.17 checks for 3.16 are no longer needed.
2023-11-22 16:50:04 -05:00
Juan Ramos
4c121b68c8
cmake: Remove find_host_package macro
Originally added in https://github.com/KhronosGroup/glslang/pull/2395

With the rational of causing issues when cross-compiling for iOS.

This is no longer the case.
2023-11-22 16:48:14 -05:00
Juan Ramos
1a370bede9
cmake: Remove OVERRIDE_MSVCCRT
CMake 3.15 removes the need for all of this custom code.
2023-11-22 16:44:30 -05:00
Juan Ramos
fd403737d2 Replace Darwin check with Apple check
Darwin excludes iOS
2023-11-21 19:11:24 -05:00
Juan Ramos
cd5ea90aee Fix Xcode 15 linker warning
XCode 15 includes a completely new linker implementation.
Hence some flags are deprecated.

The default is now error so we can simply remove the linker option.
2023-11-21 19:11:24 -05:00
Juan Ramos
a7b18c08d0
Add iOS build to CI
Fix iOS build as well as minor Android cleanup since the
problems for both platforms are so similar
2023-11-21 18:59:26 -05:00
Juan Ramos
5fcac839ca cmake: Cleanup usage of option
By default option is OFF
2023-11-21 18:21:00 -05:00
Arcady Goldmints-Orlov
589431af5c cmake: add more verbose messages if SPIRV-Tools is not found
This makes it more clear to users when SPIR-V optimization is disabled
because SPIRV-Tools could not be found, and suggests alternatives for
finding it.
2023-09-06 13:16:16 -04:00
Pedro Olsen Ferreira
98aa694422 [cmake] Use CMake property for symbol visibility
CMake provides a target property to set default symbol visibility which
supports different toolchains transparently.
2023-08-18 09:52:03 -06:00
Kacper Michajłow
3805888a57 Look for external SPIR-V Tools build, if not building in-tree
This allows to build with optimizer enabled, if external SPIR-V tools
libraries are available in the system. It is quite common in *nix world
to package spirv-tools and glslang separately.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2023-08-17 11:56:22 -06:00
dan sinclair
d291b15911
Remove GLSLANG_WEB and GLSLANG_WEB_DEVEL
This CL removes the GLSLANG_WEB and GLSLANG_WEB_DEVEL
cmake build options and their usage in the codebase.

Issue #2958
2023-07-28 11:49:10 -06:00
Juan Ramos
47454f5078 cmake: Raise minimum to 3.17.2
Build fails due to external dependency on SPIRV-Tools.

EX:

```
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
CMake Error at External/spirv-tools/CMakeLists.txt:15 (cmake_minimum_required):
  CMake 3.17.2 or higher is required.  You are running version 3.14.0
```
2023-07-28 08:48:09 -06:00
Nathaniel Cesario
45ce545ad3 web: Fix emscripten build
The web/emscripten build has been broken for an unknown amount of time
and for multiple reasons:
  - Calling `cat` on Windows
  - The latest version of wasm-ld does not support the `--no-undefined`
    flag
  - `ccall` was not being exported

Fixes #3272.
2023-07-20 13:59:11 -06:00
David Neto
77417d5c9e Support MinGW build with Clang, not just GCC
Fixes: #3270
2023-07-19 20:02:03 -06:00
Nathaniel Cesario
856e280502 cmake: Rename glslang to glslangValidator
Rename glslangValidator to glslang and adds a glslangValidator symlink
to the build and install directories.

Closes #47.
2023-07-18 15:23:50 -06:00
Juan Ramos
a9a2625416 cmake: Fix Android build for r25 NDK
Currently with the build instructions provided in README.md
the build will fail.

In the r25 NDK the CMake toolchain defaults to the legacy path,
due to a bug in the current implementation.

https://github.com/android/ndk/issues/323
2023-07-18 13:08:33 -06:00
Jason Liu
6a7ec4be7b Fix linking error "ld: unknown option: --no-undefined" on macOS 2023-06-19 14:32:31 -04:00
juan-lunarg
5793fbd624 cmake: Fix CMake 3.27 warnings
The FindPythonInterp and FindPythonLibs modules, which have
been deprecated since CMake 3.12, have been removed by policy
CMP0148. Port projects to FindPython3, FindPython2, or FindPython.
2023-06-16 16:12:26 -04:00
Arcady Goldmints-Orlov
14e57abf26 Enable constructor reorder warnings
They no longer happen "all over" as the comment suggests, and downstream
builds have them enabled already.
2023-05-09 14:37:10 -06:00
juan-lunarg
9743480f3c cmake: Don't set CMAKE_INSTALL_PREFIX
While trying to set a default for CMAKE_INSTALL_PREFIX sounds
appealing it has multiple issues.

It's particularly problematic for open source projects where
many users try to accomplish many different things.

It's also conflicting with the new way of installing with cmake

IE: `cmake --install build --prefix build/install`

I've already removed similar logic in various other Khronos
repositories a while ago to address similar complaints.

closes #1015
2023-05-05 10:17:32 -06:00
juan-lunarg
d6e9d3bb4e cmake: Remove USE_CCACHE
This is no longer needed with modern CMake.

I've already removed this from several Khronos repos.

See this stackoverflow for modern approaches to setting ccache via cmake:
https://stackoverflow.com/a/74120112/19739129
2023-05-05 09:11:06 -06:00
juan-lunarg
955f21aad2 cmake: Remove explicitly setting CMAKE_EXPORT_COMPILE_COMMANDS
Modern IDEs / C++ environments will just set this for you.

EX: vscode will set this for you.
2023-05-05 09:11:06 -06:00
Brad Smith
9c7fd1a33e Fix building on OpenBSD when building shared libs
OpenBSD does not link shared libs against libc so it is expected
that the use of --no-undefined when linking will fail.

Also garbage collect CMAKE_VERSION check while here, as requested, since
the minimum version is already 3.14.
2023-04-21 20:51:32 -04:00
Moritz Heinemann
1db9cd2854 Fix CMake for OSDependent install 2023-03-24 16:31:40 -04:00
Juan Ramos
ef77cf3a92 cmake: No need to set CMP0048/CMP0054
Now that the minimum is 3.14.0 setting these policies is redundant
2023-03-16 10:41:39 -06:00
Juan Ramos
43978b7c96 cmake: Remove outdated comment 2023-03-16 10:41:39 -06:00
Jeremy Hayes
0094e47972 Fix outdated cmake conditional
Remove cmake condition. The minimum is 3.14. The condition is no longer
required.

C++17 is now required. Update the landing page.
2023-03-16 10:05:58 -06:00
Greg Fischer
aae2a7ae08 Fix installation of resource limits headers
Fixes #3150
2023-03-03 15:17:03 -07:00
Amir Masoud Abdol
8504d5ae1c Replace the deprecated $<CONFIGURATION> with $<CONFIG> 2023-01-20 10:27:13 -07:00
Jeremy Hayes
dcae187376 Remove languages from cmake project statement
Fix #3088
2022-12-20 09:33:05 -07:00
Jeremy Hayes
586baa35a4 Guard AppleClang linker options
Fix #3073
2022-12-08 16:57:43 -07:00
Ralf Habacker
50ec8ae584 cmake: Use common installation directory for cmake support files.
At least on openSUSE, the usual installation location for cmake support
files is ${MAKE_INSTALL_LIBDIR}/cmake/<name>

   $ find /usr/lib64 -name '*.cmake' | grep /cmake/ | wc -l
   834
   $ find /usr/lib64 -name '*.cmake' | grep -v /cmake/ | wc -l
   8

which is also used by glslang with these changes.
2022-09-13 15:35:30 +02:00
Andrea Pappacoda
1b32fc8eb2
build: install glslang-config.cmake to libdir
As glslang ships architecture dependant files, the Config file should be
installed to libdir, not datadir. See
https://github.com/KhronosGroup/glslang/pull/2989#discussion_r955367103
for more details.

Here's the diff between the install tree before and after this patch:

    $ diff <(tree install-datadir) <(tree install)
    1c1
    < install-datadir
    ---
    > install
    74,99c74,98
    <         ├── lib
    <         │   ├── cmake
    <         │   │   ├── glslang-default-resource-limitsTargets.cmake
    <         │   │   ├── glslangTargets.cmake
    <         │   │   ├── glslangValidatorTargets.cmake
    <         │   │   ├── HLSLTargets.cmake
    <         │   │   ├── OGLCompilerTargets.cmake
    <         │   │   ├── OSDependentTargets.cmake
    <         │   │   ├── spirv-remapTargets.cmake
    <         │   │   ├── SPIRVTargets.cmake
    <         │   │   └── SPVRemapperTargets.cmake
    <         │   ├── libGenericCodeGen.a
    <         │   ├── libglslang.a
    <         │   ├── libglslang-default-resource-limits.a
    <         │   ├── libHLSL.a
    <         │   ├── libMachineIndependent.a
    <         │   ├── libOGLCompiler.a
    <         │   ├── libOSDependent.a
    <         │   ├── libSPIRV.a
    <         │   └── libSPVRemapper.a
    <         └── share
    <             └── glslang
    <                 ├── glslang-config.cmake
    <                 ├── glslang-config-version.cmake
    <                 ├── glslang-targets.cmake
    <                 └── glslang-targets-debug.cmake
    ---
    >         └── lib
    >             ├── cmake
    >             │   ├── glslang-default-resource-limitsTargets.cmake
    >             │   ├── glslangTargets.cmake
    >             │   ├── glslangValidatorTargets.cmake
    >             │   ├── HLSLTargets.cmake
    >             │   ├── OGLCompilerTargets.cmake
    >             │   ├── OSDependentTargets.cmake
    >             │   ├── spirv-remapTargets.cmake
    >             │   ├── SPIRVTargets.cmake
    >             │   └── SPVRemapperTargets.cmake
    >             ├── glslang
    >             │   ├── glslang-config.cmake
    >             │   ├── glslang-config-version.cmake
    >             │   ├── glslang-targets.cmake
    >             │   └── glslang-targets-debug.cmake
    >             ├── libGenericCodeGen.a
    >             ├── libglslang.a
    >             ├── libglslang-default-resource-limits.a
    >             ├── libHLSL.a
    >             ├── libMachineIndependent.a
    >             ├── libOGLCompiler.a
    >             ├── libOSDependent.a
    >             ├── libSPIRV.a
    >             └── libSPVRemapper.a
    101c100
    < 15 directories, 83 files
    ---
    > 14 directories, 83 files
2022-08-25 23:15:14 +02:00
Jeremy Hayes
56e19ed8ce Update cmake minimum required version 2022-08-12 10:29:31 -06:00
MACHIZAUD Andréa
fb64704060
Add unified glslang CMake config collecting glslang-targets targets (#2989) 2022-08-02 18:16:03 -06:00
Greg Fischer
25e97a5b06 Fix build for clang + mingw32-make
Fixes #2951
2022-05-25 11:02:09 -06:00
SpaceIm
de2581ed0c fix MinGW
pre compiled headers leads to "internal error in mingw32_gt_pch_use_address, at config/i386/host-mingw32.c:192: MapViewOfFileEx: Attempt to access invalid address"
2022-04-07 21:18:27 +02:00
Nicolas Morales
ab87ffe7cf #2861: If compiling with macOS and GCC, default ENABLE_PCH to false since CMake will generate incompatible Xarch flags for the precompiled headers 2022-01-11 11:41:44 +01:00
Nicolas Morales
66ac0df61b #2861: Check for macOS systems before adding "--no-undefined" to linker flags as it is not compatible with the default linker. 2022-01-11 11:41:44 +01:00
scribam
f1cc215e55 Override CMAKE_INSTALL_PREFIX only if ENABLE_GLSLANG_INSTALL is ON 2022-01-09 22:30:11 +01:00