Tooling - CMake - Export symbol when creating shared library on Windows#930
Tooling - CMake - Export symbol when creating shared library on Windows#930theblackunknown wants to merge 2 commits intoKhronosGroup:masterfrom theblackunknown-experiments:master
Conversation
|
Hi @Kangz can you comment? (You added the shared lib support). |
| generate_export_header(${SPIRV_TOOLS} | ||
| BASE_NAME spirv-tools) | ||
|
|
||
| ${CMAKE_CURRENT_SOURCE_DIR}/util/bitutils.h |
There was a problem hiding this comment.
.h files are important to keep in the source list so that they are shown in IDEs like visual studio.
|
|
||
| set(SPIRV_SOURCES | ||
| ${spirv-tools_SOURCE_DIR}/include/spirv-tools/libspirv.h | ||
| include(GenerateExportHeader) |
There was a problem hiding this comment.
Why not make your own export header, it is simple to do and makes the code more clear imho.
| // ignores all messages from the library. Use SetMessageConsumer() to supply | ||
| // one if messages are of concern. | ||
| explicit Optimizer(spv_target_env env); | ||
| SPIRV_TOOLS_OPT_EXPORT explicit Optimizer(spv_target_env env); |
There was a problem hiding this comment.
You can make the whole class SPIRV_TOOLS_OPT_EXPORT instead of every function individually.
There was a problem hiding this comment.
Yes, that was my recollection. (I haven't had to do this in some time...)
That is much preferred: mark an entire class rather than individual methods.
|
@dneto0 the changes are a bit more intrusive then they could if whole classes were exported and the export headers were written manually (vs. generated inside CMake). Exporting symbols / classes individually is the preferred way to do this in the Chromium style. Since this is not Chromium, the alternative is to have the following CMake code: |
|
@Kangz : Thanks for the advice/confirmation. My summary:
|
|
I totally agree on your conclusion that those changes are quite intrusive, at the cost of having finer-grained control over what should be exposed or not. I can try experimenting with those, in the meantime let me know what are your thoughts on this |
|
So NOTE Using Ninja or NMake Makefiles this problem does not show up |
|
Is this PR still valid, or can we close it? |
|
It should be closed, I fixed it in a PR that was based on this one. |
|
I am fine to have it closed, I didn't touched it in a while. |
Roll third_party/glslang/ 9db7278..f9d08a2 (6 commits) KhronosGroup/glslang@9db7278...f9d08a2 $ git log 9db7278..f9d08a2 --date=short --no-merges --format='%ad %ae %s' 2019-06-18 cepheus Bump revision. 2019-06-17 cepheus AST/SPV: Fix KhronosGroup#930: translate uvec4 <-> uint64 for SubgroupGeMask et. al. 2019-06-18 cepheus Bump revision. 2019-06-17 cepheus SPV: Add a switch for favoring non-NaN operands in min, max, and clamp. 2019-06-17 cepheus Bump revision. 2019-02-17 jbolz Add Float16/Int8/Int16 capabilities for private variables and function parameters Roll third_party/googletest/ 176eccfb8..ee32b72e1 (12 commits) google/googletest@176eccf...ee32b72 $ git log 176eccfb8..ee32b72e1 --date=short --no-merges --format='%ad %ae %s' 2019-06-18 misterg Googletest export 2019-06-17 misterg Googletest export 2019-06-17 misterg Fixing CI break by going to bazel 0.26.1 2019-06-17 misterg Revert "testing, explicitly specify compiler" 2019-06-17 absl-team Googletest export 2019-06-17 misterg Googletest export 2019-06-17 misterg revert travis.yml, irrelevant 2019-06-17 misterg bazel 0.26.1 2019-06-17 misterg bazel 0.26.1 2019-06-17 misterg testing with bazel 0.26.1 2019-06-17 misterg testing with bazel 0.26.1 2019-06-17 misterg testing, explicitly specify compiler Roll third_party/spirv-cross/ 146dc453b..05ea05509 (2 commits) KhronosGroup/SPIRV-Cross@146dc45...05ea055 $ git log 146dc453b..05ea05509 --date=short --no-merges --format='%ad %ae %s' 2019-06-18 post Make sure args.msl22 is set in test_shaders.py. 2019-06-18 post MSL: Fix path check in test_shaders.py. Roll third_party/spirv-tools/ 59983a6..001e823 (5 commits) KhronosGroup/SPIRV-Tools@59983a6...001e823 $ git log 59983a6..001e823 --date=short --no-merges --format='%ad %ae %s' 2019-06-18 afdx Add fuzzer pass to obfuscate constants. (KhronosGroup#2671) 2019-06-17 33432579+alan-baker Handle volatile memory semantics in upgrade (KhronosGroup#2674) 2019-06-17 33432579+alan-baker Validate Volatile memory semantics bit (KhronosGroup#2672) 2019-06-17 33432579+alan-baker Disallow stores to UBOs (KhronosGroup#2651) 2019-06-17 dneto Another fix uint -> uint32_t (KhronosGroup#2676) Created with: roll-dep third_party/effcee third_party/glslang third_party/googletest third_party/re2 third_party/spirv-cross third_party/spirv-headers third_party/spirv-tools
- remove useless std::move on a const std::string variable - remove redundant return at end of void function
Hello people,
Not sure if that be useful for anyone, but I am experimenting with this project and noticed that no symbols gets exported when creating a shared library on Windows.
So I modified build script and headers to select what should be exported or not.
The approach should be quite portable as I rely on CMake
GenerateExportHeadermodule.I haven*t touched travis or appveyor file to add windows shared library build to CI as I don't know what this is the recommended way to do so, but if merged it should go there to verify shared library correctly generate export symbol
Let me know what you think of it and if it worth a merge to upstream.