blob: 06c1c1f579b132aeaa91693ebe94ecc7a6c6d088 [file] [log] [blame]
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -06001# Create the i965 XGL DRI library
Cody Northrope8455b12014-09-17 16:18:12 -06002add_definitions(-D_GNU_SOURCE -DHAVE_PTHREAD)
3add_definitions(-DUSE_LUNARGLASS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS)
4
5# Hard code our LunarGLASS and glslang paths for now
6SET(GLSLANG_PREFIX_REL ../../../glslang)
7SET(LUNARGLASS_PREFIX_REL ../../../LunarGLASS)
8
9get_filename_component(GLSLANG_PREFIX ${GLSLANG_PREFIX_REL} ABSOLUTE)
10get_filename_component(LUNARGLASS_PREFIX ${LUNARGLASS_PREFIX_REL} ABSOLUTE)
11
12# LunarG TODO: Get the llvm-config flags hooked up correctly and remove extra definitions from above
13
14#execute_process(COMMAND ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/bin/llvm-config --cxxflags OUTPUT_VARIABLE LLVM_CXX_CONFIG_ALL)
15#string(REPLACE "-Woverloaded-virtual" "" LLVM_CXX_CONFIG_1 ${LLVM_CXX_CONFIG_ALL})
16#string(REPLACE "-fvisibility-inlines-hidden" "" LLVM_CXX_CONFIG ${LLVM_CXX_CONFIG_1})
17
18#message(STATUS "llvm-config results")
19#message(STATUS ${LLVM_CXX_CONFIG})
20
21#set_target_properties($<TARGET_OBJECTS:icd>
22# PROPERTIES
23# COMPILE_FLAGS "${LLVM_CXX_CONFIG}")
24
Steve K14e09812014-09-19 09:45:36 -060025execute_process(COMMAND ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/bin/llvm-config --libs engine bitwriter
26 OUTPUT_VARIABLE LLVM_LIBS_ALL_1
27 RESULT_VARIABLE LLVM_LIBS_RESULT)
28
29if(NOT ${LLVM_LIBS_RESULT} EQUAL 0)
30 message(FATAL_ERROR "llvm-config failed.")
31endif()
32
Cody Northrope8455b12014-09-17 16:18:12 -060033string(REPLACE "\n" "" LLVM_LIBS_ALL ${LLVM_LIBS_ALL_1})
Cody Northrope8455b12014-09-17 16:18:12 -060034
35SET(COMPILER_LINK_DIRS
36 ${GLSLANG_PREFIX}/build/install/lib
37 ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/lib
38 ${LUNARGLASS_PREFIX}/build/Core
39 ${LUNARGLASS_PREFIX}/build/Frontends/glslang
40 ${LUNARGLASS_PREFIX}/build/Core/Passes/Transforms
41 ${LUNARGLASS_PREFIX}/build/Core/Passes/Immutable
42 ${LUNARGLASS_PREFIX}/build/Core/Passes/Analysis
43 ${LUNARGLASS_PREFIX}/build/Core/Passes/Util
44)
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -060045
Chia-I Wuddbc8e22014-09-18 17:05:09 +080046pkg_check_modules(DRM REQUIRED libdrm libdrm_intel)
47
Cody Northrope8455b12014-09-17 16:18:12 -060048link_directories (
49 ${ICD_LIBRARY_DIRS}
50 ${DRM_LIBRARY_DIRS}
51 ${COMPILER_LINK_DIRS}
Chia-I Wuddbc8e22014-09-18 17:05:09 +080052)
53
Cody Northrope8455b12014-09-17 16:18:12 -060054SET(COMPILER_LIBS
55 glslangFrontend
56 core
57 LLVMipo
58 glslang
59 OGLCompiler
60 ${LLVM_LIBS_ALL}
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -060061)
62
63link_libraries (
Cody Northrope8455b12014-09-17 16:18:12 -060064 ${ICD_LIBRARIES}
65 ${DRM_LIBRARIES}
66 ${COMPILER_LIBS}
67 m
Steve Kda224042014-09-19 08:46:17 -060068 pthread
69 dl
Cody Northrope8455b12014-09-17 16:18:12 -060070)
71
72SET(COMPILER_INCLUDE_DIRS
73 ${GLSLANG_PREFIX}
74 ${LUNARGLASS_PREFIX}/Core/LLVM/llvm-3.4/build/install/usr/local/include
75 ${LUNARGLASS_PREFIX}
76 compiler/mesa-utils/include
77 compiler/mesa-utils/src/glsl
78 compiler/mesa-utils/src/mesa
79 compiler/mesa-utils/src/mapi
80)
81
82include_directories (
83 ${ICD_INCLUDE_DIRS}
84 ${DRM_INCLUDE_DIRS}
85 ${COMPILER_INCLUDE_DIRS}
86)
87
88
89SET(COMPILER_SOURCES
90 compiler/shader/ast_array_index.cpp
91 compiler/shader/ast_expr.cpp
92 compiler/shader/ast_function.cpp
93 compiler/shader/ast_to_hir.cpp
94 compiler/shader/ast_type.cpp
95 compiler/shader/builtin_functions.cpp
96 compiler/shader/builtin_types.cpp
97 compiler/shader/builtin_variables.cpp
98 compiler/shader/ir.cpp
99 compiler/shader/ir_basic_block.cpp
100 compiler/shader/ir_builder.cpp
101 compiler/shader/ir_clone.cpp
102 compiler/shader/ir_constant_expression.cpp
103 compiler/shader/ir_deserializer.cpp
104 compiler/shader/ir_equals.cpp
105 compiler/shader/ir_expression_flattening.cpp
106 compiler/shader/ir_function_can_inline.cpp
107 compiler/shader/ir_function.cpp
108 compiler/shader/ir_function_detect_recursion.cpp
109 compiler/shader/ir_hierarchical_visitor.cpp
110 compiler/shader/ir_hv_accept.cpp
111 compiler/shader/ir_import_prototypes.cpp
112 compiler/shader/ir_print_visitor.cpp
113 compiler/shader/ir_reader.cpp
114 compiler/shader/ir_rvalue_visitor.cpp
115 compiler/shader/ir_serialize.cpp
116 compiler/shader/ir_set_program_inouts.cpp
117 compiler/shader/ir_validate.cpp
118 compiler/shader/ir_variable_refcount.cpp
119 compiler/shader/link_atomics.cpp
120 compiler/shader/linker.cpp
121 compiler/shader/link_functions.cpp
122 compiler/shader/link_interface_blocks.cpp
123 compiler/shader/link_uniform_block_active_visitor.cpp
124 compiler/shader/link_uniform_blocks.cpp
125 compiler/shader/link_uniform_initializers.cpp
126 compiler/shader/link_uniforms.cpp
127 compiler/shader/link_varyings.cpp
128 compiler/shader/loop_analysis.cpp
129 compiler/shader/loop_controls.cpp
130 compiler/shader/loop_unroll.cpp
131 compiler/shader/lower_clip_distance.cpp
132 compiler/shader/lower_discard.cpp
133 compiler/shader/lower_discard_flow.cpp
134 compiler/shader/lower_if_to_cond_assign.cpp
135 compiler/shader/lower_instructions.cpp
136 compiler/shader/lower_jumps.cpp
137 compiler/shader/lower_mat_op_to_vec.cpp
138 compiler/shader/lower_named_interface_blocks.cpp
139 compiler/shader/lower_noise.cpp
140 compiler/shader/lower_offset_array.cpp
141 compiler/shader/lower_output_reads.cpp
142 compiler/shader/lower_packed_varyings.cpp
143 compiler/shader/lower_packing_builtins.cpp
144 compiler/shader/lower_texture_projection.cpp
145 compiler/shader/lower_ubo_reference.cpp
146 compiler/shader/lower_variable_index_to_cond_assign.cpp
147 compiler/shader/lower_vec_index_to_cond_assign.cpp
148 compiler/shader/lower_vec_index_to_swizzle.cpp
149 compiler/shader/lower_vector.cpp
150 compiler/shader/lower_vector_insert.cpp
151 compiler/shader/opt_algebraic.cpp
152 compiler/shader/opt_array_splitting.cpp
153 compiler/shader/opt_constant_folding.cpp
154 compiler/shader/opt_constant_propagation.cpp
155 compiler/shader/opt_constant_variable.cpp
156 compiler/shader/opt_copy_propagation.cpp
157 compiler/shader/opt_copy_propagation_elements.cpp
158 compiler/shader/opt_cse.cpp
159 compiler/shader/opt_dead_builtin_varyings.cpp
160 compiler/shader/opt_dead_code.cpp
161 compiler/shader/opt_dead_code_local.cpp
162 compiler/shader/opt_dead_functions.cpp
163 compiler/shader/opt_flatten_nested_if_blocks.cpp
164 compiler/shader/opt_flip_matrices.cpp
165 compiler/shader/opt_function_inlining.cpp
166 compiler/shader/opt_if_simplification.cpp
167 compiler/shader/opt_noop_swizzle.cpp
168 compiler/shader/opt_redundant_jumps.cpp
169 compiler/shader/opt_structure_splitting.cpp
170 compiler/shader/opt_swizzle_swizzle.cpp
171 compiler/shader/opt_tree_grafting.cpp
172 compiler/shader/opt_vectorize.cpp
173 compiler/shader/s_expression.cpp
174# compiler/shader/shader_deserialize.cpp
175# compiler/shader/shader_serialize.cpp
176# compiler/shader/standalone_scaffolding.cpp
177 compiler/shader/strtod.cpp
178
179 compiler/mesa-utils/src/glsl/ralloc.c
180 compiler/mesa-utils/src/mesa/program/program.c
181# compiler/mesa-utils/src/mesa/program/prog_execute.c
182 # compiler/mesa-utils/src/mesa/program/prog_noise.c
Steve Kda224042014-09-19 08:46:17 -0600183 compiler/mesa-utils/src/mesa/program/prog_statevars.c
Cody Northrope8455b12014-09-17 16:18:12 -0600184 # compiler/mesa-utils/src/mesa/program/prog_opt_constant_fold.c
185 compiler/mesa-utils/src/mesa/program/symbol_table.c
Steve Kda224042014-09-19 08:46:17 -0600186# compiler/mesa-utils/src/mesa/program/prog_cache.c
Cody Northrope8455b12014-09-17 16:18:12 -0600187 compiler/mesa-utils/src/mesa/program/prog_instruction.c
188 # compiler/mesa-utils/src/mesa/program/prog_optimize.c
189 # compiler/mesa-utils/src/mesa/program/arbprogparse.c
190 compiler/mesa-utils/src/mesa/program/prog_hash_table.c
191 compiler/mesa-utils/src/mesa/program/prog_parameter.c
192 # compiler/mesa-utils/src/mesa/program/prog_diskcache.c
193 # compiler/mesa-utils/src/mesa/program/program_parse.tab.c
194 # compiler/mesa-utils/src/mesa/program/programopt.c
195 # compiler/mesa-utils/src/mesa/program/prog_print.c
196 # compiler/mesa-utils/src/mesa/program/program_parse_extra.c
197 # compiler/mesa-utils/src/mesa/program/prog_parameter_layout.c
198 # compiler/mesa-utils/src/mesa/program/register_allocate.c
199 # compiler/mesa-utils/src/mesa/math/m_matrix.c
200 # compiler/mesa-utils/src/mesa/main/enums.c
201 # compiler/mesa-utils/src/mesa/main/imports.c
202 compiler/mesa-utils/src/mesa/main/hash.c
203 compiler/mesa-utils/src/mesa/main/hash_table.c
204 # compiler/mesa-utils/src/mesa/main/errors.c
205 # compiler/mesa-utils/src/mesa/main/formats.c
206
207 compiler/mesa-utils/src/mesa/main/errors.c
208 # compiler/mesa-utils/src/mesa/main/context.c
209 compiler/mesa-utils/src/mesa/main/enums.c
210 compiler/mesa-utils/src/mesa/main/imports.c
211 compiler/mesa-utils/src/mesa/main/version.c
212
213 compiler/shader/glsl_glass_manager.cpp
214 compiler/shader/glsl_glass_backend_translator.cpp
215 compiler/shader/glsl_glass_backend.cpp
216
217 compiler/shader/glsl_parser_extras.cpp
218 compiler/shader/ossource.cpp
219 compiler/shader/standalone_scaffolding.cpp
220 compiler/shader/glsl_types.cpp
221 compiler/shader/glsl_symbol_table.cpp
222 compiler/shader/hir_field_selection.cpp
223
224
225 )
226
227SET(STANDALONE_COMPILER_SOURCES
228 compiler/shader/main.cpp
229 ${COMPILER_SOURCES}
Chia-I Wu155be032014-08-02 09:14:28 +0800230)
231
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600232SET(SOURCES
Chia-I Wu09142132014-08-11 15:42:55 +0800233 cmd.c
Chia-I Wu00b51a82014-09-09 12:07:37 +0800234 cmd_decode.c
Chia-I Wuc14d1562014-10-17 09:49:22 +0800235 cmd_meta.c
Chia-I Wu31ecdc72014-08-31 12:58:56 +0800236 cmd_mi.c
Chia-I Wu525c6602014-08-27 10:22:34 +0800237 cmd_prepare.c
Chia-I Wub2755562014-08-20 13:38:52 +0800238 cmd_pipeline.c
Chia-I Wue54854a2014-08-05 10:23:50 +0800239 dev.c
Chia-I Wude2bb862014-08-19 14:32:47 +0800240 dispatch.c
Chia-I Wu75577d92014-08-11 10:54:33 +0800241 dset.c
Chia-I Wu41be94b2014-08-19 14:46:02 +0800242 intel.c
Chia-I Wu9737a102014-08-07 07:59:51 +0800243 event.c
Chia-I Wubdf4c562014-08-07 06:36:33 +0800244 fence.c
Chia-I Wuac6ba132014-08-07 14:21:43 +0800245 format.c
Chia-I Wu214dac62014-08-05 11:07:40 +0800246 gpu.c
Chia-I Wufeb441f2014-08-08 21:27:38 +0800247 img.c
Chia-I Wu8a8d8b62014-08-14 13:26:26 +0800248 layout.c
Chia-I Wuf9911eb2014-08-06 13:50:31 +0800249 mem.c
Chia-I Wu82f50aa2014-08-05 10:43:03 +0800250 obj.c
Courtney Goeltzenleuchter05a60542014-08-15 14:54:34 -0600251 pipeline.c
Chia-I Wu6b4b2782014-09-02 13:11:32 +0800252 pipeline_shader.c
Chia-I Wue18ff1b2014-08-07 13:38:51 +0800253 query.c
Chia-I Wue09b5362014-08-07 09:25:14 +0800254 queue.c
Chia-I Wu28b89962014-08-18 14:40:49 +0800255 sampler.c
Courtney Goeltzenleuchter52ec3362014-08-19 11:52:02 -0600256 shader.c
Chia-I Wua5714e82014-08-11 15:33:42 +0800257 state.c
Chia-I Wu5a323262014-08-11 10:31:53 +0800258 view.c
Chia-I Wu770b3092014-08-05 14:22:03 +0800259 kmd/winsys_drm.c
Cody Northrope8455b12014-09-17 16:18:12 -0600260 ${COMPILER_SOURCES}
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600261 )
262
Chia-I Wub5e95f92014-09-23 15:36:53 +0800263pkg_check_modules(DRI3 xcb xcb-dri3 xcb-present)
Chia-I Wu1db76e02014-09-15 14:21:14 +0800264if (DRI3_FOUND)
265 add_definitions(-DENABLE_WSI_X11)
266 include_directories(${DRI3_INCLUDE_DIRS})
267 link_directories(${DRI3_LIBRARY_DIRS})
268 link_libraries(${DRI3_LIBRARIES})
269 set(SOURCES ${SOURCES} wsi_x11.c)
270endif()
271
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -0600272add_library(XGL_i965 SHARED
Courtney Goeltzenleuchtercec72952014-08-01 18:06:40 -0600273 ${SOURCES}
Chia-I Wu3065c9c2014-08-04 06:28:31 +0800274 $<TARGET_OBJECTS:icd>
Courtney Goeltzenleuchtere06e72d2014-08-01 12:44:23 -0600275 )
Cody Northrope8455b12014-09-17 16:18:12 -0600276
277add_executable(xglCompiler
278 ${STANDALONE_COMPILER_SOURCES}
279)