blob: 33b4764d598d8ec31fb7a0f386f4f544e79cdaf3 [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)
Rex Xu9d93a232016-05-05 12:30:44 +08005
Lei Zhang414eb602016-03-04 16:22:34 -05006enable_testing()
7
Chad Versace4cbf7482015-08-31 14:27:04 -07008set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix")
John Kessenichd49d5242015-06-26 16:29:10 -06009
10project(glslang)
11
Rex Xu9d93a232016-05-05 12:30:44 +080012if(ENABLE_AMD_EXTENSIONS)
13 add_definitions(-DAMD_EXTENSIONS)
14endif(ENABLE_AMD_EXTENSIONS)
15
John Kessenichd49d5242015-06-26 16:29:10 -060016if(WIN32)
Brad Davis1e194e82016-05-25 13:08:34 -070017 set(CMAKE_DEBUG_POSTFIX "d")
John Kessenichd49d5242015-06-26 16:29:10 -060018 include(ChooseMSVCCRT.cmake)
baldurk876a0e32015-11-16 18:03:28 +010019 add_definitions(-DGLSLANG_OSINCLUDE_WIN32)
John Kessenichd49d5242015-06-26 16:29:10 -060020elseif(UNIX)
21 add_definitions(-fPIC)
baldurk876a0e32015-11-16 18:03:28 +010022 add_definitions(-DGLSLANG_OSINCLUDE_UNIX)
John Kessenichd49d5242015-06-26 16:29:10 -060023else(WIN32)
Eric Engestrom6a6d6dd2016-04-03 01:17:13 +010024 message("unknown platform")
John Kessenichd49d5242015-06-26 16:29:10 -060025endif(WIN32)
26
27if(CMAKE_COMPILER_IS_GNUCXX)
LoopDawg6d478952016-07-18 10:11:05 -060028 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 Kessenichd49d5242015-06-26 16:29:10 -060031 add_definitions(-std=c++11)
32elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
LoopDawg6d478952016-07-18 10:11:05 -060033 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 Kessenichd49d5242015-06-26 16:29:10 -060036 add_definitions(-std=c++11)
37endif()
38
David Netob37dc0e2016-06-02 14:37:24 -040039function(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)
48endfunction(glslang_set_link_args)
49
Lei Zhang414eb602016-03-04 16:22:34 -050050# We depend on these for later projects, so they should come first.
51add_subdirectory(External)
52
John Kessenichd49d5242015-06-26 16:29:10 -060053add_subdirectory(glslang)
54add_subdirectory(OGLCompilersDLL)
55add_subdirectory(StandAlone)
56add_subdirectory(SPIRV)
John Kesseniche01a9bc2016-03-12 20:11:22 -070057add_subdirectory(hlsl)
Lei Zhang414eb602016-03-04 16:22:34 -050058add_subdirectory(gtests)