blob: c767a98e97efd4ab09e061dcf4edc64cdb2b0aa8 [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 Northrope8455b12014-09-17 16:18:12 -060091 compiler/mesa-utils/include
92 compiler/mesa-utils/src/glsl
93 compiler/mesa-utils/src/mesa
94 compiler/mesa-utils/src/mapi
95)
96
97include_directories (
98 ${ICD_INCLUDE_DIRS}
99 ${DRM_INCLUDE_DIRS}
100 ${COMPILER_INCLUDE_DIRS}
101)
102
103
104SET(COMPILER_SOURCES
105 compiler/shader/ast_array_index.cpp
106 compiler/shader/ast_expr.cpp
107 compiler/shader/ast_function.cpp
108 compiler/shader/ast_to_hir.cpp
109 compiler/shader/ast_type.cpp
110 compiler/shader/builtin_functions.cpp
111 compiler/shader/builtin_types.cpp
112 compiler/shader/builtin_variables.cpp
113 compiler/shader/ir.cpp
114 compiler/shader/ir_basic_block.cpp
115 compiler/shader/ir_builder.cpp
116 compiler/shader/ir_clone.cpp
117 compiler/shader/ir_constant_expression.cpp
118 compiler/shader/ir_deserializer.cpp
119 compiler/shader/ir_equals.cpp
120 compiler/shader/ir_expression_flattening.cpp
121 compiler/shader/ir_function_can_inline.cpp
122 compiler/shader/ir_function.cpp
123 compiler/shader/ir_function_detect_recursion.cpp
124 compiler/shader/ir_hierarchical_visitor.cpp
125 compiler/shader/ir_hv_accept.cpp
126 compiler/shader/ir_import_prototypes.cpp
127 compiler/shader/ir_print_visitor.cpp
128 compiler/shader/ir_reader.cpp
129 compiler/shader/ir_rvalue_visitor.cpp
130 compiler/shader/ir_serialize.cpp
131 compiler/shader/ir_set_program_inouts.cpp
132 compiler/shader/ir_validate.cpp
133 compiler/shader/ir_variable_refcount.cpp
134 compiler/shader/link_atomics.cpp
135 compiler/shader/linker.cpp
136 compiler/shader/link_functions.cpp
137 compiler/shader/link_interface_blocks.cpp
138 compiler/shader/link_uniform_block_active_visitor.cpp
139 compiler/shader/link_uniform_blocks.cpp
140 compiler/shader/link_uniform_initializers.cpp
141 compiler/shader/link_uniforms.cpp
142 compiler/shader/link_varyings.cpp
143 compiler/shader/loop_analysis.cpp
144 compiler/shader/loop_controls.cpp
145 compiler/shader/loop_unroll.cpp
146 compiler/shader/lower_clip_distance.cpp
147 compiler/shader/lower_discard.cpp
148 compiler/shader/lower_discard_flow.cpp
149 compiler/shader/lower_if_to_cond_assign.cpp
150 compiler/shader/lower_instructions.cpp
151 compiler/shader/lower_jumps.cpp
152 compiler/shader/lower_mat_op_to_vec.cpp
153 compiler/shader/lower_named_interface_blocks.cpp
154 compiler/shader/lower_noise.cpp
155 compiler/shader/lower_offset_array.cpp
156 compiler/shader/lower_output_reads.cpp
157 compiler/shader/lower_packed_varyings.cpp
158 compiler/shader/lower_packing_builtins.cpp
159 compiler/shader/lower_texture_projection.cpp
160 compiler/shader/lower_ubo_reference.cpp
161 compiler/shader/lower_variable_index_to_cond_assign.cpp
162 compiler/shader/lower_vec_index_to_cond_assign.cpp
163 compiler/shader/lower_vec_index_to_swizzle.cpp
164 compiler/shader/lower_vector.cpp
165 compiler/shader/lower_vector_insert.cpp
166 compiler/shader/opt_algebraic.cpp
167 compiler/shader/opt_array_splitting.cpp
168 compiler/shader/opt_constant_folding.cpp
169 compiler/shader/opt_constant_propagation.cpp
170 compiler/shader/opt_constant_variable.cpp
171 compiler/shader/opt_copy_propagation.cpp
172 compiler/shader/opt_copy_propagation_elements.cpp
173 compiler/shader/opt_cse.cpp
174 compiler/shader/opt_dead_builtin_varyings.cpp
175 compiler/shader/opt_dead_code.cpp
176 compiler/shader/opt_dead_code_local.cpp
177 compiler/shader/opt_dead_functions.cpp
178 compiler/shader/opt_flatten_nested_if_blocks.cpp
179 compiler/shader/opt_flip_matrices.cpp
180 compiler/shader/opt_function_inlining.cpp
181 compiler/shader/opt_if_simplification.cpp
182 compiler/shader/opt_noop_swizzle.cpp
183 compiler/shader/opt_redundant_jumps.cpp
184 compiler/shader/opt_structure_splitting.cpp
185 compiler/shader/opt_swizzle_swizzle.cpp
186 compiler/shader/opt_tree_grafting.cpp
187 compiler/shader/opt_vectorize.cpp
188 compiler/shader/s_expression.cpp
189# compiler/shader/shader_deserialize.cpp
190# compiler/shader/shader_serialize.cpp
191# compiler/shader/standalone_scaffolding.cpp
192 compiler/shader/strtod.cpp
193
194 compiler/mesa-utils/src/glsl/ralloc.c
195 compiler/mesa-utils/src/mesa/program/program.c
196# compiler/mesa-utils/src/mesa/program/prog_execute.c
197 # compiler/mesa-utils/src/mesa/program/prog_noise.c
Steve Kda224042014-09-19 08:46:17 -0600198 compiler/mesa-utils/src/mesa/program/prog_statevars.c
Cody Northrope8455b12014-09-17 16:18:12 -0600199 # compiler/mesa-utils/src/mesa/program/prog_opt_constant_fold.c
200 compiler/mesa-utils/src/mesa/program/symbol_table.c
Steve Kda224042014-09-19 08:46:17 -0600201# compiler/mesa-utils/src/mesa/program/prog_cache.c
Cody Northrope8455b12014-09-17 16:18:12 -0600202 compiler/mesa-utils/src/mesa/program/prog_instruction.c
203 # compiler/mesa-utils/src/mesa/program/prog_optimize.c
204 # compiler/mesa-utils/src/mesa/program/arbprogparse.c
205 compiler/mesa-utils/src/mesa/program/prog_hash_table.c
206 compiler/mesa-utils/src/mesa/program/prog_parameter.c
207 # compiler/mesa-utils/src/mesa/program/prog_diskcache.c
208 # compiler/mesa-utils/src/mesa/program/program_parse.tab.c
209 # compiler/mesa-utils/src/mesa/program/programopt.c
210 # compiler/mesa-utils/src/mesa/program/prog_print.c
211 # compiler/mesa-utils/src/mesa/program/program_parse_extra.c
212 # compiler/mesa-utils/src/mesa/program/prog_parameter_layout.c
213 # compiler/mesa-utils/src/mesa/program/register_allocate.c
214 # compiler/mesa-utils/src/mesa/math/m_matrix.c
215 # compiler/mesa-utils/src/mesa/main/enums.c
216 # compiler/mesa-utils/src/mesa/main/imports.c
217 compiler/mesa-utils/src/mesa/main/hash.c
218 compiler/mesa-utils/src/mesa/main/hash_table.c
219 # compiler/mesa-utils/src/mesa/main/errors.c
220 # compiler/mesa-utils/src/mesa/main/formats.c
221
222 compiler/mesa-utils/src/mesa/main/errors.c
223 # compiler/mesa-utils/src/mesa/main/context.c
224 compiler/mesa-utils/src/mesa/main/enums.c
225 compiler/mesa-utils/src/mesa/main/imports.c
226 compiler/mesa-utils/src/mesa/main/version.c
227
Cody Northrop0eb5eea2014-09-19 15:11:52 -0600228 #compiler/mesa-utils/src/mesa/main/shaderobj.c
229
Cody Northrope8455b12014-09-17 16:18:12 -0600230 compiler/shader/glsl_glass_manager.cpp
231 compiler/shader/glsl_glass_backend_translator.cpp
232 compiler/shader/glsl_glass_backend.cpp
233
234 compiler/shader/glsl_parser_extras.cpp
235 compiler/shader/ossource.cpp
236 compiler/shader/standalone_scaffolding.cpp
237 compiler/shader/glsl_types.cpp
238 compiler/shader/glsl_symbol_table.cpp
239 compiler/shader/hir_field_selection.cpp
240
Cody Northrop0eb5eea2014-09-19 15:11:52 -0600241 compiler/shader/compiler_interface.cpp
242
Cody Northrope8455b12014-09-17 16:18:12 -0600243
244 )
245
246SET(STANDALONE_COMPILER_SOURCES
247 compiler/shader/main.cpp
248 ${COMPILER_SOURCES}
Chia-I Wu155be032014-08-02 09:14:28 +0800249)
250
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600251SET(SOURCES
Chia-I Wu09142132014-08-11 15:42:55 +0800252 cmd.c
Chia-I Wu00b51a82014-09-09 12:07:37 +0800253 cmd_decode.c
Chia-I Wuc14d1562014-10-17 09:49:22 +0800254 cmd_meta.c
Chia-I Wu31ecdc72014-08-31 12:58:56 +0800255 cmd_mi.c
Chia-I Wu525c6602014-08-27 10:22:34 +0800256 cmd_prepare.c
Chia-I Wub2755562014-08-20 13:38:52 +0800257 cmd_pipeline.c
Chia-I Wue54854a2014-08-05 10:23:50 +0800258 dev.c
Chia-I Wude2bb862014-08-19 14:32:47 +0800259 dispatch.c
Chia-I Wu75577d92014-08-11 10:54:33 +0800260 dset.c
Chia-I Wu41be94b2014-08-19 14:46:02 +0800261 intel.c
Chia-I Wu9737a102014-08-07 07:59:51 +0800262 event.c
Chia-I Wubdf4c562014-08-07 06:36:33 +0800263 fence.c
Chia-I Wuac6ba132014-08-07 14:21:43 +0800264 format.c
Chia-I Wu214dac62014-08-05 11:07:40 +0800265 gpu.c
Chia-I Wufeb441f2014-08-08 21:27:38 +0800266 img.c
Chia-I Wu8a8d8b62014-08-14 13:26:26 +0800267 layout.c
Chia-I Wuf9911eb2014-08-06 13:50:31 +0800268 mem.c
Chia-I Wu82f50aa2014-08-05 10:43:03 +0800269 obj.c
Courtney Goeltzenleuchter05a60542014-08-15 14:54:34 -0600270 pipeline.c
Chia-I Wu6b4b2782014-09-02 13:11:32 +0800271 pipeline_shader.c
Chia-I Wue18ff1b2014-08-07 13:38:51 +0800272 query.c
Chia-I Wue09b5362014-08-07 09:25:14 +0800273 queue.c
Chia-I Wu28b89962014-08-18 14:40:49 +0800274 sampler.c
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -0600275 shader.c
Chia-I Wua5714e82014-08-11 15:33:42 +0800276 state.c
Chia-I Wu5a323262014-08-11 10:31:53 +0800277 view.c
Chia-I Wu770b3092014-08-05 14:22:03 +0800278 kmd/winsys_drm.c
Cody Northrope8455b12014-09-17 16:18:12 -0600279 ${COMPILER_SOURCES}
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600280 )
281
Chia-I Wub5e95f92014-09-23 15:36:53 +0800282pkg_check_modules(DRI3 xcb xcb-dri3 xcb-present)
Chia-I Wu1db76e02014-09-15 14:21:14 +0800283if (DRI3_FOUND)
284 add_definitions(-DENABLE_WSI_X11)
285 include_directories(${DRI3_INCLUDE_DIRS})
286 link_directories(${DRI3_LIBRARY_DIRS})
287 link_libraries(${DRI3_LIBRARIES})
288 set(SOURCES ${SOURCES} wsi_x11.c)
289endif()
290
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -0600291add_library(XGL_i965 SHARED
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600292 ${SOURCES}
Chia-I Wu3065c9c2014-08-04 06:28:31 +0800293 $<TARGET_OBJECTS:icd>
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -0600294 )
Cody Northrope8455b12014-09-17 16:18:12 -0600295
296add_executable(xglCompiler
297 ${STANDALONE_COMPILER_SOURCES}
298)