From 0547c2a6bb2f02dd61b2fb299f3e4f97c859e435 Mon Sep 17 00:00:00 2001
From: John Kessenich <cepheus@frii.com>
Date: Wed, 19 Feb 2014 00:18:25 +0000
Subject: [PATCH] Add submitted CMake files for Linux builds.  All existing
 ways of building remain in tact.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25403 e7fa87d3-cd2b-0410-9028-fcbf551c1848
---
 BuildLinuxCMake.sh                            |  8 +++++
 CMakeLists.txt                                |  9 ++++++
 OGLCompilersDLL/CMakeLists.txt                |  6 ++++
 StandAlone/CMakeLists.txt                     | 13 +++++++++
 glslang/GenericCodeGen/CMakeLists.txt         |  7 +++++
 glslang/MachineIndependent/CMakeLists.txt     | 29 +++++++++++++++++++
 .../preprocessor/CMakeLists.txt               | 14 +++++++++
 glslang/OSDependent/Linux/CMakeLists.txt      |  6 ++++
 8 files changed, 92 insertions(+)
 create mode 100644 BuildLinuxCMake.sh
 create mode 100644 CMakeLists.txt
 create mode 100644 OGLCompilersDLL/CMakeLists.txt
 create mode 100644 StandAlone/CMakeLists.txt
 create mode 100644 glslang/GenericCodeGen/CMakeLists.txt
 create mode 100644 glslang/MachineIndependent/CMakeLists.txt
 create mode 100644 glslang/MachineIndependent/preprocessor/CMakeLists.txt
 create mode 100644 glslang/OSDependent/Linux/CMakeLists.txt

diff --git a/BuildLinuxCMake.sh b/BuildLinuxCMake.sh
new file mode 100644
index 000000000..416c91063
--- /dev/null
+++ b/BuildLinuxCMake.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+rm -rf linux_build
+mkdir linux_build
+pushd linux_build
+cmake ..
+make
+./StandAlone/glslangValidator -i ../Test/sample.vert ../Test/sample.frag
+popd
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 000000000..91c9d8a69
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,9 @@
+cmake_minimum_required(VERSION 2.8)
+
+add_subdirectory(glslang/MachineIndependent)
+add_subdirectory(glslang/MachineIndependent/preprocessor)
+add_subdirectory(glslang/GenericCodeGen)
+add_subdirectory(glslang/OSDependent/Linux)
+add_subdirectory(OGLCompilersDLL)
+add_subdirectory(StandAlone)
+
diff --git a/OGLCompilersDLL/CMakeLists.txt b/OGLCompilersDLL/CMakeLists.txt
new file mode 100644
index 000000000..e61ce7312
--- /dev/null
+++ b/OGLCompilersDLL/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8)
+
+include_directories(. ../glslang ../glslang/OSDependent/Linux)
+
+add_library(OGLCompiler STATIC  InitializeDll.cpp)
+
diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt
new file mode 100644
index 000000000..98f381658
--- /dev/null
+++ b/StandAlone/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.8)
+
+include_directories(. ../glslang/OSDependent/Linux)
+
+add_executable(glslangValidator StandAlone.cpp)
+target_link_libraries(glslangValidator
+                      glslang
+                      GenericCodeGen
+                      OSDependent
+                      Preprocessor
+                      OGLCompiler
+                      pthread)
+
diff --git a/glslang/GenericCodeGen/CMakeLists.txt b/glslang/GenericCodeGen/CMakeLists.txt
new file mode 100644
index 000000000..df4b6f67c
--- /dev/null
+++ b/glslang/GenericCodeGen/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 2.8)
+
+include_directories(. ..)
+set(SOURCES CodeGen.cpp Link.cpp)
+
+add_library(GenericCodeGen STATIC ${SOURCES}) 
+
diff --git a/glslang/MachineIndependent/CMakeLists.txt b/glslang/MachineIndependent/CMakeLists.txt
new file mode 100644
index 000000000..dfaef07ed
--- /dev/null
+++ b/glslang/MachineIndependent/CMakeLists.txt
@@ -0,0 +1,29 @@
+cmake_minimum_required(VERSION 2.8)
+
+include_directories(. ../OSDependent/Linux ../../OGLCompilersDLL ${CMAKE_CURRENT_BINARY_DIR})
+set(SOURCES
+    Constant.cpp
+    InfoSink.cpp
+    Initialize.cpp
+    IntermTraverse.cpp
+    Intermediate.cpp
+    ParseHelper.cpp
+    PoolAlloc.cpp
+    RemoveTree.cpp
+    Scan.cpp
+    ShaderLang.cpp
+    SymbolTable.cpp
+    Versions.cpp
+    intermOut.cpp
+    limits.cpp
+    linkValidate.cpp
+    parseConst.cpp
+    reflection.cpp)
+
+find_package(BISON)
+BISON_TARGET(GLSLParser glslang.y ${CMAKE_CURRENT_BINARY_DIR}/gen_glslang_tab.cpp
+             COMPILE_FLAGS
+			 "--defines=${CMAKE_CURRENT_BINARY_DIR}/glslang_tab.cpp.h")
+
+add_library(glslang STATIC ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES})
+
diff --git a/glslang/MachineIndependent/preprocessor/CMakeLists.txt b/glslang/MachineIndependent/preprocessor/CMakeLists.txt
new file mode 100644
index 000000000..c13a19eb3
--- /dev/null
+++ b/glslang/MachineIndependent/preprocessor/CMakeLists.txt
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 2.8)
+
+include_directories(. ..)
+set(SOURCES 
+    Pp.cpp
+    PpAtom.cpp
+    PpContext.cpp
+    PpMemory.cpp
+    PpScanner.cpp
+    PpSymbols.cpp
+    PpTokens.cpp)
+
+add_library(Preprocessor STATIC ${SOURCES})
+
diff --git a/glslang/OSDependent/Linux/CMakeLists.txt b/glslang/OSDependent/Linux/CMakeLists.txt
new file mode 100644
index 000000000..1542de8cf
--- /dev/null
+++ b/glslang/OSDependent/Linux/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 2.8)
+
+include_directories(. ../../../OGLCompilersDLL)
+
+add_library(OSDependent STATIC ossource.cpp)
+
-- 
GitLab