[BEFORE]:
% cmake ..
CMake Warning (dev) at CMakeLists.txt:35 (project):
Policy CMP0048 is not set: project() command manages VERSION variables.
Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy
command to set the policy and suppress this warning.
The following variable(s) would be set to empty:
CMAKE_PROJECT_VERSION
CMAKE_PROJECT_VERSION_MAJOR
CMAKE_PROJECT_VERSION_MINOR
CMAKE_PROJECT_VERSION_PATCH
This warning is for project developers. Use -Wno-dev to suppress it.
-- No build type selected, default to Debug
-- Found PythonInterp: /usr/local/bin/python3 (found version "3.9")
-- Found PythonInterp: /usr/local/bin/python3 (found suitable version "3.9", minimum required is "3")
-- optimizer enabled
-- Google Mock found - building tests
-- Configuring done
[AFTER]:
% cmake ..
-- No build type selected, default to Debug
-- Google Mock was not found - tests based on that will not build
-- Configuring done
-- Generating done
iOS 8 does not support `thread_local`, which is still in use.
Another approach will have to be found.
This change is a revert of the following changes:
a3845240 - "Simplify PoolAlloc with use of thread_local."
abf92c80 - "Deprecate InitializeDll functions"
33585c87 - "Limit visibility of symbols for internal libraries"
Issue: #2346
Also remove `SPIRV/doc.cpp` from the `SPVRemapper` target as this
is part of `SPIRV`, causing ODR violations. Instead have
`SPVRemapper` link against `SPIRV`.
Fixes ODR violations.
Also remove `NOTICE` from message() about PCHs - it seems to print this in the actual message, contrary to the documentation where it is used as a severity.
`${CMAKE_SOURCE_DIR}` points to the outer project root, not the current directory.
Fixes building of `glslang` when included into another CMake project.
This PR significantly reworks the way glslang is versioned.
Instead of committing changes to the `GLSLANG_MINOR_VERSION` define in
`glslang/Public/ShaderLang.h`, and using `make-revision` to generate
`GLSLANG_PATCH_LEVEL` in `glslang/Include/revision.h`, all version
information is now derived from the new `CHANGES.md` file.
`CHANGES.md` acts as the single source of truth for glslang version
information, along with a convenient place to put all release notes for
each notable change made.
`CHANGES.md` is parsed using the new `build_info.py` python script.
This script can read basic template files to produce new source files,
which it does to read the new `build_info.h.tmpl` to generate (at build
time) a glslang private header at
`<build-dir>/include/glslang/build_info.h`.
I've written generators for each of the CMake, Bazel, gn, and
`Android.mk` build scripts.
The new version code conforms to the Semantic Versioning 2.0 spec.
This new version is also used by the CMake rules to produce versioned
shared objects, including a major-versioned SONAME.
New APIs:
---------
* `glslang::GetVersion()` returns a `Version` struct with the version
major, minor, patch and flavor.
Breaking API changes:
---------------------
* The public defines `GLSLANG_MINOR_VERSION` and `GLSLANG_PATCH_LEVEL`
have been entirely removed.
* `glslang/Public/ShaderLang.h` and `glslang/Include/revision.h` have
been deleted.
* Instead, `<build-dir>/include/glslang/build_info.h` is created in
the build directory, and `<build-dir>/include` is a CMake `PUBLIC`
(dependee-inherited) include directory for the glslang targets.
* `<build-dir>/include/glslang/build_info.h` contains the following
new #defines:
`GLSLANG_VERSION_MAJOR`, `GLSLANG_VERSION_MINOR`,
`GLSLANG_VERSION_PATCH`, `GLSLANG_VERSION_FLAVOR`,
`GLSLANG_VERSION_GREATER_THAN(major, minor, patch)`,
`GLSLANG_VERSION_GREATER_OR_EQUAL_TO(major, minor, patch)`,
`GLSLANG_VERSION_LESS_THAN(major, minor, patch)`,
`GLSLANG_VERSION_LESS_OR_EQUAL_TO(major, minor, patch)`
* The CMake install output directory contains a copy of
`build_info.h` at: `include/glslang/build_info.h`
* Python3 is now always required to build glslang (likely always
required for transitive dependency builds).
`glslang_pch()` did manual mangling of the compiler flags to enable pre-compiled headers.
I couldn't get this approach to work with the `MachineIndependent` subdirectory, but fortunately CMake has added first-class support for precompiled headers in 3.16, which does work with subdirectories.
Moved `glslang_pch()` to the other global function declarations.
`glslang_pch()` is a no-op when using CMake earlier than `3.16`.
CMake's PCH implementation does not need the `pch.cpp` files, so just remove them.
On closer inspection, it appears that nearly all the targets use the `POSITION_INDEPENDENT_CODE` target option anyway.
Simplify all this away by always being PIC.
Enables `-fPIC` compiler flag even when building statically.
This is helpful for statically linking a `glslang` target into a shared library.
Simplifies the workarounds seen in google/shaderc#1093 to a `set(GLSLANG_BUILD_PIC 1)`.
Default to `-fvisibility=hidden`, and annotate the public glslang interface with `GLSLANG_EXPORT` to change the visibility of these cherry-picked symbols to default.
This is also used by Windows builds for `__declspec(dllexport)`-ing the public DLL interface.
This allows us to classify API changes into those that are publicly backwards compatible, and those that are not.
Note that `libSPIRV` will likely need similar treatment.
Issues: #2283, #1484
This should enable glslang to be used as a dependency of other projects
that target WebAssembly, instead of assuming "EMSCRIPTEN" => "Want
glslang.js".