this repo has no description
1#
2# Takes a single component and returns all its dependencies in `COMPONENT_DEPS`
3#
4function(darling_parse_components_get_deps COMPONENT)
5 if (("${COMPONENT}" STREQUAL "system") OR ("${COMPONENT}" STREQUAL "python") OR ("${COMPONENT}" STREQUAL "ruby") OR ("${COMPONENT}" STREQUAL "perl"))
6 set(COMPONENT_DEPS core PARENT_SCOPE)
7 elseif ("${COMPONENT}" STREQUAL "cli")
8 set(COMPONENT_DEPS system PARENT_SCOPE)
9 elseif ("${COMPONENT}" STREQUAL "cli_dev")
10 set(COMPONENT_DEPS cli python ruby perl dev_gui_common dev_gui_frameworks_common dev_gui_stubs_common PARENT_SCOPE)
11 elseif ("${COMPONENT}" STREQUAL "cli_extra")
12 set(COMPONENT_DEPS cli PARENT_SCOPE)
13 elseif ("${COMPONENT}" STREQUAL "gui")
14 set(COMPONENT_DEPS system dev_gui_common iokitd PARENT_SCOPE)
15 elseif ("${COMPONENT}" STREQUAL "gui_frameworks")
16 set(COMPONENT_DEPS gui dev_gui_frameworks_common PARENT_SCOPE)
17 elseif ("${COMPONENT}" STREQUAL "gui_stubs")
18 set(COMPONENT_DEPS gui dev_gui_stubs_common PARENT_SCOPE)
19 elseif ("${COMPONENT}" STREQUAL "dev_gui_common")
20 set(COMPONENT_DEPS system PARENT_SCOPE)
21 elseif (("${COMPONENT}" STREQUAL "dev_gui_frameworks_common") OR ("${COMPONENT}" STREQUAL "dev_gui_stubs_common"))
22 set(COMPONENT_DEPS dev_gui_common PARENT_SCOPE)
23 elseif ("${COMPONENT}" STREQUAL "jsc")
24 set(COMPONENT_DEPS system PARENT_SCOPE)
25 elseif ("${COMPONENT}" STREQUAL "webkit")
26 set(COMPONENT_DEPS dev_gui_frameworks_common dev_gui_stubs_common PARENT_SCOPE)
27 elseif ("${COMPONENT}" STREQUAL "iokitd")
28 set(COMPONENT_DEPS system PARENT_SCOPE)
29 elseif ("${COMPONENT}" STREQUAL "stock")
30 set(COMPONENT_DEPS cli python ruby perl dev_gui_common dev_gui_frameworks_common dev_gui_stubs_common gui_frameworks gui_stubs PARENT_SCOPE)
31 elseif ("${COMPONENT}" STREQUAL "cli_dev_gui_stubs")
32 set(COMPONENT_DEPS dev_gui_common PARENT_SCOPE)
33 elseif ("${COMPONENT}" STREQUAL "all")
34 set(COMPONENT_DEPS stock jsc webkit cli_extra cli_dev_gui_stubs PARENT_SCOPE)
35 endif()
36endfunction()
37
38function(darling_parse_components DARLING_RAW_COMPONENTS)
39 string(REPLACE "," ";" RAW_COMPONENTS_LIST "${DARLING_RAW_COMPONENTS}")
40
41 set(COMPONENTS_TO_PROCESS "")
42
43 foreach(RAW_COMPONENT IN LISTS RAW_COMPONENTS_LIST)
44 string(STRIP "${RAW_COMPONENT}" STRIPPED_COMPONENT)
45 string(TOLOWER "${STRIPPED_COMPONENT}" COMPONENT)
46
47 list(APPEND COMPONENTS_TO_PROCESS "${COMPONENT}")
48 endforeach()
49
50 list(REMOVE_DUPLICATES COMPONENTS_TO_PROCESS)
51
52 set(COMPONENTS_LIST "")
53
54 # iterate through the list and add each component along with its dependencies.
55 # this also handles circular dependencies between components (in case we ever have such dependency situations arise).
56 while (COMPONENTS_TO_PROCESS)
57 # get the next component and remove it from the list to process
58 list(GET COMPONENTS_TO_PROCESS 0 COMPONENT)
59 list(REMOVE_AT COMPONENTS_TO_PROCESS 0)
60
61 # add it to the list of processed components
62 list(APPEND COMPONENTS_LIST "${COMPONENT}")
63 list(REMOVE_DUPLICATES COMPONENTS_LIST)
64
65 # get its dependencies (into `COMPONENT_DEPS`)
66 darling_parse_components_get_deps("${COMPONENT}")
67
68 # add them to the list of components to process
69 list(APPEND COMPONENTS_TO_PROCESS ${COMPONENT_DEPS})
70 list(REMOVE_DUPLICATES COMPONENTS_TO_PROCESS)
71
72 # remove components that we've already processed
73 list(REMOVE_ITEM COMPONENTS_TO_PROCESS ${COMPONENTS_LIST})
74 endwhile()
75
76 # the "core" component is always on
77 set(COMPONENT_core ON PARENT_SCOPE)
78
79 # first, set every component off
80 foreach(COMPONENT IN ITEMS system python ruby perl cli cli_dev cli_extra gui gui_frameworks gui_stubs jsc webkit dev_gui_common dev_gui_frameworks_common dev_gui_stubs_common)
81 set("COMPONENT_${COMPONENT}" OFF PARENT_SCOPE)
82 endforeach()
83
84 # now turn on each component that was requested
85 foreach(COMPONENT IN LISTS COMPONENTS_LIST)
86 message(NOTICE "Including component: ${COMPONENT}")
87 set("COMPONENT_${COMPONENT}" ON PARENT_SCOPE)
88 endforeach()
89endfunction()