Commit Graph

182 Commits

Author SHA1 Message Date
David Neto
c50bc49f58
Fix link flags for Clang-based MinGW cross compile (#5342)
See https://github.com/android/ndk/issues/1464

The old code tested for Windows and GCC as the compiler.
Instead of checking for GCC, check the compiler is not MSVC.
2023-07-20 10:09:23 -04:00
David Neto
883417544b
Set cmake_policy CMP0128 (#5341)
Work around a problem in CMake 3.22.1 in setting -std=c++17.
Instead -std=c++11 is in effect for targets in test/*, but
those targets require C++17.

Fixes: #5340
2023-07-19 17:47:24 -04:00
Volodymyr B
e090ce9c40
Update CMakeLists.txt (#5293) 2023-06-26 14:54:31 -04:00
Volodymyr B
c640b1934b
Update CMakeLists.txt (#5288)
add xrOS
2023-06-23 10:31:10 -04:00
Juan Ramos
a63ac9f73d
cmake: Use modern Python3 CMake support (#5277)
From the 3.27 release notes:
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.

closes #4145
2023-06-19 15:02:41 -04:00
Sruthik P
2189ad7a5a
spirv-tools: Add support for QNX (#5211)
This change updates CMakeLists.txt to support building for QNX
platforms.
2023-05-03 11:25:17 -04:00
Ralf Habacker
e0df12997f
Fix using invalid install path for cmake support files with MINGW platform (#5128) (#5129) 2023-03-03 15:53:23 +00:00
Nathan Gauër
cdc4e528f3
build: move from c++11 to c++17 (#4983)
* build: move from c++11 to c++17

Moving from cpp 11 to cpp 17 will allow us to use modern features like
filesystem support, optional, any, execution policies and improved
templates.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-01-20 15:17:34 +01:00
Juan Ramos
ae893db200
cmake: Remove old policy code (#5055) 2023-01-16 10:52:31 -05:00
David Neto
bbdd0fefda
Update minimum required CMake to 3.17.2 (#5041)
* Update minimum required CMake to 3.17.2

- For Wasm build, update to emscripten/emsdk:3.1.28 which has 3.22.1
- Move the docker-compose.yml down to the source/wasm directory.

Fixes: #5040

* Fix working directory for invocation of wasm build
2022-12-21 16:22:17 -05:00
David Neto
5d6adbdee0
Require C++11 *or later* (#5020)
Allow externally setting CMAKE_CXX_STANDARD to 14, for example,
which is needed to build protobufs
2022-12-15 21:12:53 -05:00
alan-baker
d35a78db57
Switch SPIRV-Tools to use spirv.hpp11 internally (#4981)
Fixes #4960

* Switches to using enum classes with an underlying type to avoid
  undefined behaviour
2022-11-04 17:27:10 -04:00
Nathan Gauër
b49a2caa7c
Revert "test" (#4974)
This reverts commit da215f10c9.
2022-10-27 14:17:31 +02:00
Nathan Gauër
da215f10c9 test 2022-10-26 16:42:29 +00:00
Brad Smith
5f45f793ae
Support building on OpenBSD (#4912) 2022-09-02 19:30:09 +00:00
Samuel Thibault
8eb8509834
build: cmake: Add support for GNU/Hurd (#4895) 2022-09-02 16:24:12 +00:00
Minmin Gong
8fda47ca08
Disable a codepage warning on non-English OS (#4668) 2022-01-11 16:11:06 +00:00
timlyeee
e3a373f2b7
Make cxx exceptions controllable (#4591)
* Make cxx exceptions controllable 

Found a possible link error if we compile spirv-tools by using VS2019 and link with VS2017 for another project, unresolved symbols as _CxxFrameHandler4 and __GSHandlerCheck_EH4 will be thrown. As Visual Studio updated its c++ exceptions libs.

https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/

So we are making cxx exceptions controllable via a CMake option `ENABLE_EXCEPTIONS_ON_MSVC`.
2021-10-29 14:04:59 -04:00
Alastair Donaldson
789de0dc4b
Adjust build for fuzzer targets to support OSS-Fuzz (#4498)
With OSS-Fuzz, the build system should not directly set options such as
-fsanitize=fuzzer. Instead, these are set by OSS-Fuzz, and
linker options are provided via the LIB_FUZZER_OPTIONS environment
variable. This change allows the fuzzers to be build stand-alone,
outside of OSS-Fuzz, in the way that was already supported, as well as
inside OSS-Fuzz, when the LIB_FUZZER_OPTIONS environment variable is
set.
2021-09-02 22:55:30 +00:00
Lei Zhang
702e6af380
Only add -DSPIRV_CHECK_CONTEXT for Debug builds (#4496) 2021-08-30 09:39:40 -04:00
Alastair Donaldson
3ab6fb9c03
Add CMake rules for libFuzzer targets (#4445)
Adds CMake rules for the libFuzzer targets, with a view to running
them on OSS-Fuzz.

Fixes #4448.
2021-08-05 08:11:21 +00:00
Chia-I Wu
3a68a72740
CMake: add ENABLE_RTTI option (#4382)
Fixes

 $ CXX=clang++ cmake -H. -Bout -DSPIRV_USE_SANITIZER=vptr
 $ make -C out
 ...
 clang: error: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti'
2021-07-16 16:30:04 -04:00
Assiduous
74e8105eb8
Enabled tvOS platform (#4329) 2021-06-29 15:14:38 -04:00
Ben Clayton
7403dfafd8
CMake: Add SPIRV_TOOLS_BUILD_STATIC flag (#3910)
If enabled the following targets will be created:

* `${SPIRV_TOOLS}-static` - `STATIC` library. Has full public symbol visibility.
* `${SPIRV_TOOLS}-shared` - `SHARED` library. Has default-hidden symbol visibility.
* `${SPIRV_TOOLS}`        - will alias to one of above, based on BUILD_SHARED_LIBS.

If disabled the following targets will be created:

* `${SPIRV_TOOLS}`        - either `STATIC` or `SHARED` based on the new `SPIRV_TOOLS_LIBRARY_TYPE` flag. Has full public symbol visibility.
* `${SPIRV_TOOLS}-shared` - `SHARED` library. Has default-hidden symbol visibility.

Defaults to `ON`, matching existing build behavior.

This flag can be used by package maintainers to ensure that all libraries are built as shared objects.
2020-10-29 09:25:26 -04:00
Paul Thomson
a715b1b405
Improve spirv-fuzz CMake code (#3781)
This change improves spirv-fuzz CMake code to be more compatible with other projects that might want to include spirv-fuzz as a sub-project.

* Add a CMake option for building spirv-fuzz. 
* We now check if protobuf targets are already available. 
* We no longer specify `-DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_USE_UNALIGNED=0`; a newer version of protobuf does not require this. Note that we probably should have specified this for protobuf targets as well, but this is no longer needed. 
* Updated protobuf version in Kokoro scripts and README.md.
2020-09-09 09:56:32 +01:00
Vladimir Davidovich
18ba3d9a35
allow cross compiling for Windows Store, UWP, etc. (#3330)
for more info see https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-windows-store
2020-05-19 11:43:35 -04:00
Malacath-92
d0490ef080
Fix pch macro to ignore clang-cl (#3283) 2020-04-09 14:46:08 -04:00
Danilo Spinella
03794b8f5e
Fix static libraries linking order (#3189)
Fix #1569
2020-02-20 10:54:54 -05:00
David Turner
03957e8a9f build: cmake: Add support for Fuchsia. (#3062)
This small patch adds support for the Fuchsia operating system
to the CMakeLists.txt file and source/print.cpp, the only source
file that contains platform-specific code.

This should not change the build for other platforms. To use it,
one needs a Fuchsia-specific CMake toolchain file, as in:

  mkdir build-fuchsia && cd build-fuchsia
  cmake .. -DCMAKE_TOOLCHAIN_FILE=/path/to/fuchsia-toolchain.cmake
  make -j8
2019-11-26 16:22:59 -05:00
Matt Turner
85f3e93d13 Respect CMAKE_INSTALL_LIBDIR in installed CMake files (#3054)
Fixes #3017
2019-11-22 11:02:25 -05:00
Ryan Harrison
57b4cb40b2
Convert stderr and stdout in status to strings on assignment (#3049)
This avoids Python2 vs Python3 issues related to how we decode bytes
later on in the tests.

Switching over to using unittest instead of nosetest
2019-11-18 16:35:20 -05:00
Steven Perron
cdee051e2c
Add iOS as a supported platform (#3001)
* Add iOS as a supported platform

Treating it the same as Darwin.  Fixes #2994.

* Add iOS specific macro.
2019-11-01 13:46:25 -04:00
Aaron Barany
9c0ae6bb8e Improved CMake install step. (#2963)
Added exports for libraries. External libraries that themselves use
libraries require all dependencies have exports, so not having exports can
cause major problems when used within other projects.

Install paths for exports are now placed in the proper directories expected
by Windows and *nix systems. Config files are generated as well, which
should work with CMake's find_package() function once installed.
2019-10-17 11:36:55 -04:00
Corentin Wallez
df15a4a3cb CMake: Add support for building with emscripten (#2948) 2019-10-09 11:45:11 -04:00
Ryan Harrison
370375d235
Add -fextra-semi to Clang builds (#2787)
This will catch instances on the bots where PRs introduce unneeded
semi-colons, which are going to cause downstream users problems.

Fixes #2781
2019-08-07 11:09:55 -04:00
dan sinclair
42abaa099a Remove MarkV and Stats code. (#2576)
* Remove MarkV and Stats code.

This Cl removes the MarkV and Stats code from SPIRV-Tools. This code was
unused and currently un-maintained.
2019-05-24 15:43:59 -04:00
David Neto
07ac7dee5c SPIRV-Tools requires python3 (#2510)
Updates:
- CMake configuration
- Kokoro build scripts on Linux and macos (Windows already uses Python 3.6)
2019-04-12 08:23:19 -04:00
Steven Perron
2b46521cd7 Add -fsantize to link flags. (#2506)
The option "SPIRV_USE_SANITIZER=address" does not work as stated in our
documentation because the link step fails for the tools.  We have to add
-fsanitize to the link flags so the correct libraries are added on the
link step.

Fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/2482.
2019-04-11 16:33:26 -04:00
Steven Perron
07f80c4df1
Fix python scripts to work with python3 (#2426)
Updated script to work with python3 and python2.

Added required tools.

We added a section to the readme to mention the tools that are needed to
build and test spirv-tools. For the compiler, the compilers used by the
bots are mentioned.

The bots have been changed. The windows bots will not use python 3.6 for testing. The other bots will still use python 2.7. Both Python2 and Python3 will be tested.

Fixes #2407.
Fixes #1856.
2019-03-06 14:11:01 -05:00
Steven Perron
a006cbc1d0
Non memory object as parameters. (#2415)
In relaxed addressing mode, we want to accept non memory objects
because this is a very natural translation of hlsl.  It should be fixed
by legalization by inlining the calls.
2019-02-22 12:51:22 -05:00
Baldur Karlsson
9e71de132f Add cmake option to turn off SPIRV_TIMER_ENABLED (#2103) 2018-11-23 11:47:37 -05:00
greg-lunarg
1e9fc1aac1 Add base and core bindless validation instrumentation classes (#2014)
* Add base and core bindless validation instrumentation classes

* Fix formatting.

* Few more formatting fixes

* Fix build failure

* More build fixes

* Need to call non-const functions in order.

Specifically, these are functions which call TakeNextId(). These need to
be called in a specific order to guarantee that tests which do exact
compares will work across all platforms. c++ pretty much does not
guarantee order of evaluation of operands, so any such functions need to
be called separately in individual statements to guarantee order.

* More ordering.

* And more ordering.

* And more formatting.

* Attempt to fix NDK build

* Another attempt to address NDK build problem.

* One more attempt at NDK build failure

* Add instrument.hpp to BUILD.gn

* Some name improvement in instrument.hpp

* Change all types in instrument.hpp to int.

* Improve documentation in instrument.hpp

* Format fixes

* Comment clean up in instrument.hpp

* imageInst -> image_inst

* Fix GetLabel() issue.
2018-11-08 13:54:54 -05:00
Jeff Bolz
c06a35b902 Rename PCH macro to spvtools_pch to avoid conflicts with other projects. Also add pch to test/opt. (#2034) 2018-11-07 09:15:04 -05:00
Jeff Bolz
60fac96c6b Enable precompiled headers for spirv-tools(-shared) and some unit tests (#2026) 2018-11-06 09:26:23 -05:00
Steven Perron
c5a6d259c2
Increase the template nesting depth for clang. (#1995)
We started hitting this limit, so increaseing from 256 to 1024.

Fixes #1994.
2018-10-19 11:59:01 -04:00
Steven Perron
c4c68712c4
Make EFFCEE required (#1943)
Fixes #1912.

Remove the non-effcee build as EFFCEE is now required.
2018-10-04 10:00:11 -04:00
alan-baker
a78fa0978d Set the C++ version to C++11 (#1933)
This reverts commit bfcdc913c4.
2018-09-27 09:44:01 -04:00
Diego Novillo
03000a3a38 Add testing framework for tools.
This forks the testing harness from https://github.com/google/shaderc
to allow testing CLI tools.

New features needed for SPIRV-Tools include:

1- A new PlaceHolder subclass for spirv shaders.  This place holder
   calls spirv-as to convert assembly input into SPIRV bytecode. This is
   required for most tools in SPIRV-Tools.

2- A minimal testing file for testing basic functionality of spirv-opt.

Add tests for all flags in spirv-opt.

1. Adds tests to check that known flags match the names that each pass
   advertises.
2. Adds tests to check that -O, -Os and --legalize-hlsl schedule the
   expected passes.
3. Adds more functionality to Expect classes to support regular
   expression matching on stderr.
4. Add checks for integer arguments to optimization flags.
5. Fixes #1817 by modifying the parsing of integer arguments in
   flags that take them.
6. Fixes -Oconfig file parsing (#1778). It reads every line of the file
   into a string and then parses that string by tokenizing every group of
   characters between whitespaces (using the standard cin reading
   operator).  This mimics shell command-line parsing, but it does not
   support quoting (and I'm not planning to).
2018-08-17 15:03:14 -04:00
shartte
6fea402368 When clang is used as a MSVC frontend (clang-cl.exe) it does not behave exactly as GCC would. I.e. -Wall translates to /Wall, which is an alias for -Weverything. This causes massive C++98 compat warnings logspam. (#1808) 2018-08-07 09:15:20 -04:00
dan sinclair
eda2cfbe12
Cleanup includes. (#1795)
This Cl cleans up the include paths to be relative to the top level
directory. Various include-what-you-use fixes have been added.
2018-08-03 15:06:09 -04:00