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