Wesley Griffin | ac39cdc | 2016-08-01 15:36:15 -0400 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 2.8.11) |
Andrew Woloszyn | db0eaf9 | 2016-05-05 14:45:53 -0400 | [diff] [blame] | 2 | set_property(GLOBAL PROPERTY USE_FOLDERS ON) |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 3 | |
Dominik Witczak | daff1a2 | 2016-09-27 09:51:34 +0200 | [diff] [blame] | 4 | option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON) |
Henrik Rydgård | 868746a | 2016-12-20 01:56:00 +0100 | [diff] [blame] | 5 | option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON) |
Rex Xu | 9d93a23 | 2016-05-05 12:30:44 +0800 | [diff] [blame] | 6 | |
chaoc | 0ad6a4e | 2016-12-19 16:29:34 -0800 | [diff] [blame] | 7 | option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON) |
| 8 | |
Alex Szpakowski | ff21a25 | 2017-01-09 18:10:14 -0400 | [diff] [blame] | 9 | option(ENABLE_HLSL "Enables HLSL input support" ON) |
Alex Szpakowski | 84eabf7 | 2017-01-08 21:20:25 -0400 | [diff] [blame] | 10 | |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 11 | enable_testing() |
| 12 | |
Chad Versace | 4cbf748 | 2015-08-31 14:27:04 -0700 | [diff] [blame] | 13 | set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix") |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 14 | |
| 15 | project(glslang) |
| 16 | |
Rex Xu | 9d93a23 | 2016-05-05 12:30:44 +0800 | [diff] [blame] | 17 | if(ENABLE_AMD_EXTENSIONS) |
| 18 | add_definitions(-DAMD_EXTENSIONS) |
| 19 | endif(ENABLE_AMD_EXTENSIONS) |
| 20 | |
chaoc | 0ad6a4e | 2016-12-19 16:29:34 -0800 | [diff] [blame] | 21 | if(ENABLE_NV_EXTENSIONS) |
| 22 | add_definitions(-DNV_EXTENSIONS) |
| 23 | endif(ENABLE_NV_EXTENSIONS) |
| 24 | |
Alex Szpakowski | ff21a25 | 2017-01-09 18:10:14 -0400 | [diff] [blame] | 25 | if(ENABLE_HLSL) |
| 26 | add_definitions(-DENABLE_HLSL) |
| 27 | endif(ENABLE_HLSL) |
Alex Szpakowski | 84eabf7 | 2017-01-08 21:20:25 -0400 | [diff] [blame] | 28 | |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 29 | if(WIN32) |
Brad Davis | 1e194e8 | 2016-05-25 13:08:34 -0700 | [diff] [blame] | 30 | set(CMAKE_DEBUG_POSTFIX "d") |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 31 | include(ChooseMSVCCRT.cmake) |
baldurk | 876a0e3 | 2015-11-16 18:03:28 +0100 | [diff] [blame] | 32 | add_definitions(-DGLSLANG_OSINCLUDE_WIN32) |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 33 | elseif(UNIX) |
| 34 | add_definitions(-fPIC) |
baldurk | 876a0e3 | 2015-11-16 18:03:28 +0100 | [diff] [blame] | 35 | add_definitions(-DGLSLANG_OSINCLUDE_UNIX) |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 36 | else(WIN32) |
Eric Engestrom | 6a6d6dd | 2016-04-03 01:17:13 +0100 | [diff] [blame] | 37 | message("unknown platform") |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 38 | endif(WIN32) |
| 39 | |
| 40 | if(CMAKE_COMPILER_IS_GNUCXX) |
LoopDawg | 6d47895 | 2016-07-18 10:11:05 -0600 | [diff] [blame] | 41 | add_definitions(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs |
| 42 | -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable) |
| 43 | add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over. |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 44 | add_definitions(-std=c++11) |
| 45 | elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") |
LoopDawg | 6d47895 | 2016-07-18 10:11:05 -0600 | [diff] [blame] | 46 | add_definitions(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs |
| 47 | -Wunused-parameter -Wunused-value -Wunused-variable) |
| 48 | add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over. |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 49 | add_definitions(-std=c++11) |
| 50 | endif() |
| 51 | |
David Neto | b37dc0e | 2016-06-02 14:37:24 -0400 | [diff] [blame] | 52 | function(glslang_set_link_args TARGET) |
| 53 | # For MinGW compiles, statically link against the GCC and C++ runtimes. |
| 54 | # This avoids the need to ship those runtimes as DLLs. |
| 55 | if(WIN32) |
| 56 | if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") |
| 57 | set_target_properties(${TARGET} PROPERTIES |
| 58 | LINK_FLAGS "-static -static-libgcc -static-libstdc++") |
| 59 | endif() |
| 60 | endif(WIN32) |
| 61 | endfunction(glslang_set_link_args) |
| 62 | |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 63 | # We depend on these for later projects, so they should come first. |
| 64 | add_subdirectory(External) |
| 65 | |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 66 | add_subdirectory(glslang) |
| 67 | add_subdirectory(OGLCompilersDLL) |
Henrik Rydgård | 868746a | 2016-12-20 01:56:00 +0100 | [diff] [blame] | 68 | if(ENABLE_GLSLANG_BINARIES) |
| 69 | add_subdirectory(StandAlone) |
| 70 | endif() |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 71 | add_subdirectory(SPIRV) |
Alex Szpakowski | ff21a25 | 2017-01-09 18:10:14 -0400 | [diff] [blame] | 72 | if(ENABLE_HLSL) |
Alex Szpakowski | 84eabf7 | 2017-01-08 21:20:25 -0400 | [diff] [blame] | 73 | add_subdirectory(hlsl) |
John Kessenich | dc1a819 | 2017-01-11 14:50:16 -0700 | [diff] [blame] | 74 | endif(ENABLE_HLSL) |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 75 | add_subdirectory(gtests) |