aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/family.cmake
blob: 870b69b94f14a3e4274abfb2bceb31beb74539e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
set(devices 384 1k 5k 8k)
set(DB_PY ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdb.py)
file(MAKE_DIRECTORY ice40/chipdbs/)
add_library(ice40_chipdb OBJECT ice40/chipdbs/)
target_include_directories(ice40_chipdb PRIVATE ${family}/)
foreach (dev ${devices})
    set(DEV_TXT_DB /usr/local/share/icebox/chipdb-${dev}.txt)
    set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.cc)
    add_custom_command(OUTPUT ${DEV_CC_DB}
            COMMAND python3 ${DB_PY} ${DEV_TXT_DB} > ${DEV_CC_DB}.new
            COMMAND mv ${DEV_CC_DB}.new ${DEV_CC_DB}
            DEPENDS ${DEV_TXT_DB} ${DB_PY}
            )
    target_sources(ice40_chipdb PRIVATE ${DEV_CC_DB})
    foreach (target ${family_targets})
        target_sources(${target} PRIVATE $<TARGET_OBJECTS:ice40_chipdb>)
    endforeach (target)
endforeach (dev)