Add CMakeLists.txt, Update README.md

This commit is contained in:
Florian Märkl 2016-11-16 09:54:28 +01:00
parent 77d6dabace
commit 8ba9a3283c
2 changed files with 51 additions and 1 deletions

48
CMakeLists.txt Normal file
View File

@ -0,0 +1,48 @@
cmake_minimum_required(VERSION 2.8)
project(HLSLcc)
option(HLSLCC_LIBRARY_SHARED "Build shared library instead of static." ON)
set(HLSLCC_SRC
src/ControlFlowGraph.cpp
src/ControlFlowGraphUtils.cpp
src/DataTypeAnalysis.cpp
src/Declaration.cpp
src/decode.cpp
src/HLSLcc.cpp
src/HLSLccToolkit.cpp
src/HLSLCrossCompilerContext.cpp
src/Instruction.cpp
src/LoopTransform.cpp
src/Operand.cpp
src/reflect.cpp
src/Shader.cpp
src/ShaderInfo.cpp
src/toGLSL.cpp
src/toGLSLDeclaration.cpp
src/toGLSLInstruction.cpp
src/toGLSLOperand.cpp
src/toMetal.cpp
src/toMetalDeclaration.cpp
src/toMetalInstruction.cpp
src/toMetalOperand.cpp
src/UseDefineChains.cpp
src/cbstring/bsafe.c
src/cbstring/bstraux.c
src/cbstring/bstrlib.c)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_CURRENT_SOURCE_DIR}/src/internal_includes"
"${CMAKE_CURRENT_SOURCE_DIR}/src/cbstring"
"${CMAKE_CURRENT_SOURCE_DIR}/src")
if(HLSLCC_LIBRARY_SHARED)
add_library(hlslcc SHARED ${HLSLCC_SRC})
else(HLSLCC_LIBRARY_SHARED)
add_library(hlslcc STATIC ${HLSLCC_SRC})
endif(HLSLCC_LIBRARY_SHARED)
set_property(TARGET hlslcc PROPERTY CXX_STANDARD 11)

View File

@ -25,13 +25,15 @@ Changes from original HLSLCrossCompiler:
## Note
This project does not include build files, or test suite, as they are integrated into the Unity build systems. However, building this library should be fairly straightforward: just compile `src/*.cpp` (in C++11 mode!) and `src/cbstring/*.c` with the following include paths:
This project is originally integrated into the Unity build systems. However, building this library should be fairly straightforward: just compile `src/*.cpp` (in C++11 mode!) and `src/cbstring/*.c` with the following include paths:
- include
- src/internal_includes
- src/cbstrinc
- src
Alternatively, a CMakeLists.txt is provided to build the project using cmake.
The main entry point is TranslateHLSLFromMem() function in HLSLcc.cpp (taking DX bytecode as input).