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) |
Rex Xu | 9d93a23 | 2016-05-05 12:30:44 +0800 | [diff] [blame] | 5 | |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 6 | enable_testing() |
| 7 | |
Chad Versace | 4cbf748 | 2015-08-31 14:27:04 -0700 | [diff] [blame] | 8 | set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix") |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 9 | |
| 10 | project(glslang) |
| 11 | |
Rex Xu | 9d93a23 | 2016-05-05 12:30:44 +0800 | [diff] [blame] | 12 | if(ENABLE_AMD_EXTENSIONS) |
| 13 | add_definitions(-DAMD_EXTENSIONS) |
| 14 | endif(ENABLE_AMD_EXTENSIONS) |
| 15 | |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 16 | if(WIN32) |
Brad Davis | 1e194e8 | 2016-05-25 13:08:34 -0700 | [diff] [blame] | 17 | set(CMAKE_DEBUG_POSTFIX "d") |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 18 | include(ChooseMSVCCRT.cmake) |
baldurk | 876a0e3 | 2015-11-16 18:03:28 +0100 | [diff] [blame] | 19 | add_definitions(-DGLSLANG_OSINCLUDE_WIN32) |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 20 | elseif(UNIX) |
| 21 | add_definitions(-fPIC) |
baldurk | 876a0e3 | 2015-11-16 18:03:28 +0100 | [diff] [blame] | 22 | add_definitions(-DGLSLANG_OSINCLUDE_UNIX) |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 23 | else(WIN32) |
Eric Engestrom | 6a6d6dd | 2016-04-03 01:17:13 +0100 | [diff] [blame] | 24 | message("unknown platform") |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 25 | endif(WIN32) |
| 26 | |
| 27 | if(CMAKE_COMPILER_IS_GNUCXX) |
LoopDawg | 6d47895 | 2016-07-18 10:11:05 -0600 | [diff] [blame] | 28 | add_definitions(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs |
| 29 | -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable) |
| 30 | 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] | 31 | add_definitions(-std=c++11) |
| 32 | elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") |
LoopDawg | 6d47895 | 2016-07-18 10:11:05 -0600 | [diff] [blame] | 33 | add_definitions(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs |
| 34 | -Wunused-parameter -Wunused-value -Wunused-variable) |
| 35 | 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] | 36 | add_definitions(-std=c++11) |
| 37 | endif() |
| 38 | |
David Neto | b37dc0e | 2016-06-02 14:37:24 -0400 | [diff] [blame] | 39 | function(glslang_set_link_args TARGET) |
| 40 | # For MinGW compiles, statically link against the GCC and C++ runtimes. |
| 41 | # This avoids the need to ship those runtimes as DLLs. |
| 42 | if(WIN32) |
| 43 | if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU") |
| 44 | set_target_properties(${TARGET} PROPERTIES |
| 45 | LINK_FLAGS "-static -static-libgcc -static-libstdc++") |
| 46 | endif() |
| 47 | endif(WIN32) |
| 48 | endfunction(glslang_set_link_args) |
| 49 | |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 50 | # We depend on these for later projects, so they should come first. |
| 51 | add_subdirectory(External) |
| 52 | |
John Kessenich | d49d524 | 2015-06-26 16:29:10 -0600 | [diff] [blame] | 53 | add_subdirectory(glslang) |
| 54 | add_subdirectory(OGLCompilersDLL) |
| 55 | add_subdirectory(StandAlone) |
| 56 | add_subdirectory(SPIRV) |
John Kessenich | e01a9bc | 2016-03-12 20:11:22 -0700 | [diff] [blame] | 57 | add_subdirectory(hlsl) |
Lei Zhang | 414eb60 | 2016-03-04 16:22:34 -0500 | [diff] [blame] | 58 | add_subdirectory(gtests) |