aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/examples/boards.cmake
blob: 3639080b7b3fbc616a34ae68a19246bbc23051ce (plain)
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
function(add_board)
    # ~~~
    # add_board(
    #    name <board name>
    #    device_family <device family>
    #    device <common device>
    #    package <package>
    # )
    # ~~~
    #
    # Generates a board target containing information on the common device and package
    # of the board.
    #
    # Arguments:
    #   - name: name of the board. E.g. arty
    #   - device_family: the name of the family this device belongs to.
    #                    E.g. the xc7a35t device belongs to the xc7 family
    #   - device: common device name of a set of parts. E.g. xc7a35tcsg324-1 and xc7a35tcpg236-1
    #             share the same xc7a35t device prefix
    #   - package: one of the packages available for a given device. E.g. cpg236
    #
    # Targets generated:
    #   - board-<name>

    set(options)
    set(oneValueArgs name device_family device package)
    set(multiValueArgs)

    cmake_parse_arguments(
        add_board
        "${options}"
        "${oneValueArgs}"
        "${multiValueArgs}"
        ${ARGN}
    )

    set(name ${add_board_name})
    set(device_family ${add_board_device_family})
    set(device ${add_board_device})
    set(package ${add_board_package})

    add_custom_target(board-${name} DEPENDS device-${device})
    set_target_properties(
        board-${name}
        PROPERTIES
            DEVICE_FAMILY ${device_family}
            DEVICE ${device}
            PACKAGE ${package}
    )
endfunction()