blob: e7b22e5ef845572e18de3e1fd02a4c1f9f0d9cf9 [file] [log] [blame]
Wesley Griffinac39cdc2016-08-01 15:36:15 -04001cmake_minimum_required(VERSION 2.8.11)
Andrew Woloszyndb0eaf92016-05-05 14:45:53 -04002set_property(GLOBAL PROPERTY USE_FOLDERS ON)
John Kessenichd49d5242015-06-26 16:29:10 -06003
Dominik Witczakdaff1a22016-09-27 09:51:34 +02004option(ENABLE_AMD_EXTENSIONS "Enables support of AMD-specific extensions" ON)
Henrik Rydgård868746a2016-12-20 01:56:00 +01005option(ENABLE_GLSLANG_BINARIES "Builds glslangValidator and spirv-remap" ON)
Rex Xu9d93a232016-05-05 12:30:44 +08006
chaoc0ad6a4e2016-12-19 16:29:34 -08007option(ENABLE_NV_EXTENSIONS "Enables support of Nvidia-specific extensions" ON)
8
Lei Zhang414eb602016-03-04 16:22:34 -05009enable_testing()
10
Chad Versace4cbf7482015-08-31 14:27:04 -070011set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
John Kessenichd49d5242015-06-26 16:29:10 -060012
13project(glslang)
14
Rex Xu9d93a232016-05-05 12:30:44 +080015if(ENABLE_AMD_EXTENSIONS)
16 add_definitions(-DAMD_EXTENSIONS)
17endif(ENABLE_AMD_EXTENSIONS)
18
chaoc0ad6a4e2016-12-19 16:29:34 -080019if(ENABLE_NV_EXTENSIONS)
20 add_definitions(-DNV_EXTENSIONS)
21endif(ENABLE_NV_EXTENSIONS)
22
John Kessenichd49d5242015-06-26 16:29:10 -060023if(WIN32)
Brad Davis1e194e82016-05-25 13:08:34 -070024 set(CMAKE_DEBUG_POSTFIX "d")
John Kessenichd49d5242015-06-26 16:29:10 -060025 include(ChooseMSVCCRT.cmake)
baldurk876a0e32015-11-16 18:03:28 +010026 add_definitions(-DGLSLANG_OSINCLUDE_WIN32)
John Kessenichd49d5242015-06-26 16:29:10 -060027elseif(UNIX)
28 add_definitions(-fPIC)
baldurk876a0e32015-11-16 18:03:28 +010029 add_definitions(-DGLSLANG_OSINCLUDE_UNIX)
John Kessenichd49d5242015-06-26 16:29:10 -060030else(WIN32)
Eric Engestrom6a6d6dd2016-04-03 01:17:13 +010031 message("unknown platform")
John Kessenichd49d5242015-06-26 16:29:10 -060032endif(WIN32)
33
34if(CMAKE_COMPILER_IS_GNUCXX)
LoopDawg6d478952016-07-18 10:11:05 -060035 add_definitions(-Wall -Wmaybe-uninitialized -Wuninitialized -Wunused -Wunused-local-typedefs
36 -Wunused-parameter -Wunused-value -Wunused-variable -Wunused-but-set-parameter -Wunused-but-set-variable)
37 add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over.
John Kessenichd49d5242015-06-26 16:29:10 -060038 add_definitions(-std=c++11)
39elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
LoopDawg6d478952016-07-18 10:11:05 -060040 add_definitions(-Wall -Wuninitialized -Wunused -Wunused-local-typedefs
41 -Wunused-parameter -Wunused-value -Wunused-variable)
42 add_definitions(-Wno-reorder) # disable this from -Wall, since it happens all over.
John Kessenichd49d5242015-06-26 16:29:10 -060043 add_definitions(-std=c++11)
44endif()
45
David Netob37dc0e2016-06-02 14:37:24 -040046function(glslang_set_link_args TARGET)
47 # For MinGW compiles, statically link against the GCC and C++ runtimes.
48 # This avoids the need to ship those runtimes as DLLs.
49 if(WIN32)
50 if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
51 set_target_properties(${TARGET} PROPERTIES
52 LINK_FLAGS "-static -static-libgcc -static-libstdc++")
53 endif()
54 endif(WIN32)
55endfunction(glslang_set_link_args)
56
Lei Zhang414eb602016-03-04 16:22:34 -050057# We depend on these for later projects, so they should come first.
58add_subdirectory(External)
59
John Kessenichd49d5242015-06-26 16:29:10 -060060add_subdirectory(glslang)
61add_subdirectory(OGLCompilersDLL)
Henrik Rydgård868746a2016-12-20 01:56:00 +010062if(ENABLE_GLSLANG_BINARIES)
63 add_subdirectory(StandAlone)
64endif()
John Kessenichd49d5242015-06-26 16:29:10 -060065add_subdirectory(SPIRV)
John Kesseniche01a9bc2016-03-12 20:11:22 -070066add_subdirectory(hlsl)
Lei Zhang414eb602016-03-04 16:22:34 -050067add_subdirectory(gtests)