blob: 1636af71f129231f1b37549dbe81381ad11386d1 [file] [log] [blame]
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -06001# Create the i965 XGL DRI library
Cody Northrop0eb5eea2014-09-19 15:11:52 -06002
3# Mesa required defines
Cody Northrope8455b12014-09-17 16:18:12 -06004add_definitions(-D_GNU_SOURCE -DHAVE_PTHREAD)
Cody Northrop0eb5eea2014-09-19 15:11:52 -06005# LLVM required defines
6add_definitions(-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS)
Cody Northrope8455b12014-09-17 16:18:12 -06007
8# Hard code our LunarGLASS and glslang paths for now
9SET(GLSLANG_PREFIX_REL ../../../glslang)
10SET(LUNARGLASS_PREFIX_REL ../../../LunarGLASS)
11
12get_filename_component(GLSLANG_PREFIX ${GLSLANG_PREFIX_REL} ABSOLUTE)
13get_filename_component(LUNARGLASS_PREFIX ${LUNARGLASS_PREFIX_REL} ABSOLUTE)
14
15# LunarG TODO: Get the llvm-config flags hooked up correctly and remove extra definitions from above
16
Steve K14e09812014-09-19 09:45:36 -060017execute_process(COMMAND ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/bin/llvm-config --libs engine bitwriter
18 OUTPUT_VARIABLE LLVM_LIBS_ALL_1
19 RESULT_VARIABLE LLVM_LIBS_RESULT)
20
Cody Northrop0eb5eea2014-09-19 15:11:52 -060021string(REPLACE "\n" "" LLVM_LIBS_ALL ${LLVM_LIBS_ALL_1})
22message(STATUS "llvm-config lib results")
23message(STATUS ${LLVM_LIBS_ALL})
24
Steve K66d40802014-09-19 09:59:26 -060025if(NOT "${LLVM_LIBS_RESULT}" EQUAL "0")
26 message(FATAL_ERROR "llvm-config failed: " ${LLVM_LIBS_RESULT})
Steve K14e09812014-09-19 09:45:36 -060027endif()
28
Cody Northrope8455b12014-09-17 16:18:12 -060029
Cody Northrop0eb5eea2014-09-19 15:11:52 -060030execute_process(COMMAND ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/bin/llvm-config --cxxflags
31 OUTPUT_VARIABLE LLVM_CXX_CONFIG_ALL_1
Steve K66d40802014-09-19 09:59:26 -060032 RESULT_VARIABLE LLVM_CXX_CONFIG_RESULT)
33
Cody Northrop0eb5eea2014-09-19 15:11:52 -060034string(REPLACE "\n" "" LLVM_CXX_CONFIG_ALL ${LLVM_CXX_CONFIG_ALL_1})
35string(REPLACE "-Woverloaded-virtual" "" LLVM_CXX_CONFIG_1 ${LLVM_CXX_CONFIG_ALL})
36string(REPLACE "-fvisibility-inlines-hidden" "" LLVM_CXX_CONFIG ${LLVM_CXX_CONFIG_1})
37message(STATUS "llvm-config cxxflags results")
38message(STATUS ${LLVM_CXX_CONFIG})
39
Steve K66d40802014-09-19 09:59:26 -060040# if(NOT "${LLVM_CXX_CONFIG_RESULT}" EQUAL "0")
41# message(FATAL_ERROR "llvm-config failed: " ${LLVM_CXX_CONFIG_RESULT})
42# endif()
43
Steve K66d40802014-09-19 09:59:26 -060044
45set_target_properties(icd
46 PROPERTIES
47 COMPILE_FLAGS "${LLVM_CXX_CONFIG}")
48
Cody Northrope8455b12014-09-17 16:18:12 -060049SET(COMPILER_LINK_DIRS
50 ${GLSLANG_PREFIX}/build/install/lib
51 ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/lib
52 ${LUNARGLASS_PREFIX}/build/Core
53 ${LUNARGLASS_PREFIX}/build/Frontends/glslang
54 ${LUNARGLASS_PREFIX}/build/Core/Passes/Transforms
55 ${LUNARGLASS_PREFIX}/build/Core/Passes/Immutable
56 ${LUNARGLASS_PREFIX}/build/Core/Passes/Analysis
57 ${LUNARGLASS_PREFIX}/build/Core/Passes/Util
58)
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -060059
Chia-I Wuddbc8e22014-09-18 17:05:09 +080060pkg_check_modules(DRM REQUIRED libdrm libdrm_intel)
61
Cody Northrope8455b12014-09-17 16:18:12 -060062link_directories (
63 ${ICD_LIBRARY_DIRS}
64 ${DRM_LIBRARY_DIRS}
65 ${COMPILER_LINK_DIRS}
Chia-I Wuddbc8e22014-09-18 17:05:09 +080066)
67
Cody Northrope8455b12014-09-17 16:18:12 -060068SET(COMPILER_LIBS
69 glslangFrontend
70 core
71 LLVMipo
72 glslang
73 OGLCompiler
74 ${LLVM_LIBS_ALL}
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -060075)
76
77link_libraries (
Cody Northrope8455b12014-09-17 16:18:12 -060078 ${ICD_LIBRARIES}
79 ${DRM_LIBRARIES}
80 ${COMPILER_LIBS}
81 m
Steve Kda224042014-09-19 08:46:17 -060082 pthread
83 dl
Cody Northrope8455b12014-09-17 16:18:12 -060084)
85
86SET(COMPILER_INCLUDE_DIRS
87 ${GLSLANG_PREFIX}
88 ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/include
89 ${LUNARGLASS_PREFIX}
Cody Northrop0eb5eea2014-09-19 15:11:52 -060090 ${CMAKE_CURRENT_SOURCE_DIR}
Cody Northropbc851432014-09-23 10:06:32 -060091 compiler/shader
Cody Northrope8455b12014-09-17 16:18:12 -060092 compiler/mesa-utils/include
Cody Northropbc851432014-09-23 10:06:32 -060093 compiler/mesa-utils/src
Cody Northrope8455b12014-09-17 16:18:12 -060094 compiler/mesa-utils/src/glsl
95 compiler/mesa-utils/src/mesa
Cody Northropbc851432014-09-23 10:06:32 -060096 compiler/mesa-utils/src/mesa/program
Cody Northrope8455b12014-09-17 16:18:12 -060097 compiler/mesa-utils/src/mapi
98)
99
100include_directories (
101 ${ICD_INCLUDE_DIRS}
102 ${DRM_INCLUDE_DIRS}
103 ${COMPILER_INCLUDE_DIRS}
104)
105
106
107SET(COMPILER_SOURCES
108 compiler/shader/ast_array_index.cpp
109 compiler/shader/ast_expr.cpp
110 compiler/shader/ast_function.cpp
111 compiler/shader/ast_to_hir.cpp
112 compiler/shader/ast_type.cpp
113 compiler/shader/builtin_functions.cpp
114 compiler/shader/builtin_types.cpp
115 compiler/shader/builtin_variables.cpp
116 compiler/shader/ir.cpp
117 compiler/shader/ir_basic_block.cpp
118 compiler/shader/ir_builder.cpp
119 compiler/shader/ir_clone.cpp
120 compiler/shader/ir_constant_expression.cpp
121 compiler/shader/ir_deserializer.cpp
122 compiler/shader/ir_equals.cpp
123 compiler/shader/ir_expression_flattening.cpp
124 compiler/shader/ir_function_can_inline.cpp
125 compiler/shader/ir_function.cpp
126 compiler/shader/ir_function_detect_recursion.cpp
127 compiler/shader/ir_hierarchical_visitor.cpp
128 compiler/shader/ir_hv_accept.cpp
129 compiler/shader/ir_import_prototypes.cpp
130 compiler/shader/ir_print_visitor.cpp
131 compiler/shader/ir_reader.cpp
132 compiler/shader/ir_rvalue_visitor.cpp
133 compiler/shader/ir_serialize.cpp
134 compiler/shader/ir_set_program_inouts.cpp
135 compiler/shader/ir_validate.cpp
136 compiler/shader/ir_variable_refcount.cpp
137 compiler/shader/link_atomics.cpp
138 compiler/shader/linker.cpp
139 compiler/shader/link_functions.cpp
140 compiler/shader/link_interface_blocks.cpp
141 compiler/shader/link_uniform_block_active_visitor.cpp
142 compiler/shader/link_uniform_blocks.cpp
143 compiler/shader/link_uniform_initializers.cpp
144 compiler/shader/link_uniforms.cpp
145 compiler/shader/link_varyings.cpp
146 compiler/shader/loop_analysis.cpp
147 compiler/shader/loop_controls.cpp
148 compiler/shader/loop_unroll.cpp
149 compiler/shader/lower_clip_distance.cpp
150 compiler/shader/lower_discard.cpp
151 compiler/shader/lower_discard_flow.cpp
152 compiler/shader/lower_if_to_cond_assign.cpp
153 compiler/shader/lower_instructions.cpp
154 compiler/shader/lower_jumps.cpp
155 compiler/shader/lower_mat_op_to_vec.cpp
156 compiler/shader/lower_named_interface_blocks.cpp
157 compiler/shader/lower_noise.cpp
158 compiler/shader/lower_offset_array.cpp
159 compiler/shader/lower_output_reads.cpp
160 compiler/shader/lower_packed_varyings.cpp
161 compiler/shader/lower_packing_builtins.cpp
162 compiler/shader/lower_texture_projection.cpp
163 compiler/shader/lower_ubo_reference.cpp
164 compiler/shader/lower_variable_index_to_cond_assign.cpp
165 compiler/shader/lower_vec_index_to_cond_assign.cpp
166 compiler/shader/lower_vec_index_to_swizzle.cpp
167 compiler/shader/lower_vector.cpp
168 compiler/shader/lower_vector_insert.cpp
169 compiler/shader/opt_algebraic.cpp
170 compiler/shader/opt_array_splitting.cpp
171 compiler/shader/opt_constant_folding.cpp
172 compiler/shader/opt_constant_propagation.cpp
173 compiler/shader/opt_constant_variable.cpp
174 compiler/shader/opt_copy_propagation.cpp
175 compiler/shader/opt_copy_propagation_elements.cpp
176 compiler/shader/opt_cse.cpp
177 compiler/shader/opt_dead_builtin_varyings.cpp
178 compiler/shader/opt_dead_code.cpp
179 compiler/shader/opt_dead_code_local.cpp
180 compiler/shader/opt_dead_functions.cpp
181 compiler/shader/opt_flatten_nested_if_blocks.cpp
182 compiler/shader/opt_flip_matrices.cpp
183 compiler/shader/opt_function_inlining.cpp
184 compiler/shader/opt_if_simplification.cpp
185 compiler/shader/opt_noop_swizzle.cpp
186 compiler/shader/opt_redundant_jumps.cpp
187 compiler/shader/opt_structure_splitting.cpp
188 compiler/shader/opt_swizzle_swizzle.cpp
189 compiler/shader/opt_tree_grafting.cpp
190 compiler/shader/opt_vectorize.cpp
191 compiler/shader/s_expression.cpp
192# compiler/shader/shader_deserialize.cpp
193# compiler/shader/shader_serialize.cpp
194# compiler/shader/standalone_scaffolding.cpp
195 compiler/shader/strtod.cpp
196
197 compiler/mesa-utils/src/glsl/ralloc.c
198 compiler/mesa-utils/src/mesa/program/program.c
199# compiler/mesa-utils/src/mesa/program/prog_execute.c
200 # compiler/mesa-utils/src/mesa/program/prog_noise.c
Steve Kda224042014-09-19 08:46:17 -0600201 compiler/mesa-utils/src/mesa/program/prog_statevars.c
Cody Northrope8455b12014-09-17 16:18:12 -0600202 # compiler/mesa-utils/src/mesa/program/prog_opt_constant_fold.c
203 compiler/mesa-utils/src/mesa/program/symbol_table.c
Steve Kda224042014-09-19 08:46:17 -0600204# compiler/mesa-utils/src/mesa/program/prog_cache.c
Cody Northrope8455b12014-09-17 16:18:12 -0600205 compiler/mesa-utils/src/mesa/program/prog_instruction.c
206 # compiler/mesa-utils/src/mesa/program/prog_optimize.c
207 # compiler/mesa-utils/src/mesa/program/arbprogparse.c
208 compiler/mesa-utils/src/mesa/program/prog_hash_table.c
209 compiler/mesa-utils/src/mesa/program/prog_parameter.c
210 # compiler/mesa-utils/src/mesa/program/prog_diskcache.c
211 # compiler/mesa-utils/src/mesa/program/program_parse.tab.c
212 # compiler/mesa-utils/src/mesa/program/programopt.c
213 # compiler/mesa-utils/src/mesa/program/prog_print.c
214 # compiler/mesa-utils/src/mesa/program/program_parse_extra.c
215 # compiler/mesa-utils/src/mesa/program/prog_parameter_layout.c
Cody Northropbc851432014-09-23 10:06:32 -0600216 compiler/mesa-utils/src/mesa/program/register_allocate.c
Cody Northrope8455b12014-09-17 16:18:12 -0600217 # compiler/mesa-utils/src/mesa/math/m_matrix.c
218 # compiler/mesa-utils/src/mesa/main/enums.c
219 # compiler/mesa-utils/src/mesa/main/imports.c
220 compiler/mesa-utils/src/mesa/main/hash.c
221 compiler/mesa-utils/src/mesa/main/hash_table.c
222 # compiler/mesa-utils/src/mesa/main/errors.c
223 # compiler/mesa-utils/src/mesa/main/formats.c
224
225 compiler/mesa-utils/src/mesa/main/errors.c
226 # compiler/mesa-utils/src/mesa/main/context.c
227 compiler/mesa-utils/src/mesa/main/enums.c
228 compiler/mesa-utils/src/mesa/main/imports.c
229 compiler/mesa-utils/src/mesa/main/version.c
230
Cody Northrop0eb5eea2014-09-19 15:11:52 -0600231 #compiler/mesa-utils/src/mesa/main/shaderobj.c
232
Cody Northrope8455b12014-09-17 16:18:12 -0600233 compiler/shader/glsl_glass_manager.cpp
234 compiler/shader/glsl_glass_backend_translator.cpp
235 compiler/shader/glsl_glass_backend.cpp
236
237 compiler/shader/glsl_parser_extras.cpp
238 compiler/shader/ossource.cpp
239 compiler/shader/standalone_scaffolding.cpp
240 compiler/shader/glsl_types.cpp
241 compiler/shader/glsl_symbol_table.cpp
242 compiler/shader/hir_field_selection.cpp
243
Cody Northrop0eb5eea2014-09-19 15:11:52 -0600244 compiler/shader/compiler_interface.cpp
245
Cody Northropbc851432014-09-23 10:06:32 -0600246 # File required for backend compiler
247 compiler/pipeline/pipeline_compiler_interface.cpp
248 compiler/pipeline/brw_shader.cpp
249 compiler/pipeline/brw_fs.cpp
250 compiler/pipeline/brw_fs_visitor.cpp
251 compiler/pipeline/brw_fs_live_variables.cpp
252 compiler/pipeline/brw_cfg.cpp
253 compiler/pipeline/brw_fs_cse.cpp
254 compiler/pipeline/brw_fs_copy_propagation.cpp
255 compiler/pipeline/brw_fs_peephole_predicated_break.cpp
256 compiler/pipeline/brw_fs_dead_code_eliminate.cpp
257 compiler/pipeline/brw_fs_sel_peephole.cpp
258 compiler/pipeline/brw_dead_control_flow.cpp
259 compiler/pipeline/brw_fs_saturate_propagation.cpp
260 compiler/pipeline/brw_fs_register_coalesce.cpp
261 compiler/pipeline/brw_schedule_instructions.cpp
262 compiler/pipeline/brw_fs_reg_allocate.cpp
263 compiler/pipeline/brw_fs_generator.cpp
264 compiler/pipeline/brw_lower_texture_gradients.cpp
265 compiler/pipeline/brw_cubemap_normalize.cpp
266 compiler/pipeline/brw_lower_unnormalized_offset.cpp
267 compiler/pipeline/brw_fs_channel_expressions.cpp
268 compiler/pipeline/brw_fs_vector_splitting.cpp
Cody Northrope8455b12014-09-17 16:18:12 -0600269
Cody Northropbc851432014-09-23 10:06:32 -0600270 #compiler/pipeline/brw_vs.c
271 compiler/pipeline/brw_disasm.c
272 compiler/pipeline/brw_device_info.c
273 compiler/pipeline/brw_eu.c
274 compiler/pipeline/brw_program.c
275 compiler/pipeline/brw_wm.c
276 compiler/pipeline/brw_eu_emit.c
277 compiler/pipeline/brw_eu_compact.c
278 compiler/pipeline/intel_debug.c
Cody Northrope8455b12014-09-17 16:18:12 -0600279 )
280
281SET(STANDALONE_COMPILER_SOURCES
282 compiler/shader/main.cpp
283 ${COMPILER_SOURCES}
Chia-I Wu155be032014-08-02 09:14:28 +0800284)
285
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600286SET(SOURCES
Chia-I Wu09142132014-08-11 15:42:55 +0800287 cmd.c
Chia-I Wu00b51a82014-09-09 12:07:37 +0800288 cmd_decode.c
Chia-I Wuc14d1562014-10-17 09:49:22 +0800289 cmd_meta.c
Chia-I Wu31ecdc72014-08-31 12:58:56 +0800290 cmd_mi.c
Chia-I Wu525c6602014-08-27 10:22:34 +0800291 cmd_prepare.c
Chia-I Wub2755562014-08-20 13:38:52 +0800292 cmd_pipeline.c
Chia-I Wue54854a2014-08-05 10:23:50 +0800293 dev.c
Chia-I Wude2bb862014-08-19 14:32:47 +0800294 dispatch.c
Chia-I Wu75577d92014-08-11 10:54:33 +0800295 dset.c
Chia-I Wu41be94b2014-08-19 14:46:02 +0800296 intel.c
Chia-I Wu9737a102014-08-07 07:59:51 +0800297 event.c
Chia-I Wubdf4c562014-08-07 06:36:33 +0800298 fence.c
Chia-I Wuac6ba132014-08-07 14:21:43 +0800299 format.c
Chia-I Wu214dac62014-08-05 11:07:40 +0800300 gpu.c
Chia-I Wufeb441f2014-08-08 21:27:38 +0800301 img.c
Chia-I Wu8a8d8b62014-08-14 13:26:26 +0800302 layout.c
Chia-I Wuf9911eb2014-08-06 13:50:31 +0800303 mem.c
Chia-I Wu82f50aa2014-08-05 10:43:03 +0800304 obj.c
Courtney Goeltzenleuchter05a60542014-08-15 14:54:34 -0600305 pipeline.c
Chia-I Wu6b4b2782014-09-02 13:11:32 +0800306 pipeline_shader.c
Chia-I Wue18ff1b2014-08-07 13:38:51 +0800307 query.c
Chia-I Wue09b5362014-08-07 09:25:14 +0800308 queue.c
Chia-I Wu28b89962014-08-18 14:40:49 +0800309 sampler.c
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -0600310 shader.c
Chia-I Wua5714e82014-08-11 15:33:42 +0800311 state.c
Chia-I Wu5a323262014-08-11 10:31:53 +0800312 view.c
Chia-I Wu770b3092014-08-05 14:22:03 +0800313 kmd/winsys_drm.c
Cody Northrope8455b12014-09-17 16:18:12 -0600314 ${COMPILER_SOURCES}
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600315 )
316
Chia-I Wub5e95f92014-09-23 15:36:53 +0800317pkg_check_modules(DRI3 xcb xcb-dri3 xcb-present)
Chia-I Wu1db76e02014-09-15 14:21:14 +0800318if (DRI3_FOUND)
319 add_definitions(-DENABLE_WSI_X11)
320 include_directories(${DRI3_INCLUDE_DIRS})
321 link_directories(${DRI3_LIBRARY_DIRS})
322 link_libraries(${DRI3_LIBRARIES})
323 set(SOURCES ${SOURCES} wsi_x11.c)
324endif()
325
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -0600326add_library(XGL_i965 SHARED
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600327 ${SOURCES}
Chia-I Wu3065c9c2014-08-04 06:28:31 +0800328 $<TARGET_OBJECTS:icd>
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -0600329 )
Cody Northrope8455b12014-09-17 16:18:12 -0600330
331add_executable(xglCompiler
332 ${STANDALONE_COMPILER_SOURCES}
333)