1 cmake_minimum_required(VERSION 2.8)
3 project(SwiftShader C CXX)
5 set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build: Debug Release RelWithDebInfo." )
7 option(BUILD_EGL "Build the EGL library" 1)
9 option(BUILD_GL32 "Build the OpenGL32 library" 1)
11 option(BUILD_GLESv2 "Build the OpenGL ES 2 library" 1)
12 option(BUILD_GLES_CM "Build the OpenGL ES 1.1 library" 1)
14 option(USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" 1)
16 option(BUILD_SAMPLES "Build sample programs" 1)
18 set(REACTOR_BACKEND "LLVM" CACHE STRING "JIT compiler back-end used by Reactor")
19 set_property(CACHE REACTOR_BACKEND PROPERTY STRINGS LLVM Subzero)
21 # LLVM disallows calling cmake . from the main LLVM dir, the reason is that
22 # it builds header files that could overwrite the orignal ones. Here we
23 # want to include LLVM as a subdirectory and even though it wouldn't cause
24 # the problem, if cmake . is called from the main dir, the condition that
25 # LLVM checkes, "CMAKE_SOURCE_DIR == CMAKE_BINARY_DIR" will be true. So we
26 # disallow it ourselves too to. In addition if there are remining CMakeFiles
27 # and CMakeCache in the directory, cmake .. from a subdirectory will still
28 # try to build from the main directory so we instruct users to delete these
29 # files when they get the error.
30 if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
31 message(FATAL_ERROR "In source builds are not allowed by LLVM, please create a build/ directory and build from there. You may have to delete the CMakeCache.txt file and CMakeFiles directory that are next to the CMakeLists.txt.")
34 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
36 ###########################################################
38 ###########################################################
40 if(CMAKE_SYSTEM_NAME MATCHES "Linux")
45 message(FATAL_ERROR "Platform is not supported")
48 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
54 ###########################################################
56 ###########################################################
58 # Recursively calls source_group on the files of the directory
59 # so that Visual Studio has the files in a folder tree
60 macro(group_all_sources directory)
61 file(GLOB files RELATIVE ${CMAKE_SOURCE_DIR}/${directory} ${CMAKE_SOURCE_DIR}/${directory}/*)
62 foreach(file ${files})
63 if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/${directory}/${file})
64 group_all_sources(${directory}/${file})
66 string(REPLACE "/" "\\" groupname ${directory})
67 source_group(${groupname} FILES ${CMAKE_SOURCE_DIR}/${directory}/${file})
72 # Takes target library and a directory where the export map is
73 # and add the linker options so that only the API symbols are
75 macro(set_target_export_map TARGET DIR)
76 get_target_property(LINKFLAGS ${TARGET} LINK_FLAGS)
77 if(LINKFLAGS MATCHES "NOTFOUND")
81 set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "/DEF:\"${DIR}/${TARGET}.def\"")
83 # Both hash-style are needed, because we want both gold and
84 # GNU ld to be able to read our libraries (maybe?).
85 # The version script only exports the API functions and
86 # hides all the others. Gc sections is used in combination
87 # with each functions being in its section, to reduce the
89 set_target_properties(${TARGET} PROPERTIES LINK_FLAGS "${LINKFLAGS} -Wl,--hash-style=both,--version-script=${DIR}/exports.map,--gc-sections,--no-undefined")
94 group_all_sources(src)
97 ###########################################################
99 ###########################################################
101 set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
102 set(OPENGL_DIR ${SOURCE_DIR}/OpenGL)
103 set(OPENGL_COMPILER_DIR ${OPENGL_DIR}/compiler)
104 set(LLVM_DIR ${CMAKE_SOURCE_DIR}/third_party/LLVM)
105 set(SUBZERO_DIR ${CMAKE_SOURCE_DIR}/third_party/pnacl-subzero)
106 set(SUBZERO_LLVM_DIR ${CMAKE_SOURCE_DIR}/third_party/llvm-subzero)
107 set(TESTS_DIR ${CMAKE_SOURCE_DIR}/tests)
108 set(HELLO2_DIR ${CMAKE_SOURCE_DIR}/third_party/PowerVR_SDK/Examples/Beginner/01_HelloAPI/OGLES2)
110 ###########################################################
112 ###########################################################
114 macro(set_cpp_flag FLAG)
115 if(${ARGC} GREATER 1)
116 set(CMAKE_CXX_FLAGS_${ARGV1} "${CMAKE_CXX_FLAGS_${ARGV1}} ${FLAG}")
118 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
124 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
126 set_cpp_flag("--std=c++11")
127 set_cpp_flag("-Wall")
128 set_cpp_flag("-fexceptions")
130 # Don't allow symbols to be overridden by another module.
131 # This enables libGLES_CM and libGLESv2 to statically link LLVM.
132 set_cpp_flag("-fvisibility=protected")
134 # Remove xor, and, or and friends from the list of keywords, they are used
136 set_cpp_flag("-fno-operator-names")
138 # LLVM headers requires these flags to be set
139 set_cpp_flag("-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS")
143 set_cpp_flag("-msse2")
144 set_cpp_flag("-march=i686")
146 if(ARCH EQUAL "x86_64")
148 set_cpp_flag("-fPIC")
149 set_cpp_flag("-march=core2")
152 # Use -g3 to have even more debug info
153 set_cpp_flag("-g -g3" DEBUG)
154 set_cpp_flag("-g -g3" RELWITHDEBINFO)
155 set_cpp_flag("-s" RELEASE)
157 # For distribution it is more important to be slim than super optimized
158 # so even in Release we use only -O2
159 set_cpp_flag("-O2 -Os" RELEASE)
160 set_cpp_flag("-O2 -Os" RELWITHDEBINFO)
162 set_cpp_flag("-DNDEBUG" RELEASE)
163 set_cpp_flag("-DNDEBUG" RELWITHDEBINFO)
164 set_cpp_flag("-DANGLE_DISABLE_TRACE" RELEASE)
165 set_cpp_flag("-DANGLE_DISABLE_TRACE" RELWITHDEBINFO)
167 # Put each variable and function in its own section so that when linking
168 # with -gc-sections unused functions and variables are removed.
169 set_cpp_flag("-ffunction-sections" RELEASE)
170 set_cpp_flag("-fdata-sections" RELEASE)
171 set_cpp_flag("-fomit-frame-pointer" RELEASE)
175 add_definitions(-DWINVER=0x501 -DNOMINMAX -DSTRICT)
176 set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "" "lib")
180 ###########################################################
182 ###########################################################
185 ${LLVM_DIR}/lib/Analysis/AliasAnalysis.cpp
186 ${LLVM_DIR}/lib/Analysis/AliasSetTracker.cpp
187 ${LLVM_DIR}/lib/Analysis/BasicAliasAnalysis.cpp
188 ${LLVM_DIR}/lib/Analysis/BranchProbabilityInfo.cpp
189 ${LLVM_DIR}/lib/Analysis/CaptureTracking.cpp
190 ${LLVM_DIR}/lib/Analysis/ConstantFolding.cpp
191 ${LLVM_DIR}/lib/Analysis/DIBuilder.cpp
192 ${LLVM_DIR}/lib/Analysis/DebugInfo.cpp
193 ${LLVM_DIR}/lib/Analysis/IVUsers.cpp
194 ${LLVM_DIR}/lib/Analysis/InstructionSimplify.cpp
195 ${LLVM_DIR}/lib/Analysis/Loads.cpp
196 ${LLVM_DIR}/lib/Analysis/LoopInfo.cpp
197 ${LLVM_DIR}/lib/Analysis/LoopPass.cpp
198 ${LLVM_DIR}/lib/Analysis/MemoryBuiltins.cpp
199 ${LLVM_DIR}/lib/Analysis/MemoryDependenceAnalysis.cpp
200 ${LLVM_DIR}/lib/Analysis/NoAliasAnalysis.cpp
201 ${LLVM_DIR}/lib/Analysis/PHITransAddr.cpp
202 ${LLVM_DIR}/lib/Analysis/PathNumbering.cpp
203 ${LLVM_DIR}/lib/Analysis/ProfileInfo.cpp
204 ${LLVM_DIR}/lib/Analysis/ScalarEvolution.cpp
205 ${LLVM_DIR}/lib/Analysis/ScalarEvolutionExpander.cpp
206 ${LLVM_DIR}/lib/Analysis/ScalarEvolutionNormalization.cpp
207 ${LLVM_DIR}/lib/Analysis/TypeBasedAliasAnalysis.cpp
208 ${LLVM_DIR}/lib/Analysis/ValueTracking.cpp
209 ${LLVM_DIR}/lib/CodeGen/AggressiveAntiDepBreaker.cpp
210 ${LLVM_DIR}/lib/CodeGen/AllocationOrder.cpp
211 ${LLVM_DIR}/lib/CodeGen/Analysis.cpp
212 ${LLVM_DIR}/lib/CodeGen/BranchFolding.cpp
213 ${LLVM_DIR}/lib/CodeGen/CalcSpillWeights.cpp
214 ${LLVM_DIR}/lib/CodeGen/CallingConvLower.cpp
215 ${LLVM_DIR}/lib/CodeGen/CodePlacementOpt.cpp
216 ${LLVM_DIR}/lib/CodeGen/CriticalAntiDepBreaker.cpp
217 ${LLVM_DIR}/lib/CodeGen/DeadMachineInstructionElim.cpp
218 ${LLVM_DIR}/lib/CodeGen/DwarfEHPrepare.cpp
219 ${LLVM_DIR}/lib/CodeGen/ELFCodeEmitter.cpp
220 ${LLVM_DIR}/lib/CodeGen/ELFWriter.cpp
221 ${LLVM_DIR}/lib/CodeGen/EdgeBundles.cpp
222 ${LLVM_DIR}/lib/CodeGen/ExecutionDepsFix.cpp
223 ${LLVM_DIR}/lib/CodeGen/ExpandISelPseudos.cpp
224 ${LLVM_DIR}/lib/CodeGen/ExpandPostRAPseudos.cpp
225 ${LLVM_DIR}/lib/CodeGen/GCMetadata.cpp
226 ${LLVM_DIR}/lib/CodeGen/GCStrategy.cpp
227 ${LLVM_DIR}/lib/CodeGen/InlineSpiller.cpp
228 ${LLVM_DIR}/lib/CodeGen/InterferenceCache.cpp
229 ${LLVM_DIR}/lib/CodeGen/IntrinsicLowering.cpp
230 ${LLVM_DIR}/lib/CodeGen/LLVMTargetMachine.cpp
231 ${LLVM_DIR}/lib/CodeGen/LatencyPriorityQueue.cpp
232 ${LLVM_DIR}/lib/CodeGen/LexicalScopes.cpp
233 ${LLVM_DIR}/lib/CodeGen/LiveDebugVariables.cpp
234 ${LLVM_DIR}/lib/CodeGen/LiveInterval.cpp
235 ${LLVM_DIR}/lib/CodeGen/LiveIntervalAnalysis.cpp
236 ${LLVM_DIR}/lib/CodeGen/LiveIntervalUnion.cpp
237 ${LLVM_DIR}/lib/CodeGen/LiveRangeCalc.cpp
238 ${LLVM_DIR}/lib/CodeGen/LiveRangeEdit.cpp
239 ${LLVM_DIR}/lib/CodeGen/LiveStackAnalysis.cpp
240 ${LLVM_DIR}/lib/CodeGen/LiveVariables.cpp
241 ${LLVM_DIR}/lib/CodeGen/LocalStackSlotAllocation.cpp
242 ${LLVM_DIR}/lib/CodeGen/MachineBasicBlock.cpp
243 ${LLVM_DIR}/lib/CodeGen/MachineCSE.cpp
244 ${LLVM_DIR}/lib/CodeGen/MachineDominators.cpp
245 ${LLVM_DIR}/lib/CodeGen/MachineFunction.cpp
246 ${LLVM_DIR}/lib/CodeGen/MachineFunctionAnalysis.cpp
247 ${LLVM_DIR}/lib/CodeGen/MachineFunctionPass.cpp
248 ${LLVM_DIR}/lib/CodeGen/MachineFunctionPrinterPass.cpp
249 ${LLVM_DIR}/lib/CodeGen/MachineInstr.cpp
250 ${LLVM_DIR}/lib/CodeGen/MachineLICM.cpp
251 ${LLVM_DIR}/lib/CodeGen/MachineLoopInfo.cpp
252 ${LLVM_DIR}/lib/CodeGen/MachineModuleInfo.cpp
253 ${LLVM_DIR}/lib/CodeGen/MachineModuleInfoImpls.cpp
254 ${LLVM_DIR}/lib/CodeGen/MachinePassRegistry.cpp
255 ${LLVM_DIR}/lib/CodeGen/MachineRegisterInfo.cpp
256 ${LLVM_DIR}/lib/CodeGen/MachineSSAUpdater.cpp
257 ${LLVM_DIR}/lib/CodeGen/MachineSink.cpp
258 ${LLVM_DIR}/lib/CodeGen/MachineVerifier.cpp
259 ${LLVM_DIR}/lib/CodeGen/ObjectCodeEmitter.cpp
260 ${LLVM_DIR}/lib/CodeGen/OptimizePHIs.cpp
261 ${LLVM_DIR}/lib/CodeGen/PHIElimination.cpp
262 ${LLVM_DIR}/lib/CodeGen/PHIEliminationUtils.cpp
263 ${LLVM_DIR}/lib/CodeGen/Passes.cpp
264 ${LLVM_DIR}/lib/CodeGen/PeepholeOptimizer.cpp
265 ${LLVM_DIR}/lib/CodeGen/PostRASchedulerList.cpp
266 ${LLVM_DIR}/lib/CodeGen/ProcessImplicitDefs.cpp
267 ${LLVM_DIR}/lib/CodeGen/PrologEpilogInserter.cpp
268 ${LLVM_DIR}/lib/CodeGen/PseudoSourceValue.cpp
269 ${LLVM_DIR}/lib/CodeGen/RegAllocBasic.cpp
270 ${LLVM_DIR}/lib/CodeGen/RegAllocFast.cpp
271 ${LLVM_DIR}/lib/CodeGen/RegAllocGreedy.cpp
272 ${LLVM_DIR}/lib/CodeGen/RegAllocLinearScan.cpp
273 ${LLVM_DIR}/lib/CodeGen/RegisterClassInfo.cpp
274 ${LLVM_DIR}/lib/CodeGen/RegisterCoalescer.cpp
275 ${LLVM_DIR}/lib/CodeGen/RegisterScavenging.cpp
276 ${LLVM_DIR}/lib/CodeGen/RenderMachineFunction.cpp
277 ${LLVM_DIR}/lib/CodeGen/ScheduleDAG.cpp
278 ${LLVM_DIR}/lib/CodeGen/ScheduleDAGEmit.cpp
279 ${LLVM_DIR}/lib/CodeGen/ScheduleDAGInstrs.cpp
280 ${LLVM_DIR}/lib/CodeGen/ScheduleDAGPrinter.cpp
281 ${LLVM_DIR}/lib/CodeGen/ScoreboardHazardRecognizer.cpp
282 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
283 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/FastISel.cpp
284 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
285 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
286 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
287 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
288 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
289 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp
290 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp
291 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp
292 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp
293 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp
294 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/ScheduleDAGList.cpp
295 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
296 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
297 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
298 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
299 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
300 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
301 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/TargetLowering.cpp
302 ${LLVM_DIR}/lib/CodeGen/SelectionDAG/TargetSelectionDAGInfo.cpp
303 ${LLVM_DIR}/lib/CodeGen/ShrinkWrapping.cpp
304 ${LLVM_DIR}/lib/CodeGen/SjLjEHPrepare.cpp
305 ${LLVM_DIR}/lib/CodeGen/SlotIndexes.cpp
306 ${LLVM_DIR}/lib/CodeGen/SpillPlacement.cpp
307 ${LLVM_DIR}/lib/CodeGen/Spiller.cpp
308 ${LLVM_DIR}/lib/CodeGen/SplitKit.cpp
309 ${LLVM_DIR}/lib/CodeGen/StackProtector.cpp
310 ${LLVM_DIR}/lib/CodeGen/StackSlotColoring.cpp
311 ${LLVM_DIR}/lib/CodeGen/StrongPHIElimination.cpp
312 ${LLVM_DIR}/lib/CodeGen/TailDuplication.cpp
313 ${LLVM_DIR}/lib/CodeGen/TargetInstrInfoImpl.cpp
314 ${LLVM_DIR}/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
315 ${LLVM_DIR}/lib/CodeGen/TwoAddressInstructionPass.cpp
316 ${LLVM_DIR}/lib/CodeGen/UnreachableBlockElim.cpp
317 ${LLVM_DIR}/lib/CodeGen/VirtRegMap.cpp
318 ${LLVM_DIR}/lib/CodeGen/VirtRegRewriter.cpp
319 ${LLVM_DIR}/lib/ExecutionEngine/ExecutionEngine.cpp
320 ${LLVM_DIR}/lib/ExecutionEngine/JIT/Intercept.cpp
321 ${LLVM_DIR}/lib/ExecutionEngine/JIT/JIT.cpp
322 ${LLVM_DIR}/lib/ExecutionEngine/JIT/JITDebugRegisterer.cpp
323 ${LLVM_DIR}/lib/ExecutionEngine/JIT/JITDwarfEmitter.cpp
324 ${LLVM_DIR}/lib/ExecutionEngine/JIT/JITEmitter.cpp
325 ${LLVM_DIR}/lib/ExecutionEngine/JIT/JITMemoryManager.cpp
326 ${LLVM_DIR}/lib/ExecutionEngine/JIT/OProfileJITEventListener.cpp
327 ${LLVM_DIR}/lib/ExecutionEngine/TargetSelect.cpp
328 ${LLVM_DIR}/lib/MC/ELFObjectWriter.cpp
329 ${LLVM_DIR}/lib/MC/MCAsmBackend.cpp
330 ${LLVM_DIR}/lib/MC/MCAsmInfo.cpp
331 ${LLVM_DIR}/lib/MC/MCAsmInfoCOFF.cpp
332 ${LLVM_DIR}/lib/MC/MCAsmInfoDarwin.cpp
333 ${LLVM_DIR}/lib/MC/MCAsmStreamer.cpp
334 ${LLVM_DIR}/lib/MC/MCAssembler.cpp
335 ${LLVM_DIR}/lib/MC/MCCodeEmitter.cpp
336 ${LLVM_DIR}/lib/MC/MCCodeGenInfo.cpp
337 ${LLVM_DIR}/lib/MC/MCContext.cpp
338 ${LLVM_DIR}/lib/MC/MCDwarf.cpp
339 ${LLVM_DIR}/lib/MC/MCELF.cpp
340 ${LLVM_DIR}/lib/MC/MCELFObjectTargetWriter.cpp
341 ${LLVM_DIR}/lib/MC/MCELFStreamer.cpp
342 ${LLVM_DIR}/lib/MC/MCExpr.cpp
343 ${LLVM_DIR}/lib/MC/MCInst.cpp
344 ${LLVM_DIR}/lib/MC/MCInstPrinter.cpp
345 ${LLVM_DIR}/lib/MC/MCInstrAnalysis.cpp
346 ${LLVM_DIR}/lib/MC/MCLoggingStreamer.cpp
347 ${LLVM_DIR}/lib/MC/MCMachOStreamer.cpp
348 ${LLVM_DIR}/lib/MC/MCMachObjectTargetWriter.cpp
349 ${LLVM_DIR}/lib/MC/MCNullStreamer.cpp
350 ${LLVM_DIR}/lib/MC/MCObjectFileInfo.cpp
351 ${LLVM_DIR}/lib/MC/MCObjectStreamer.cpp
352 ${LLVM_DIR}/lib/MC/MCObjectWriter.cpp
353 ${LLVM_DIR}/lib/MC/MCSection.cpp
354 ${LLVM_DIR}/lib/MC/MCSectionCOFF.cpp
355 ${LLVM_DIR}/lib/MC/MCSectionELF.cpp
356 ${LLVM_DIR}/lib/MC/MCSectionMachO.cpp
357 ${LLVM_DIR}/lib/MC/MCStreamer.cpp
358 ${LLVM_DIR}/lib/MC/MCSubtargetInfo.cpp
359 ${LLVM_DIR}/lib/MC/MCSymbol.cpp
360 ${LLVM_DIR}/lib/MC/MCWin64EH.cpp
361 ${LLVM_DIR}/lib/MC/MachObjectWriter.cpp
362 ${LLVM_DIR}/lib/MC/SubtargetFeature.cpp
363 ${LLVM_DIR}/lib/MC/WinCOFFObjectWriter.cpp
364 ${LLVM_DIR}/lib/MC/WinCOFFStreamer.cpp
365 ${LLVM_DIR}/lib/Support/APFloat.cpp
366 ${LLVM_DIR}/lib/Support/APInt.cpp
367 ${LLVM_DIR}/lib/Support/Allocator.cpp
368 ${LLVM_DIR}/lib/Support/Atomic.cpp
369 ${LLVM_DIR}/lib/Support/BlockFrequency.cpp
370 ${LLVM_DIR}/lib/Support/BranchProbability.cpp
371 ${LLVM_DIR}/lib/Support/CommandLine.cpp
372 ${LLVM_DIR}/lib/Support/ConstantRange.cpp
373 ${LLVM_DIR}/lib/Support/CrashRecoveryContext.cpp
374 ${LLVM_DIR}/lib/Support/DAGDeltaAlgorithm.cpp
375 ${LLVM_DIR}/lib/Support/DataExtractor.cpp
376 ${LLVM_DIR}/lib/Support/Debug.cpp
377 ${LLVM_DIR}/lib/Support/DeltaAlgorithm.cpp
378 ${LLVM_DIR}/lib/Support/Disassembler.cpp
379 ${LLVM_DIR}/lib/Support/Dwarf.cpp
380 ${LLVM_DIR}/lib/Support/DynamicLibrary.cpp
381 ${LLVM_DIR}/lib/Support/Errno.cpp
382 ${LLVM_DIR}/lib/Support/ErrorHandling.cpp
383 ${LLVM_DIR}/lib/Support/FileUtilities.cpp
384 ${LLVM_DIR}/lib/Support/FoldingSet.cpp
385 ${LLVM_DIR}/lib/Support/FormattedStream.cpp
386 ${LLVM_DIR}/lib/Support/GraphWriter.cpp
387 ${LLVM_DIR}/lib/Support/Host.cpp
388 ${LLVM_DIR}/lib/Support/IncludeFile.cpp
389 ${LLVM_DIR}/lib/Support/IntEqClasses.cpp
390 ${LLVM_DIR}/lib/Support/IntervalMap.cpp
391 ${LLVM_DIR}/lib/Support/IsInf.cpp
392 ${LLVM_DIR}/lib/Support/IsNAN.cpp
393 ${LLVM_DIR}/lib/Support/ManagedStatic.cpp
394 ${LLVM_DIR}/lib/Support/Memory.cpp
395 ${LLVM_DIR}/lib/Support/MemoryBuffer.cpp
396 ${LLVM_DIR}/lib/Support/MemoryObject.cpp
397 ${LLVM_DIR}/lib/Support/Mutex.cpp
398 ${LLVM_DIR}/lib/Support/Path.cpp
399 ${LLVM_DIR}/lib/Support/PathV2.cpp
400 ${LLVM_DIR}/lib/Support/PrettyStackTrace.cpp
401 ${LLVM_DIR}/lib/Support/Process.cpp
402 ${LLVM_DIR}/lib/Support/Program.cpp
403 ${LLVM_DIR}/lib/Support/RWMutex.cpp
404 ${LLVM_DIR}/lib/Support/SearchForAddressOfSpecialSymbol.cpp
405 ${LLVM_DIR}/lib/Support/Signals.cpp
406 ${LLVM_DIR}/lib/Support/SmallPtrSet.cpp
407 ${LLVM_DIR}/lib/Support/SmallVector.cpp
408 ${LLVM_DIR}/lib/Support/SourceMgr.cpp
409 ${LLVM_DIR}/lib/Support/Statistic.cpp
410 ${LLVM_DIR}/lib/Support/StringExtras.cpp
411 ${LLVM_DIR}/lib/Support/StringMap.cpp
412 ${LLVM_DIR}/lib/Support/StringPool.cpp
413 ${LLVM_DIR}/lib/Support/StringRef.cpp
414 ${LLVM_DIR}/lib/Support/SystemUtils.cpp
415 ${LLVM_DIR}/lib/Support/TargetRegistry.cpp
416 ${LLVM_DIR}/lib/Support/ThreadLocal.cpp
417 ${LLVM_DIR}/lib/Support/Threading.cpp
418 ${LLVM_DIR}/lib/Support/TimeValue.cpp
419 ${LLVM_DIR}/lib/Support/Timer.cpp
420 ${LLVM_DIR}/lib/Support/ToolOutputFile.cpp
421 ${LLVM_DIR}/lib/Support/Triple.cpp
422 ${LLVM_DIR}/lib/Support/Twine.cpp
423 ${LLVM_DIR}/lib/Support/Valgrind.cpp
424 ${LLVM_DIR}/lib/Support/circular_raw_ostream.cpp
425 ${LLVM_DIR}/lib/Support/raw_os_ostream.cpp
426 ${LLVM_DIR}/lib/Support/raw_ostream.cpp
427 ${LLVM_DIR}/lib/Support/system_error.cpp
428 ${LLVM_DIR}/lib/TableGen/Error.cpp
429 ${LLVM_DIR}/lib/TableGen/Main.cpp
430 ${LLVM_DIR}/lib/TableGen/Record.cpp
431 ${LLVM_DIR}/lib/TableGen/TGLexer.cpp
432 ${LLVM_DIR}/lib/TableGen/TGParser.cpp
433 ${LLVM_DIR}/lib/TableGen/TableGenBackend.cpp
434 ${LLVM_DIR}/lib/Target/Mangler.cpp
435 ${LLVM_DIR}/lib/Target/TargetData.cpp
436 ${LLVM_DIR}/lib/Target/TargetELFWriterInfo.cpp
437 ${LLVM_DIR}/lib/Target/TargetFrameLowering.cpp
438 ${LLVM_DIR}/lib/Target/TargetInstrInfo.cpp
439 ${LLVM_DIR}/lib/Target/TargetLibraryInfo.cpp
440 ${LLVM_DIR}/lib/Target/TargetLoweringObjectFile.cpp
441 ${LLVM_DIR}/lib/Target/TargetMachine.cpp
442 ${LLVM_DIR}/lib/Target/TargetRegisterInfo.cpp
443 ${LLVM_DIR}/lib/Target/TargetSubtargetInfo.cpp
444 ${LLVM_DIR}/lib/Target/X86/InstPrinter/X86ATTInstPrinter.cpp
445 ${LLVM_DIR}/lib/Target/X86/InstPrinter/X86InstComments.cpp
446 ${LLVM_DIR}/lib/Target/X86/InstPrinter/X86IntelInstPrinter.cpp
447 ${LLVM_DIR}/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
448 ${LLVM_DIR}/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp
449 ${LLVM_DIR}/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp
450 ${LLVM_DIR}/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp
451 ${LLVM_DIR}/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp
452 ${LLVM_DIR}/lib/Target/X86/TargetInfo/X86TargetInfo.cpp
453 ${LLVM_DIR}/lib/Target/X86/Utils/X86ShuffleDecode.cpp
454 ${LLVM_DIR}/lib/Target/X86/X86CodeEmitter.cpp
455 ${LLVM_DIR}/lib/Target/X86/X86ELFWriterInfo.cpp
456 ${LLVM_DIR}/lib/Target/X86/X86FastISel.cpp
457 ${LLVM_DIR}/lib/Target/X86/X86FloatingPoint.cpp
458 ${LLVM_DIR}/lib/Target/X86/X86FrameLowering.cpp
459 ${LLVM_DIR}/lib/Target/X86/X86ISelDAGToDAG.cpp
460 ${LLVM_DIR}/lib/Target/X86/X86ISelLowering.cpp
461 ${LLVM_DIR}/lib/Target/X86/X86InstrInfo.cpp
462 ${LLVM_DIR}/lib/Target/X86/X86JITInfo.cpp
463 ${LLVM_DIR}/lib/Target/X86/X86RegisterInfo.cpp
464 ${LLVM_DIR}/lib/Target/X86/X86SelectionDAGInfo.cpp
465 ${LLVM_DIR}/lib/Target/X86/X86Subtarget.cpp
466 ${LLVM_DIR}/lib/Target/X86/X86TargetMachine.cpp
467 ${LLVM_DIR}/lib/Target/X86/X86TargetObjectFile.cpp
468 ${LLVM_DIR}/lib/Target/X86/X86VZeroUpper.cpp
469 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineAddSub.cpp
470 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
471 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineCalls.cpp
472 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineCasts.cpp
473 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineCompares.cpp
474 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
475 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
476 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombinePHI.cpp
477 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineSelect.cpp
478 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineShifts.cpp
479 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
480 ${LLVM_DIR}/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
481 ${LLVM_DIR}/lib/Transforms/InstCombine/InstructionCombining.cpp
482 ${LLVM_DIR}/lib/Transforms/Scalar/ADCE.cpp
483 ${LLVM_DIR}/lib/Transforms/Scalar/CodeGenPrepare.cpp
484 ${LLVM_DIR}/lib/Transforms/Scalar/DeadStoreElimination.cpp
485 ${LLVM_DIR}/lib/Transforms/Scalar/GVN.cpp
486 ${LLVM_DIR}/lib/Transforms/Scalar/LICM.cpp
487 ${LLVM_DIR}/lib/Transforms/Scalar/LoopStrengthReduce.cpp
488 ${LLVM_DIR}/lib/Transforms/Scalar/Reassociate.cpp
489 ${LLVM_DIR}/lib/Transforms/Scalar/Reg2Mem.cpp
490 ${LLVM_DIR}/lib/Transforms/Scalar/SCCP.cpp
491 ${LLVM_DIR}/lib/Transforms/Scalar/ScalarReplAggregates.cpp
492 ${LLVM_DIR}/lib/Transforms/Scalar/SimplifyCFGPass.cpp
493 ${LLVM_DIR}/lib/Transforms/Utils/AddrModeMatcher.cpp
494 ${LLVM_DIR}/lib/Transforms/Utils/BasicBlockUtils.cpp
495 ${LLVM_DIR}/lib/Transforms/Utils/BreakCriticalEdges.cpp
496 ${LLVM_DIR}/lib/Transforms/Utils/BuildLibCalls.cpp
497 ${LLVM_DIR}/lib/Transforms/Utils/DemoteRegToStack.cpp
498 ${LLVM_DIR}/lib/Transforms/Utils/InstructionNamer.cpp
499 ${LLVM_DIR}/lib/Transforms/Utils/LCSSA.cpp
500 ${LLVM_DIR}/lib/Transforms/Utils/Local.cpp
501 ${LLVM_DIR}/lib/Transforms/Utils/LoopSimplify.cpp
502 ${LLVM_DIR}/lib/Transforms/Utils/LowerInvoke.cpp
503 ${LLVM_DIR}/lib/Transforms/Utils/LowerSwitch.cpp
504 ${LLVM_DIR}/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
505 ${LLVM_DIR}/lib/Transforms/Utils/SSAUpdater.cpp
506 ${LLVM_DIR}/lib/Transforms/Utils/SimplifyCFG.cpp
507 ${LLVM_DIR}/lib/Transforms/Utils/UnifyFunctionExitNodes.cpp
508 ${LLVM_DIR}/lib/VMCore/AsmWriter.cpp
509 ${LLVM_DIR}/lib/VMCore/Attributes.cpp
510 ${LLVM_DIR}/lib/VMCore/BasicBlock.cpp
511 ${LLVM_DIR}/lib/VMCore/ConstantFold.cpp
512 ${LLVM_DIR}/lib/VMCore/Constants.cpp
513 ${LLVM_DIR}/lib/VMCore/DebugInfoProbe.cpp
514 ${LLVM_DIR}/lib/VMCore/DebugLoc.cpp
515 ${LLVM_DIR}/lib/VMCore/Dominators.cpp
516 ${LLVM_DIR}/lib/VMCore/Function.cpp
517 ${LLVM_DIR}/lib/VMCore/Globals.cpp
518 ${LLVM_DIR}/lib/VMCore/IRBuilder.cpp
519 ${LLVM_DIR}/lib/VMCore/InlineAsm.cpp
520 ${LLVM_DIR}/lib/VMCore/Instruction.cpp
521 ${LLVM_DIR}/lib/VMCore/Instructions.cpp
522 ${LLVM_DIR}/lib/VMCore/IntrinsicInst.cpp
523 ${LLVM_DIR}/lib/VMCore/LLVMContext.cpp
524 ${LLVM_DIR}/lib/VMCore/LLVMContextImpl.cpp
525 ${LLVM_DIR}/lib/VMCore/LeakDetector.cpp
526 ${LLVM_DIR}/lib/VMCore/Metadata.cpp
527 ${LLVM_DIR}/lib/VMCore/Module.cpp
528 ${LLVM_DIR}/lib/VMCore/Pass.cpp
529 ${LLVM_DIR}/lib/VMCore/PassManager.cpp
530 ${LLVM_DIR}/lib/VMCore/PassRegistry.cpp
531 ${LLVM_DIR}/lib/VMCore/PrintModulePass.cpp
532 ${LLVM_DIR}/lib/VMCore/Type.cpp
533 ${LLVM_DIR}/lib/VMCore/Use.cpp
534 ${LLVM_DIR}/lib/VMCore/User.cpp
535 ${LLVM_DIR}/lib/VMCore/Value.cpp
536 ${LLVM_DIR}/lib/VMCore/ValueSymbolTable.cpp
537 ${LLVM_DIR}/lib/VMCore/ValueTypes.cpp
538 ${LLVM_DIR}/lib/VMCore/Verifier.cpp
542 set(LLVM_INCLUDE_DIR ${LLVM_DIR}/include)
544 set(LLVM_INCLUDE_DIR ${LLVM_DIR}/include-linux)
546 set(LLVM_INCLUDE_DIR ${LLVM_DIR}/include-osx)
549 list(APPEND LLVM_INCLUDE_DIR
551 ${LLVM_DIR}/lib/Target/X86
553 add_library(llvm STATIC ${LLVM_LIST})
554 set_target_properties(llvm PROPERTIES
555 POSITION_INDEPENDENT_CODE 1
556 INCLUDE_DIRECTORIES "${LLVM_INCLUDE_DIR}"
557 COMPILE_DEFINITIONS "__STDC_CONSTANT_MACROS; __STDC_LIMIT_MACROS;"
561 ###########################################################
563 ###########################################################
566 ${SUBZERO_DIR}/src/IceAssembler.cpp
567 ${SUBZERO_DIR}/src/IceCfg.cpp
568 ${SUBZERO_DIR}/src/IceCfgNode.cpp
569 ${SUBZERO_DIR}/src/IceClFlags.cpp
570 ${SUBZERO_DIR}/src/IceELFObjectWriter.cpp
571 ${SUBZERO_DIR}/src/IceELFSection.cpp
572 ${SUBZERO_DIR}/src/IceFixups.cpp
573 ${SUBZERO_DIR}/src/IceGlobalContext.cpp
574 ${SUBZERO_DIR}/src/IceGlobalInits.cpp
575 ${SUBZERO_DIR}/src/IceInst.cpp
576 ${SUBZERO_DIR}/src/IceInstrumentation.cpp
577 ${SUBZERO_DIR}/src/IceIntrinsics.cpp
578 ${SUBZERO_DIR}/src/IceLiveness.cpp
579 ${SUBZERO_DIR}/src/IceLoopAnalyzer.cpp
580 ${SUBZERO_DIR}/src/IceMangling.cpp
581 ${SUBZERO_DIR}/src/IceMemory.cpp
582 ${SUBZERO_DIR}/src/IceOperand.cpp
583 ${SUBZERO_DIR}/src/IceRangeSpec.cpp
584 ${SUBZERO_DIR}/src/IceRegAlloc.cpp
585 ${SUBZERO_DIR}/src/IceRevision.cpp
586 ${SUBZERO_DIR}/src/IceRNG.cpp
587 ${SUBZERO_DIR}/src/IceSwitchLowering.cpp
588 ${SUBZERO_DIR}/src/IceTargetLowering.cpp
589 ${SUBZERO_DIR}/src/IceTargetLoweringX86.cpp
590 ${SUBZERO_DIR}/src/IceThreading.cpp
591 ${SUBZERO_DIR}/src/IceTimerTree.cpp
592 ${SUBZERO_DIR}/src/IceTypes.cpp
593 ${SUBZERO_DIR}/src/IceVariableSplitting.cpp
596 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
597 list(APPEND SUBZERO_LIST
598 ${SUBZERO_DIR}/src/IceInstX8664.cpp
599 ${SUBZERO_DIR}/src/IceTargetLoweringX8664.cpp
601 set(SUBZERO_TARGET X8664)
603 list(APPEND SUBZERO_LIST
604 ${SUBZERO_DIR}/src/IceInstX8632.cpp
605 ${SUBZERO_DIR}/src/IceTargetLoweringX8632.cpp
607 set(SUBZERO_TARGET X8632)
610 file(GLOB_RECURSE SUBZERO_DEPENDENCIES_LIST
611 ${SUBZERO_LLVM_DIR}/*.cpp
612 ${SUBZERO_LLVM_DIR}/*.c
613 ${SUBZERO_LLVM_DIR}/*.h
616 set(SUBZERO_REACTOR_LIST
617 ${SOURCE_DIR}/Reactor/SubzeroReactor.cpp
618 ${SOURCE_DIR}/Reactor/Routine.cpp
619 ${SOURCE_DIR}/Reactor/Optimizer.cpp
620 ${SOURCE_DIR}/Reactor/Nucleus.hpp
621 ${SOURCE_DIR}/Reactor/Routine.hpp
624 set(SUBZERO_INCLUDE_DIR
626 ${SUBZERO_LLVM_DIR}/include/
628 ${SUBZERO_DIR}/pnacl-llvm/include/
629 ${SOURCE_DIR}/Reactor/SubmoduleCheck/
633 list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Windows/include/)
635 list(APPEND SUBZERO_INCLUDE_DIR ${SUBZERO_LLVM_DIR}/build/Linux/include/)
637 message(SEND_ERROR "Subzero is not supported yet on Mac OS")
640 add_library(ReactorSubzero STATIC
642 ${SUBZERO_DEPENDENCIES_LIST}
643 ${SUBZERO_REACTOR_LIST}
646 set_target_properties(ReactorSubzero PROPERTIES
647 POSITION_INDEPENDENT_CODE 1
648 INCLUDE_DIRECTORIES "${SUBZERO_INCLUDE_DIR}"
649 COMPILE_DEFINITIONS "SZTARGET=${SUBZERO_TARGET}; ALLOW_DUMP=0; ALLOW_TIMERS=0; ALLOW_LLVM_CL=0; ALLOW_LLVM_IR=0; ALLOW_LLVM_IR_AS_INPUT=0; ALLOW_MINIMAL_BUILD=0; ALLOW_WASM=0; ICE_THREAD_LOCAL_HACK=0;"
653 ###########################################################
654 # Include Directories
655 ###########################################################
657 set(COMMON_INCLUDE_DIR
661 ${SOURCE_DIR}/Reactor
662 ${SOURCE_DIR}/Renderer
664 ${CMAKE_SOURCE_DIR}/include
667 set(OPENGL_INCLUDE_DIR
669 ${COMMON_INCLUDE_DIR}
672 ###########################################################
674 ###########################################################
676 file(GLOB_RECURSE SWIFTSHADER_LIST
677 ${SOURCE_DIR}/Common/*.cpp
678 ${SOURCE_DIR}/Common/*.h
679 ${SOURCE_DIR}/Common/*.hpp
680 ${SOURCE_DIR}/Renderer/*.cpp
681 ${SOURCE_DIR}/Renderer/*.h
682 ${SOURCE_DIR}/Renderer/*.hpp
683 ${SOURCE_DIR}/Shader/*.cpp
684 ${SOURCE_DIR}/Shader/*.h
685 ${SOURCE_DIR}/Shader/*.hpp
687 list(APPEND SWIFTSHADER_LIST
688 ${SOURCE_DIR}/Main/Config.cpp
689 ${SOURCE_DIR}/Main/Config.hpp
690 ${SOURCE_DIR}/Main/FrameBuffer.cpp
691 ${SOURCE_DIR}/Main/FrameBuffer.hpp
692 ${SOURCE_DIR}/Main/SwiftConfig.cpp
693 ${SOURCE_DIR}/Main/SwiftConfig.hpp
695 list(REMOVE_ITEM SWIFTSHADER_LIST
696 ${SOURCE_DIR}/Common/DebugAndroid.cpp
697 ${SOURCE_DIR}/Common/DebugAndroid.hpp
698 ${SOURCE_DIR}/Common/GrallocAndroid.cpp
699 ${SOURCE_DIR}/Common/GrallocAndroid.hpp
702 set(REACTOR_LLVM_LIST
703 ${SOURCE_DIR}/Reactor/LLVMReactor.cpp
704 ${SOURCE_DIR}/Reactor/Nucleus.hpp
705 ${SOURCE_DIR}/Reactor/Routine.cpp
706 ${SOURCE_DIR}/Reactor/Routine.hpp
707 ${SOURCE_DIR}/Reactor/LLVMRoutine.cpp
708 ${SOURCE_DIR}/Reactor/LLVMRoutine.hpp
709 ${SOURCE_DIR}/Reactor/LLVMRoutineManager.cpp
710 ${SOURCE_DIR}/Reactor/LLVMRoutineManager.hpp
713 file(GLOB_RECURSE EGL_LIST
714 ${OPENGL_DIR}/libEGL/*.cpp
715 ${OPENGL_DIR}/libEGL/*.h
716 ${OPENGL_DIR}/libEGL/*.hpp
717 ${OPENGL_DIR}/common/Object.cpp
718 ${OPENGL_DIR}/common/Object.hpp
719 ${OPENGL_DIR}/common/debug.cpp
720 ${OPENGL_DIR}/common/debug.h
721 ${CMAKE_SOURCE_DIR}/include/*.h
724 file(GLOB_RECURSE GL32_LIST
725 ${OPENGL_DIR}/libGL/*.cpp
726 ${OPENGL_DIR}/libGL/*.h
727 ${OPENGL_DIR}/libGL/*.hpp
728 ${OPENGL_DIR}/common/*.cpp
729 ${OPENGL_DIR}/common/*.h
730 ${OPENGL_DIR}/common/*.hpp
731 ${CMAKE_SOURCE_DIR}/include/GL/*.h
734 file(GLOB_RECURSE GLES2_LIST
735 ${OPENGL_DIR}/libGLESv2/*.cpp
736 ${OPENGL_DIR}/libGLESv2/*.h
737 ${OPENGL_DIR}/libGLESv2/*.hpp
738 ${OPENGL_DIR}/common/*.cpp
739 ${OPENGL_DIR}/common/*.h
740 ${OPENGL_DIR}/common/*.hpp
741 ${CMAKE_SOURCE_DIR}/include/KHR/*.h
742 ${CMAKE_SOURCE_DIR}/include/GLES2/*.h
743 ${CMAKE_SOURCE_DIR}/include/GLES3/*.h
746 file(GLOB_RECURSE GLES_CM_LIST
747 ${OPENGL_DIR}/libGLES_CM/*.cpp
748 ${OPENGL_DIR}/libGLES_CM/*.h
749 ${OPENGL_DIR}/libGLES_CM/*.hpp
750 ${OPENGL_DIR}/common/*.cpp
751 ${OPENGL_DIR}/common/*.h
752 ${OPENGL_DIR}/common/*.hpp
753 ${CMAKE_SOURCE_DIR}/include/KHR/*.h
754 ${CMAKE_SOURCE_DIR}/include/GLES/*.h
757 file(GLOB_RECURSE OPENGL_COMPILER_LIST
758 ${OPENGL_COMPILER_DIR}/*.cpp
759 ${OPENGL_COMPILER_DIR}/*.h
760 ${OPENGL_COMPILER_DIR}/*.hpp
762 file(GLOB_RECURSE OPENGL_COMPILER_OS_SPECIFIC_LIST
763 ${OPENGL_COMPILER_DIR}/ossource*.cpp
764 ${OPENGL_COMPILER_DIR}/ossource*.h
765 ${OPENGL_COMPILER_DIR}/ossource*.hpp
767 list(REMOVE_ITEM OPENGL_COMPILER_LIST ${OPENGL_COMPILER_OS_SPECIFIC_LIST})
769 ###########################################################
770 # Append OS specific files to lists
771 ###########################################################
774 list(APPEND SWIFTSHADER_LIST
775 ${SOURCE_DIR}/Main/FrameBufferDD.cpp
776 ${SOURCE_DIR}/Main/FrameBufferDD.hpp
777 ${SOURCE_DIR}/Main/FrameBufferGDI.cpp
778 ${SOURCE_DIR}/Main/FrameBufferGDI.hpp
779 ${SOURCE_DIR}/Main/FrameBufferWin.cpp
780 ${SOURCE_DIR}/Main/FrameBufferWin.hpp
782 list(APPEND OPENGL_COMPILER_LIST ${OPENGL_COMPILER_DIR}/ossource_win.cpp)
783 list(APPEND EGL_LIST ${OPENGL_DIR}/libEGL/libEGL.rc)
784 list(APPEND GL32_LIST ${OPENGL_DIR}/libGL/libGL.rc)
785 list(APPEND GLES2_LIST ${OPENGL_DIR}/libGLESv2/libGLESv2.rc)
786 list(APPEND GLES_CM_LIST ${OPENGL_DIR}/libGLES_CM/libGLES_CM.rc)
788 list(APPEND SWIFTSHADER_LIST
789 ${SOURCE_DIR}/Main/FrameBufferX11.cpp
790 ${SOURCE_DIR}/Main/FrameBufferX11.hpp
791 ${SOURCE_DIR}/Common/SharedLibrary.hpp
792 ${SOURCE_DIR}/Main/libX11.cpp
793 ${SOURCE_DIR}/Main/libX11.hpp
796 ${SOURCE_DIR}/Common/SharedLibrary.hpp
797 ${SOURCE_DIR}/Main/libX11.cpp
798 ${SOURCE_DIR}/Main/libX11.hpp
800 list(APPEND OPENGL_COMPILER_LIST
801 ${OPENGL_COMPILER_DIR}/ossource_posix.cpp
804 list(APPEND SWIFTSHADER_LIST
805 ${SOURCE_DIR}/Main/FrameBufferOSX.mm
806 ${SOURCE_DIR}/Main/FrameBufferOSX.hpp
809 ${OPENGL_DIR}/libEGL/OSXUtils.mm
810 ${OPENGL_DIR}/libEGL/OSXUtils.hpp
812 list(APPEND OPENGL_COMPILER_LIST
813 ${OPENGL_COMPILER_DIR}/ossource_posix.cpp
818 set(OS_LIBS odbc32 odbccp32 WS2_32 dxguid)
820 set(OS_LIBS dl pthread)
822 find_library(COCOA_FRAMEWORK Cocoa)
823 find_library(QUARTZ_FRAMEWORK Quartz)
824 set(OS_LIBS "${COCOA_FRAMEWORK}" "${QUARTZ_FRAMEWORK}")
827 ###########################################################
828 # SwiftShader Targets
829 ###########################################################
831 add_library(SwiftShader STATIC ${SWIFTSHADER_LIST})
832 set_target_properties(SwiftShader PROPERTIES
833 INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
834 POSITION_INDEPENDENT_CODE 1
837 target_link_libraries(SwiftShader ${OS_LIBS})
839 add_library(ReactorLLVM STATIC ${REACTOR_LLVM_LIST})
840 set_target_properties(ReactorLLVM PROPERTIES
841 INCLUDE_DIRECTORIES "${COMMON_INCLUDE_DIR}"
842 POSITION_INDEPENDENT_CODE 1
845 target_link_libraries(ReactorLLVM llvm ${OS_LIBS})
847 if(${REACTOR_BACKEND} STREQUAL "LLVM")
848 set(Reactor ReactorLLVM)
849 elseif(${REACTOR_BACKEND} STREQUAL "Subzero")
850 set(Reactor ReactorSubzero)
852 message(FATAL_ERROR "REACTOR_BACKEND must be 'LLVM' or 'Subzero'")
855 add_library(GLCompiler STATIC ${OPENGL_COMPILER_LIST})
856 set_target_properties(GLCompiler PROPERTIES
857 INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
858 POSITION_INDEPENDENT_CODE 1
861 target_link_libraries(GLCompiler ${OS_LIBS})
863 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
864 set(LIB_PREFIX "lib64")
866 set(LIB_PREFIX "lib")
870 add_library(libEGL SHARED ${EGL_LIST})
871 set_target_properties(libEGL PROPERTIES
872 INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
874 COMPILE_DEFINITIONS "EGL_EGLEXT_PROTOTYPES; EGLAPI=;"
877 set_target_export_map(libEGL ${SOURCE_DIR}/OpenGL/libEGL)
878 target_link_libraries(libEGL ${OS_LIBS})
882 COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:libEGL>/translator
883 COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libEGL> $<TARGET_FILE_DIR:libEGL>/translator/${LIB_PREFIX}EGL_translator${CMAKE_SHARED_LIBRARY_SUFFIX}
888 add_library(libGL SHARED ${GL32_LIST})
889 set_target_properties(libGL PROPERTIES
890 INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
892 COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
895 set_target_export_map(libGL ${SOURCE_DIR}/OpenGL/libGL)
896 target_link_libraries(libGL SwiftShader ${Reactor} GLCompiler ${OS_LIBS})
900 add_library(libGLESv2 SHARED ${GLES2_LIST})
901 set_target_properties(libGLESv2 PROPERTIES
902 INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
904 COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES; GL_API=; GL_APICALL=;"
907 set_target_export_map(libGLESv2 ${SOURCE_DIR}/OpenGL/libGLESv2)
908 target_link_libraries(libGLESv2 SwiftShader ${Reactor} GLCompiler ${OS_LIBS})
912 COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:libGLESv2>/translator
913 COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libGLESv2> $<TARGET_FILE_DIR:libGLESv2>/translator/${LIB_PREFIX}GLES_V2_translator${CMAKE_SHARED_LIBRARY_SUFFIX}
918 add_library(libGLES_CM SHARED ${GLES_CM_LIST})
919 set_target_properties(libGLES_CM PROPERTIES
920 INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}"
922 COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES; EGLAPI=; GL_API=; GL_APICALL=;"
925 set_target_export_map(libGLES_CM ${SOURCE_DIR}/OpenGL/libGLES_CM)
926 target_link_libraries(libGLES_CM SwiftShader ${Reactor} GLCompiler ${OS_LIBS})
930 COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:libGLES_CM>/translator
931 COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libGLES_CM> $<TARGET_FILE_DIR:libGLES_CM>/translator/${LIB_PREFIX}GLES_CM_translator${CMAKE_SHARED_LIBRARY_SUFFIX}
935 ###########################################################
937 ###########################################################
941 add_executable(OGLES2HelloAPI ${HELLO2_DIR}/OGLES2HelloAPI_Windows.cpp)
942 set_target_properties(OGLES2HelloAPI PROPERTIES
943 INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include"
944 COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
947 target_link_libraries(OGLES2HelloAPI libEGL libGLESv2)
948 set_property(TARGET OGLES2HelloAPI APPEND_STRING PROPERTY LINK_FLAGS "/SUBSYSTEM:WINDOWS")
949 set(CMAKE_DEFAULT_STARTUP_PROJECT OGLES2HelloAPI)
951 add_executable(OGLES2HelloAPI ${HELLO2_DIR}/OGLES2HelloAPI_LinuxX11.cpp)
952 set_target_properties(OGLES2HelloAPI PROPERTIES
953 INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include"
954 COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
956 target_link_libraries(OGLES2HelloAPI dl X11 libEGL libGLESv2) # Explicitly link our "lib*" targets, not the platform provided "EGL" and "GLESv2"
958 add_executable(OGLES2HelloAPI MACOSX_BUNDLE
959 ${HELLO2_DIR}/OGLES2HelloAPI_OSX.mm
960 ${HELLO2_DIR}/Build/OSX/en.lproj/MainMenu.xib
962 set_target_properties(OGLES2HelloAPI PROPERTIES
963 INCLUDE_DIRECTORIES "${CMAKE_SOURCE_DIR}/include"
964 COMPILE_DEFINITIONS "GL_GLEXT_PROTOTYPES"
965 MACOSX_BUNDLE_INFO_PLIST "${HELLO2_DIR}/Build/OSX/Info.plist"
967 target_link_libraries(OGLES2HelloAPI libEGL libGLESv2 ${OS_LIBS})
968 set_source_files_properties(${HELLO2_DIR}/Build/OSX/en.lproj/MainMenu.xib PROPERTIES
969 MACOSX_PACKAGE_LOCATION "Resources"