Commit Graph

166 Commits

Author SHA1 Message Date
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
Nathaniel Cesario
c8ef4f8a9f cmake: Remove "conditions" from endif
See https://cmake.org/cmake/help/latest/command/endif.html and
https://cmake.org/cmake/help/latest/command/if.html.

If the else/endif condition does not match the if condition verbatim,
an error is produced on some versions of cmake. This change removes
these "legacy conditions."
2021-09-30 11:00:09 -06:00
Alastair Cota
48937f931a
Update CMakeLists.txt
Checked REGEX REPLACE for consistency failure
2021-08-08 17:00:26 +01:00
andrei.malashkin
0784c41300 correct ident 2021-07-30 09:12:45 +02:00
andrei.malashkin
fda1c58350 make AND to upper case 2021-07-14 09:33:02 +04:00
andrei.malashkin
22d19b963c add possibility to not override runtime of MSVC 2021-07-14 06:35:03 +04:00
okuoku
4c09598526 Set CMake policy CMP0054 to NEW to silence warning
CMAKE_SYSTEM_NAME variable might evaluate to existing variable such as
CYGWIN. This setting also matches with SPIRV-Tools.
2021-05-02 03:49:05 +09:00
Greg Fischer
7b51e234fe Fix CMakeLists.txt to keep compatibility with CMake 3.10.2 2021-04-22 16:30:17 -06:00
Evgeny Proydakov
a990b97d07 Returned using find_host_package for PythonInterp 3 instead of find_package.
I changed this logic here: 05798c17fb
It was originally fixed here: 967fa92d14
2021-02-26 14:32:38 +03:00
Evgeny Proydakov
5f7228e785 Fixed msvc 2019 nmake noexcept build.
By default cmake generates cxx_flags with /EHsc parameter.
I updated CMAKE_CXX_FLAGS string and removed /EHsc, also I added compile defenitions _HAS_EXCEPTIONS=0, it is mandatory for noexcept build with MSVC STL implementation.
Output files became smaller.

How to reproduce:

Visual Studio 2019 x64 command port

mkdir build-msvc2019
cd build-msvc2019
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=install ..
nmake

CXX FLAGS BEFORE:

-- CMAKE_C_FLAGS:   /DWIN32 /D_WINDOWS /W3
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR- /EHsc
-- CMAKE_CXX_FLAGS_DEBUG:   /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG
-- ENABLE_RTTI:       OFF
-- ENABLE_EXCEPTIONS: OFF

OUTPUT SIZE BEFORE:

Build folder size: 61,8 MB (64 808 580 bytes)

GLSLANG SIZE BEFORE:

glslang.lib 22,7 MB (23 887 150 bytes)

CXX FLAGS AFTER:

-- CMAKE_C_FLAGS:   /DWIN32 /D_WINDOWS /W3
-- CMAKE_CXX_FLAGS: /DWIN32 /D_WINDOWS /W3 /GR-
-- CMAKE_CXX_FLAGS_DEBUG:   /MDd /Zi /Ob0 /Od /RTC1
-- CMAKE_CXX_FLAGS_RELEASE: /MD /O2 /Ob2 /DNDEBUG
-- ENABLE_RTTI:       OFF
-- ENABLE_EXCEPTIONS: OFF

OUTPUT SIZE AFTER:

Build folder size: 58,4 MB (61 331 179 bytes)

GLSLANG SIZE AFTER:

glslang.lib 21,6 MB (22 655 252 bytes)
2021-02-24 11:08:57 +03:00
Evgeny Proydakov
6332f80b2d Code review. Thx greg-lunarg for comments. 2021-02-23 17:14:42 +03:00