-
Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathCMakeLists.txt
1470 lines (1356 loc) · 42.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright (c) 2006, 2025, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is designed to work with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have either included with
# the program or referenced in the documentation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
ADD_WSHADOW_WARNING()
# Lots of warnings about -Walloc-size-larger-than= from my_malloc.cc
# but it is basically impossible to trace the actual origin.
IF(FPROFILE_GENERATE OR FPROFILE_USE OR
CMAKE_COMPILER_FLAG_WITH_LTO OR WITH_LTO)
IF(MY_COMPILER_IS_GNU)
# -Walloc-size-larger-than=PTRDIFF_MAX is enabled by default.
STRING_APPEND(CMAKE_EXE_LINKER_FLAGS " -Wno-alloc-size-larger-than")
# In functions generated by protobuf:
STRING_APPEND(CMAKE_EXE_LINKER_FLAGS " -Wno-stringop-overflow")
ENDIF()
ENDIF()
# Array indexing with pland_idx == int8 gives warnings.
IF(SOLARIS AND MY_COMPILER_IS_GNU_OR_CLANG)
ADD_COMPILE_OPTIONS("-Wno-char-subscripts")
ENDIF()
SET(CONF_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc
)
SET(GEN_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.h
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.h
${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc
${CMAKE_CURRENT_BINARY_DIR}/lex_hash.h
)
SET(GEN_DIGEST_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
)
SET(GEN_KEYWORD_LIST_SOURCES
${CMAKE_CURRENT_BINARY_DIR}/keyword_list.h
)
SET_SOURCE_FILES_PROPERTIES(
${GEN_SOURCES}
${GEN_DIGEST_SOURCES}
${GEN_KEYWORD_LIST_SOURCES}
${CONF_SOURCES}
PROPERTIES GENERATED 1)
# Gen_lex_token
# Make sure sql_yacc.h is generated before compiling gen_lex_token
MYSQL_ADD_EXECUTABLE(gen_lex_token
gen_lex_token.cc
DEPENDENCIES GenServerSource
SKIP_INSTALL
)
MY_CHECK_CXX_COMPILER_WARNING("-Wmissing-profile" HAS_MISSING_PROFILE)
IF(HAS_MISSING_PROFILE)
ADD_COMPILE_FLAGS(
binlog_reader.cc # In case we did not profile replication.
gen_lex_token.cc # This is a compile-time tool.
COMPILE_FLAGS ${HAS_MISSING_PROFILE})
ENDIF()
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lex_token.h
COMMAND gen_lex_token > lex_token.h
DEPENDS gen_lex_token
)
# gen_keyword_list
# Make sure sql_yacc.h is generated before compiling gen_keyword_list
MYSQL_ADD_EXECUTABLE(gen_keyword_list
gen_keyword_list.cc
DEPENDENCIES GenServerSource
LINK_LIBRARIES ext::icu
SKIP_INSTALL
)
IF(WITH_LTO OR CMAKE_COMPILER_FLAG_WITH_LTO)
TARGET_COMPILE_OPTIONS(gen_keyword_list PRIVATE "-fno-lto")
ENDIF()
IF(HAS_MISSING_PROFILE)
ADD_COMPILE_FLAGS(gen_keyword_list.cc COMPILE_FLAGS ${HAS_MISSING_PROFILE})
ENDIF()
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/keyword_list.h
COMMAND gen_keyword_list ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy > ${CMAKE_CURRENT_BINARY_DIR}/keyword_list.h
DEPENDS gen_keyword_list
)
IF(WITH_LOG_DIAGNOSTIC)
ADD_DEFINITIONS(-DHAVE_LOG_DIAGNOSTIC)
ENDIF()
ADD_DEFINITIONS(-DMYSQL_SERVER)
ADD_SUBDIRECTORY(server_component)
ADD_SUBDIRECTORY(protobuf)
SET(DD_SOURCES
dd/collection.cc
dd/dd_event.cc
dd/dd_resource_group.cc
dd/dd_routine.cc
dd/dd_schema.cc
dd/dd_table.cc
dd/dd_tablespace.cc
dd/dd_trigger.cc
dd/dd_view.cc
dd/dd_utility.cc
dd/properties.cc
dd/impl/dd.cc
dd/impl/dictionary_impl.cc
dd/impl/properties_impl.cc
dd/impl/system_registry.cc
dd/impl/transaction_impl.cc
dd/impl/utils.cc
dd/impl/sdi.cc
dd/impl/sdi_api.cc
dd/impl/sdi_file.cc
dd/impl/sdi_tablespace.cc
dd/impl/string_type.cc
dd/impl/bootstrap/bootstrap_ctx.cc
dd/impl/bootstrap/bootstrapper.cc
dd/impl/cache/dictionary_client.cc
dd/impl/cache/local_multi_map.cc
dd/impl/cache/multi_map_base.cc
dd/impl/cache/shared_multi_map.cc
dd/impl/cache/shared_dictionary_cache.cc
dd/impl/cache/storage_adapter.cc
dd/impl/raw/object_keys.cc
dd/impl/raw/raw_record.cc
dd/impl/raw/raw_record_set.cc
dd/impl/raw/raw_table.cc
dd/impl/system_views/administrable_role_authorizations.cc
dd/impl/system_views/applicable_roles.cc
dd/impl/system_views/character_sets.cc
dd/impl/system_views/check_constraints.cc
dd/impl/system_views/collations.cc
dd/impl/system_views/collation_charset_applicability.cc
dd/impl/system_views/columns.cc
dd/impl/system_views/columns_extensions.cc
dd/impl/system_views/column_statistics.cc
dd/impl/system_views/enabled_roles.cc
dd/impl/system_views/events.cc
dd/impl/system_views/files.cc
dd/impl/system_views/innodb_datafiles.cc
dd/impl/system_views/innodb_foreign.cc
dd/impl/system_views/innodb_foreign_cols.cc
dd/impl/system_views/innodb_fields.cc
dd/impl/system_views/innodb_tablespaces_brief.cc
dd/impl/system_views/key_column_usage.cc
dd/impl/system_views/keywords.cc
dd/impl/system_views/libraries.cc
dd/impl/system_views/parameters.cc
dd/impl/system_views/partitions.cc
dd/impl/system_views/referential_constraints.cc
dd/impl/system_views/resource_groups.cc
dd/impl/system_views/role_column_grants.cc
dd/impl/system_views/role_routine_grants.cc
dd/impl/system_views/role_table_grants.cc
dd/impl/system_views/routine_libraries.cc
dd/impl/system_views/routines.cc
dd/impl/system_views/schemata.cc
dd/impl/system_views/schemata_extensions.cc
dd/impl/system_views/statistics.cc
dd/impl/system_views/st_spatial_reference_systems.cc
dd/impl/system_views/st_units_of_measure.cc
dd/impl/system_views/st_geometry_columns.cc
dd/impl/system_views/tables.cc
dd/impl/system_views/tables_extensions.cc
dd/impl/system_views/table_constraints.cc
dd/impl/system_views/table_constraints_extensions.cc
dd/impl/system_views/tablespaces_extensions.cc
dd/impl/system_views/triggers.cc
dd/impl/system_views/view_routine_usage.cc
dd/impl/system_views/view_table_usage.cc
dd/impl/system_views/views.cc
dd/impl/system_views/user_attributes.cc
dd/impl/tables/character_sets.cc
dd/impl/tables/check_constraints.cc
dd/impl/tables/collations.cc
dd/impl/tables/columns.cc
dd/impl/tables/column_statistics.cc
dd/impl/tables/column_type_elements.cc
dd/impl/tables/dd_properties.cc
dd/impl/tables/events.cc
dd/impl/tables/foreign_key_column_usage.cc
dd/impl/tables/foreign_keys.cc
dd/impl/tables/index_column_usage.cc
dd/impl/tables/indexes.cc
dd/impl/tables/index_partitions.cc
dd/impl/tables/index_stats.cc
dd/impl/tables/parameters.cc
dd/impl/tables/parameter_type_elements.cc
dd/impl/tables/resource_groups.cc
dd/impl/tables/routines.cc
dd/impl/tables/schemata.cc
dd/impl/tables/spatial_reference_systems.cc
dd/impl/tables/table_partitions.cc
dd/impl/tables/table_stats.cc
dd/impl/tables/table_partition_values.cc
dd/impl/tables/tables.cc
dd/impl/tables/tablespace_files.cc
dd/impl/tables/tablespaces.cc
dd/impl/tables/triggers.cc
dd/impl/tables/view_routine_usage.cc
dd/impl/tables/view_table_usage.cc
dd/impl/types/index_stat_impl.cc
dd/impl/types/table_stat_impl.cc
dd/impl/types/abstract_table_impl.cc
dd/impl/types/charset_impl.cc
dd/impl/types/check_constraint_impl.cc
dd/impl/types/collation_impl.cc
dd/impl/types/column_impl.cc
dd/impl/types/column_statistics_impl.cc
dd/impl/types/column_type_element_impl.cc
dd/impl/types/entity_object_table_impl.cc
dd/impl/types/entity_object_impl.cc
dd/impl/types/event_impl.cc
dd/impl/types/foreign_key_element_impl.cc
dd/impl/types/foreign_key_impl.cc
dd/impl/types/function_impl.cc
dd/impl/types/index_element_impl.cc
dd/impl/types/index_impl.cc
dd/impl/types/library_impl.cc
dd/impl/types/object_table_impl.cc
dd/impl/types/object_table_definition_impl.cc
dd/impl/types/parameter_impl.cc
dd/impl/types/parameter_type_element_impl.cc
dd/impl/types/partition_impl.cc
dd/impl/types/partition_index_impl.cc
dd/impl/types/partition_value_impl.cc
dd/impl/types/procedure_impl.cc
dd/impl/types/resource_group_impl.cc
dd/impl/types/routine_impl.cc
dd/impl/types/schema_impl.cc
dd/impl/types/spatial_reference_system_impl.cc
dd/impl/types/table_impl.cc
dd/impl/types/tablespace_file_impl.cc
dd/impl/types/tablespace_impl.cc
dd/impl/types/trigger_impl.cc
dd/impl/types/view_impl.cc
dd/impl/types/view_routine_impl.cc
dd/impl/types/view_table_impl.cc
dd/impl/types/weak_object_impl.cc
dd/impl/upgrade/server.cc
dd/impl/upgrade/dd.cc
dd/info_schema/metadata.cc
dd/info_schema/show.cc
dd/info_schema/show_query_builder.cc
dd/info_schema/table_stats.cc
dd/info_schema/tablespace_stats.cc
dd/performance_schema/init.cc
dd/ndbinfo_schema/init.cc
)
SET(SQL_GIS_SOURCES
gis/area.cc
gis/buffer.cc
gis/covered_by.cc
gis/crosses.cc
gis/difference.cc
gis/difference_functor.cc
gis/disjoint.cc
gis/distance.cc
gis/distance_functor.cc
gis/distance_sphere.cc
gis/equals.cc
gis/frechet_distance.cc
gis/gc_utils.cc
gis/geometries.cc
gis/hausdorff_distance.cc
gis/intersection.cc
gis/intersection_functor.cc
gis/intersects.cc
gis/is_simple.cc
gis/is_valid.cc
gis/length.cc
gis/line_interpolate.cc
gis/mbr_utils.cc
gis/overlaps.cc
gis/ring_flip_visitor.cc
gis/rtree_support.cc
gis/simplify.cc
gis/so_utils.cc
gis/srs/srs.cc
gis/srs/wkt_parser.cc
gis/st_units_of_measure.cc
gis/symdifference.cc
gis/symdifference_functor.cc
gis/touches.cc
gis/transform.cc
gis/union.cc
gis/union_functor.cc
gis/within.cc
gis/wkb.cc
gis/wkb_size_visitor.cc
gis/wkb_visitor.cc
item_geofunc.cc
item_geofunc_buffer.cc
item_geofunc_internal.cc
item_geofunc_relchecks.cc
options_parser.cc
)
SET(SQL_SHARED_SOURCES
auth/authentication_policy.cc
auth/auth_acls.cc
auth/auth_common.cc
auth/dynamic_privileges_impl.cc
auth/dynamic_privilege_table.cc
auth/acl_table_user.cc
auth/sql_authentication.cc
auth/sql_auth_cache.cc
auth/sql_authorization.cc
auth/sql_mfa.cc
auth/sql_user_table.cc
auth/sql_user.cc
auth/partial_revokes.cc
auth/password.cc
auth/password_policy_service.cc
auth/sql_security_ctx.cc
auth/service_security_context.cc
auto_thd.cc
keyring_service.cc
auth/roles.cc
auth/role_tables.cc
auth/sha2_password_common.cc
auth/sha2_password.cc
../vector-common/vector_conversion.cc
ssl_wrapper_service.cc
bootstrap.cc
check_stack.cc
conn_handler/connection_handler_manager.cc
clone_handler.cc
create_field.cc
current_thd.cc
dd_sql_view.cc
dd_sp.cc
dd_table_share.cc
debug_sync.cc
default_values.cc
derror.cc
engine_combination_tracker.cc
error_handler.cc
field.cc
field_conv.cc
filesort.cc
filesort_utils.cc
aggregate_check.cc
gstream.cc
handler.cc
histograms/equi_height.cc
histograms/equi_height_bucket.cc
histograms/histogram.cc
histograms/singleton.cc
histograms/table_histograms.cc
histograms/value_map.cc
hostname_cache.cc
init.cc
log_resource.cc
item.cc
item_buff.cc
item_cmpfunc.cc
item_create.cc
item_func.cc
item_gtid_func.cc
item_pfs_func.cc
item_json_func.cc
item_regexp_func.cc
item_row.cc
item_strfunc.cc
item_subselect.cc
item_sum.cc
window.cc
item_timefunc.cc
item_xmlfunc.cc
item_inetfunc.cc
iterators/basic_row_iterators.cc
iterators/bka_iterator.cc
iterators/composite_iterators.cc
iterators/hash_join_buffer.cc
iterators/hash_join_chunk.cc
iterators/hash_join_iterator.cc
iterators/ref_row_iterators.cc
iterators/sorting_iterator.cc
iterators/window_iterators.cc
join_optimizer/access_path.cc
join_optimizer/build_interesting_orders.cc
join_optimizer/common_subexpression_elimination.cc
join_optimizer/cost_model.cc
join_optimizer/derived_keys.cc
join_optimizer/estimate_selectivity.cc
join_optimizer/explain_access_path.cc
join_optimizer/finalize_plan.cc
join_optimizer/graph_simplification.cc
join_optimizer/hypergraph.cc
join_optimizer/interesting_orders.cc
join_optimizer/join_optimizer.cc
join_optimizer/make_join_hypergraph.cc
join_optimizer/online_cycle_finder.cc
join_optimizer/optimizer_trace.cc
join_optimizer/overflow_bitset.cc
join_optimizer/print_utils.cc
join_optimizer/relational_expression.cc
join_optimizer/replace_item.cc
join_optimizer/secondary_statistics.cc
key.cc
key_spec.cc
keycaches.cc
lock.cc
locked_tables_list.cc
locking_service.cc
locks/shared_spin_lock.cc
log.cc
mdl.cc
mdl_context_backup.cc
migrate_keyring.cc
mysqld.cc
mysqld_thd_manager.cc
opt_costconstantcache.cc
opt_costconstants.cc
opt_costmodel.cc
opt_explain.cc
opt_explain_format.cc
opt_explain_traditional.cc
opt_explain_json.cc
opt_hints.cc
opt_option_usage.cc
opt_statistics.cc
opt_sum.cc
opt_trace.cc
opt_trace2server.cc
pack_rows.cc
parse_file.cc
parse_tree_handler.cc
parse_tree_helpers.cc
parse_tree_hints.cc
parse_tree_items.cc
parse_tree_node_base.cc
parse_tree_nodes.cc
query_term.cc
parse_tree_partitions.cc
parse_tree_window.cc
select_lex_visitor.cc
parser_service.cc
partition_info.cc
partitioning/partition_handler.cc
persisted_variable.cc
protocol_classic.cc
psi_memory_key.cc
psi_memory_resource.cc
query_result.cc
raii/targeted_stringstream.cc
range_optimizer/geometry_index_range_scan.cc
range_optimizer/group_index_skip_scan.cc
range_optimizer/group_index_skip_scan_plan.cc
range_optimizer/index_merge.cc
range_optimizer/index_merge_plan.cc
range_optimizer/index_range_scan.cc
range_optimizer/index_range_scan_plan.cc
range_optimizer/index_skip_scan.cc
range_optimizer/index_skip_scan_plan.cc
range_optimizer/partition_pruning.cc
range_optimizer/range_analysis.cc
range_optimizer/range_optimizer.cc
range_optimizer/reverse_index_range_scan.cc
range_optimizer/rowid_ordered_retrieval.cc
range_optimizer/rowid_ordered_retrieval_plan.cc
range_optimizer/tree.cc
regexp/errors.cc
regexp/regexp_engine.cc
regexp/regexp_facade.cc
resourcegroups/thread_resource_control.cc
resourcegroups/platform/thread_attrs_api_common.cc
resourcegroups/resource_group_mgr.cc
resourcegroups/resource_group_sql_cmd.cc
statement/ed_connection.cc
statement/protocol_local.cc
statement/protocol_local_v2.cc
statement/statement.cc
statement/statement_runnable.cc
statement/utils.cc
rpl_group_replication.cc
rpl_opt_tracker.cc
rpl_transaction_ctx.cc
rpl_transaction_write_set_ctx.cc
rpl_write_set_handler.cc
rules_table_service.cc
rwlock_scoped_lock.cc
sd_notify.cc
sdi_utils.cc
session_tracker.cc
set_var.cc
sp.cc
sp_cache.cc
sp_head.cc
sp_instr.cc
sp_pcontext.cc
sp_rcontext.cc
spatial.cc
string_service.cc
sql_admin.cc
sql_alloc_error_handler.cc
sql_alter.cc
sql_alter_instance.cc
sql_backup_lock.cc
sql_base.cc
sql_bootstrap.cc
sql_initialize.cc
sql_call.cc
sql_check_constraint.cc
sql_class.cc
sql_component.cc
sql_const_folding.cc
sql_cmd_ddl.cc
sql_cmd_ddl_table.cc
sql_cmd_srs.cc
sql_connect.cc
sql_constraint.cc
sql_cursor.cc
sql_data_change.cc
sql_db.cc
sql_delete.cc
sql_derived.cc
sql_digest.cc
sql_do.cc
sql_error.cc
sql_exception_handler.cc
sql_executor.cc
sql_get_diagnostics.cc
sql_gipk.cc
sql_handler.cc
sql_help.cc
sql_import.cc
sql_insert.cc
sql_lex.cc
sql_lex_hash.cc
sql_lex_hints.cc
sql_list.cc
sql_load.cc
sql_locale.cc
sql_manager.cc
sql_optimizer.cc
sql_parse.cc
sql_partition.cc
sql_partition_admin.cc
sql_planner.cc
sql_plugin.cc
sql_plugin_var.cc
sql_prepare.cc
sql_profile.cc
sql_query_rewrite.cc
sql_reload.cc
sql_rename.cc
sql_resolver.cc
sql_restart_server.cc
sql_rewrite.cc
sql_select.cc
sql_servers.cc
sql_show.cc
sql_show_status.cc
sql_show_processlist.cc
sql_signal.cc
sql_state.cc
sql_table.cc
sql_tablespace.cc
sql_test.cc
sql_thd_internal_api.cc
sql_thd_api.cc
sql_time.cc
sql_timer.cc
sql_tmp_table.cc
sql_trigger.cc
sql_truncate.cc
sql_udf.cc
sql_union.cc
sql_update.cc
sql_view.cc
ssl_acceptor_context_iterator.cc
ssl_acceptor_context_data.cc
ssl_acceptor_context_operator.cc
ssl_init_callback.cc
stateless_allocator.cc
strfunc.cc
sys_vars.cc
sys_vars_resource_mgr.cc
system_variables.cc
table.cc
table_cache.cc
table_function.cc
table_trigger_dispatcher.cc
tc_log.cc
thr_malloc.cc
time_zone_common.cc
transaction.cc
transaction_info.cc
trigger.cc
trigger_creation_ctx.cc
trigger_chain.cc
tztime.cc
uniques.cc
xa.cc
xa/recovery.cc
xa/sql_xa_second_phase.cc
xa/sql_xa_commit.cc
xa/sql_xa_end.cc
xa/sql_xa_prepare.cc
xa/sql_xa_recover.cc
xa/sql_xa_rollback.cc
xa/sql_xa_start.cc
xa/transaction_cache.cc
xa/xid_extract.cc
daemon_proxy_keyring/daemon_proxy_keyring.cc
reference_caching_setup.cc
sql_event_tracking_to_audit_event_mapping.cc
command_mapping.cc
srv_event_plugin_handles.cc
)
IF(BUILD_IS_SINGLE_CONFIG)
GET_PROPERTY(CWD_DEFINITIONS DIRECTORY PROPERTY COMPILE_DEFINITIONS)
IF(NOT CMAKE_CXX_FLAGS MATCHES "DENABLED_DEBUG_SYNC" AND
NOT CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER} MATCHES "DENABLED_DEBUG_SYNC" AND
NOT CWD_DEFINITIONS MATCHES "ENABLED_DEBUG_SYNC")
# This has ifdef ENABLED_DEBUG_SYNC
LIST(REMOVE_ITEM SQL_SHARED_SOURCES
debug_sync.cc
)
ENDIF()
ENDIF()
# BISON_TARGET(<Name> <YaccInput> <CodeOutput>
# [COMPILE_FLAGS <flags>]
# [DEFINES_FILE <file>]
# [VERBOSE <file>]
# )
# FLEX_TARGET(Name FlexInput FlexOutput
# [COMPILE_FLAGS <string>]
# [DEFINES_FILE <string>]
# )
# The Name argument is just an alias.
# Both macros will ADD_CUSTOM_COMMAND, with WORKING_DIRECTORY current src.
IF(WITH_LOCK_ORDER)
FIND_PACKAGE(BISON REQUIRED)
FIND_PACKAGE(FLEX REQUIRED)
BISON_TARGET(debug_lo_parser
${CMAKE_CURRENT_SOURCE_DIR}/debug_lo_parser.yy
${CMAKE_CURRENT_BINARY_DIR}/debug_lo_parser.cc
COMPILE_FLAGS "--name-prefix=LOCK_ORDER_ ${BISON_NO_LINE_OPT}"
DEFINES_FILE ${CMAKE_BINARY_DIR}/sql/debug_lo_parser.h
)
FLEX_TARGET(debug_lo_scanner
${CMAKE_CURRENT_SOURCE_DIR}/debug_lo_scanner.ll
${CMAKE_CURRENT_BINARY_DIR}/debug_lo_scanner.cc
COMPILE_FLAGS "--prefix=LOCK_ORDER_"
DEFINES_FILE ${CMAKE_BINARY_DIR}/sql/debug_lo_scanner.h
)
MESSAGE(STATUS "BISON outputs ${BISON_debug_lo_parser_OUTPUTS}")
MESSAGE(STATUS "FLEX outputs ${FLEX_debug_lo_scanner_OUTPUTS}")
# Some targets, for easier debugging.
# The new Xcode build system does not support multiple targets that
# DEPEND on the same outputs.
IF(NOT APPLE_XCODE)
ADD_CUSTOM_TARGET(GenBison_lo DEPENDS ${BISON_debug_lo_parser_OUTPUTS})
ADD_CUSTOM_TARGET(GenFlex_lo DEPENDS ${FLEX_debug_lo_scanner_OUTPUTS})
ENDIF()
LIST(APPEND SQL_SHARED_SOURCES
${BISON_debug_lo_parser_OUTPUTS}
${FLEX_debug_lo_scanner_OUTPUTS}
debug_lock_order.cc
)
# Bison output uses undefined symbols for clang >= v15
IF(MY_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
ADD_COMPILE_FLAGS(${CMAKE_BINARY_DIR}/sql/debug_lo_parser.cc
COMPILE_FLAGS "-Wno-unused-but-set-variable")
ENDIF()
IF(MY_COMPILER_IS_GNU_OR_CLANG)
ADD_COMPILE_FLAGS(${FLEX_debug_lo_scanner_OUTPUTS}
COMPILE_FLAGS
"-Wno-sign-compare"
"-Wno-unused-parameter"
)
ADD_COMPILE_FLAGS(${CMAKE_BINARY_DIR}/sql/debug_lo_parser.cc
COMPILE_FLAGS
"-Wno-undef"
)
ENDIF()
# flex annotates some variables as 'register' and that keyword
# will go away with C++17
IF(APPLE)
ADD_COMPILE_FLAGS(${FLEX_debug_lo_scanner_OUTPUTS}
COMPILE_FLAGS
"-Wno-deprecated-register"
)
ENDIF()
ENDIF()
UNSET(SQL_HEADERS)
IF(CMAKE_GENERATOR STREQUAL "Xcode")
OPTION(GLOB_RECURSE_SQL_HEADERS "Find header files with GLOB_RECURSE" ON)
ELSE()
OPTION(GLOB_RECURSE_SQL_HEADERS "Find header files with GLOB_RECURSE" OFF)
ENDIF()
IF(GLOB_RECURSE_SQL_HEADERS)
# Needed so that IDEs (e.g. Xcode) can see all sources when searching
# This recursive search finds over 1500 header files, and may actually
# take a significant amount of time. Hence, do it only upon request.
# Visual Studio will scan/parse for headers at startup anyways.
FILE(GLOB_RECURSE SQL_HEADERS
"${CMAKE_SOURCE_DIR}/include/*.h"
"${CMAKE_SOURCE_DIR}/sql/*.h"
"${CMAKE_SOURCE_DIR}/storage/*.h"
)
ENDIF()
IF(LINUX)
LIST(APPEND SQL_SHARED_SOURCES
resourcegroups/platform/thread_attrs_api_linux.cc)
ELSEIF(APPLE)
LIST(APPEND SQL_SHARED_SOURCES
resourcegroups/platform/thread_attrs_api_apple.cc)
ELSEIF(FREEBSD)
LIST(APPEND SQL_SHARED_SOURCES
resourcegroups/platform/thread_attrs_api_freebsd.cc)
ELSEIF(SOLARIS)
LIST(APPEND SQL_SHARED_SOURCES
resourcegroups/platform/thread_attrs_api_solaris.cc)
ELSEIF(WIN32)
LIST(APPEND SQL_SHARED_SOURCES
resourcegroups/platform/thread_attrs_api_win.cc)
ENDIF()
SET(SQL_SOURCE
${GEN_SOURCES}
${GEN_DIGEST_SOURCES}
${GEN_KEYWORD_LIST_SOURCES}
${CONF_SOURCES}
${SQL_SHARED_SOURCES}
${SQL_HEADERS}
../libmysql/errmsg.cc
../sql-common/client.cc
../sql-common/client_plugin.cc
../sql-common/client_authentication.cc
../sql-common/compression.cc
../sql-common/get_password.cc
../sql-common/my_path_permissions.cc
../sql-common/net_ns.cc
../sql-common/net_serv.cc
../sql-common/sql_string.cc
../sql-common/bind_params.cc
../sql-common/json_binary.cc
../sql-common/my_decimal.cc
../sql-common/json_diff.cc
../sql-common/json_dom.cc
../sql-common/json_error_handler.cc
../sql-common/json_path.cc
../sql-common/json_schema.cc
../sql-common/json_syntax_check.cc
command_service.cc
conn_handler/channel_info.cc
conn_handler/connection_handler_per_thread.cc
conn_handler/connection_handler_one_thread.cc
conn_handler/socket_connection.cc
conn_handler/init_net_server_extension.cc
event_data_objects.cc
event_db_repository.cc
event_parse_data.cc
event_queue.cc
event_scheduler.cc
events.cc
mf_iocache.cc
protocol_callback.cc
signal_handler.cc
sql_audit.cc
sql_client.cc
srv_session.cc
srv_session_info_service.cc
srv_session_service.cc
aggregated_stats_buffer.cc
aggregated_stats.cc
)
IF(NOT HAVE_SETNS)
LIST(REMOVE_ITEM SQL_SOURCE ../sql-common/net_ns.cc)
ENDIF()
IF(NOT WIN32)
LIST(APPEND SQL_SOURCE mysqld_daemon.cc)
ENDIF()
IF(WIN32)
LIST(APPEND SQL_SOURCE
conn_handler/named_pipe_connection.cc
conn_handler/shared_memory_connection.cc
named_pipe.cc
restart_monitor_win.cc
)
ENDIF()
# Fixes "C1128: number of sections exceeded object file format limit" in MSVC
IF(WIN32)
ADD_COMPILE_FLAGS(
gis/difference.cc
gis/difference_functor.cc
gis/intersection_functor.cc
gis/symdifference_functor.cc
gis/touches.cc
gis/union.cc
gis/union_functor.cc
gis/within.cc
item_geofunc.cc
item_geofunc_relchecks.cc
COMPILE_FLAGS "/bigobj")
ENDIF()
# Downgrade -Werror to warning for gcc
IF(MY_COMPILER_IS_GNU)
MY_CHECK_CXX_COMPILER_WARNING("error=maybe-uninitialized" HAS_WARN_FLAG)
IF(HAS_WARN_FLAG)
ADD_COMPILE_FLAGS(
geometry_rtree.cc
COMPILE_FLAGS ${HAS_WARN_FLAG}
)
ENDIF()
ENDIF()
# Force optimization of (large) MYSQLparse function in MSVC
IF(WIN32 AND NOT WIN32_CLANG)
ADD_COMPILE_FLAGS(
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
COMPILE_FLAGS "/d2OptimizeHugeFunctions")
ENDIF()
# 'yyexhtaustedlab': unreferenced label
IF(WIN32 AND NOT WIN32_CLANG)
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc
COMPILE_FLAGS "/wd4102")
ENDIF()
# Common for all versions of GCC/Clang
# Bison output uses undefined symbols in #if checks
IF(MY_COMPILER_IS_GNU_OR_CLANG)
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc
COMPILE_FLAGS "-Wno-undef -Wno-unused-label")
IF(MY_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc
COMPILE_FLAGS "-Wno-unused-but-set-variable")
ENDIF()
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98753
IF(MY_COMPILER_IS_GNU AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 11)
ADD_COMPILE_FLAGS(
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc
COMPILE_FLAGS "-Wno-free-nonheap-object")
ENDIF()
ENDIF()
IF(WIN32)
# switch statement contains 'default' but no 'case'
ADD_COMPILE_FLAGS(${CMAKE_CURRENT_BINARY_DIR}/sql_hints.yy.cc
COMPILE_FLAGS "/wd4065")
# conversion from 'uint' to 'Item *' of greater size
ADD_COMPILE_FLAGS(range_optimizer/range_analysis.cc
COMPILE_FLAGS "/wd4312")
ENDIF()
MY_CHECK_CXX_COMPILER_FLAG("-fno-builtin-memcmp" HAVE_NO_BUILTIN_MEMCMP)
# See comments in filesort_compare-t.cc about __builtin_memcmp
IF(HAVE_NO_BUILTIN_MEMCMP)
ADD_COMPILE_FLAGS(
filesort_utils.cc
COMPILE_FLAGS "-fno-builtin-memcmp"
)
ENDIF()
ADD_STATIC_LIBRARY(sql_main ${SQL_SOURCE} LINK_LIBRARIES ext::icu ext::xxhash)
ADD_DEPENDENCIES(sql_main GenServerSource)
ADD_DEPENDENCIES(sql_main GenDigestServerSource)
ADD_DEPENDENCIES(sql_main GenBootstrapPriv)
ADD_DEPENDENCIES(sql_main GenSysSchema)
IF(DEFINED WITH_HYPERGRAPH_OPTIMIZER)
IF(WITH_HYPERGRAPH_OPTIMIZER)
TARGET_COMPILE_DEFINITIONS(sql_main PRIVATE
WITH_HYPERGRAPH_OPTIMIZER=1)
ENDIF()
ELSEIF(WITH_HYPERGRAPH_OPTIMIZER_DEFAULT STREQUAL "default")
TARGET_COMPILE_DEFINITIONS(sql_main PRIVATE
$<$<CONFIG:Debug>:WITH_HYPERGRAPH_OPTIMIZER=1>)
ENDIF()
IF(ENABLE_HYPERGRAPH_OPTIMIZER)
TARGET_COMPILE_DEFINITIONS(sql_main PRIVATE
ENABLE_HYPERGRAPH_OPTIMIZER=1)
ENDIF()
IF(DEFINED WITH_SHOW_PARSE_TREE)
IF(WITH_SHOW_PARSE_TREE)
TARGET_COMPILE_DEFINITIONS(sql_main PRIVATE
WITH_SHOW_PARSE_TREE=1)
ENDIF()
ELSEIF(WITH_SHOW_PARSE_TREE_DEFAULT STREQUAL "default")
TARGET_COMPILE_DEFINITIONS(sql_main PRIVATE
$<$<CONFIG:Debug>:WITH_SHOW_PARSE_TREE=1>)
ENDIF()
TARGET_LINK_LIBRARIES(sql_main extra::unordered_dense)
TARGET_LINK_LIBRARIES(sql_main ${MYSQLD_STATIC_PLUGIN_LIBS}
mysql_server_component_services mysys library_mysys strings vio
mysql_binlog_event ${LIBWRAP} ${LIBDL} OpenSSL::SSL OpenSSL::Crypto
extra::rapidjson extra::boost)
# sql/immutable_string.h uses
# google::protobuf::io::CodedOutputStream::WriteVarint64ToArray
# which may or may not be inlined.
TARGET_LINK_LIBRARIES(sql_main ext::libprotobuf-lite)
ADD_LIBRARY(sql_gis STATIC ${SQL_GIS_SOURCES})
ADD_DEPENDENCIES(sql_gis GenServerSource)
ADD_DEPENDENCIES(sql_gis GenDigestServerSource)
ADD_DEPENDENCIES(sql_gis GenBootstrapPriv)
ADD_DEPENDENCIES(sql_gis GenSysSchema)
ADD_DEPENDENCIES(sql_gis GenError)
TARGET_LINK_LIBRARIES(sql_gis sql_dd sql_main)
TARGET_LINK_LIBRARIES(sql_gis extra::boost)
SET_TARGET_PROPERTIES(sql_gis PROPERTIES LINK_INTERFACE_MULTIPLICITY 3)
# This typically saves a few hundred megabytes of disk space.
IF(COMPRESS_DEBUG_SECTIONS)
MY_CHECK_CXX_COMPILER_FLAG("-gz" HAVE_COMPRESS_GZ_OPTION)
IF(HAVE_COMPRESS_GZ_OPTION)
TARGET_COMPILE_OPTIONS(sql_gis PRIVATE -gz)
ENDIF()
ENDIF()
ADD_LIBRARY(sql_dd STATIC ${DD_SOURCES})
ADD_DEPENDENCIES(sql_dd GenFixPrivs)
ADD_DEPENDENCIES(sql_dd GenServerSource)
ADD_DEPENDENCIES(sql_dd GenDigestServerSource)
ADD_DEPENDENCIES(sql_dd GenBootstrapPriv)
ADD_DEPENDENCIES(sql_dd GenSysSchema)
ADD_DEPENDENCIES(sql_dd GenError)
ADD_DEPENDENCIES(sql_dd GenKeywordList)
TARGET_LINK_LIBRARIES(sql_dd sql_gis sql_main)
SET_TARGET_PROPERTIES(sql_dd PROPERTIES LINK_INTERFACE_MULTIPLICITY 3)
#
# On Windows platform we compile in the client-side Windows Native Authentication
# plugin which is used by the client connection code included in the server.
#
IF(WIN32)
ADD_DEFINITIONS(-DAUTHENTICATION_WIN)
TARGET_LINK_LIBRARIES(sql_main auth_win_client)
IF(OPENSSL_APPLINK_C)
MY_ADD_COMPILE_DEFINITIONS(
../sql-common/client_authentication.cc
COMPILE_DEFINITIONS HAVE_OPENSSL_APPLINK_C)