<commit_before>if(ICE40_HX1K_ONLY)
    set(devices 1k)
    foreach (target ${family_targets})
        target_compile_definitions(${target} PRIVATE ICE40_HX1K_ONLY=1)
    endforeach (target)
else()
    set(devices 384 1k 5k 8k)
endif()

set(DB_PY ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdb.py)

set(ICEBOX_ROOT "/usr/local/share/icebox" CACHE STRING "icebox location root")
file(MAKE_DIRECTORY ice40/chipdbs/)
add_library(ice40_chipdb OBJECT ice40/chipdbs/)
target_compile_definitions(ice40_chipdb PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family})
target_include_directories(ice40_chipdb PRIVATE ${family}/)
if (MSVC)
    target_sources(ice40_chipdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ice40/resource/embed.cc)
    set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/ice40/resources/chipdb.rc PROPERTIES LANGUAGE RC)
    foreach (dev ${devices})
        set(DEV_TXT_DB ${ICEBOX_ROOT}/chipdb-${dev}.txt)
        set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.bin)
        set(DEV_PORTS_INC ${CMAKE_CURRENT_SOURCE_DIR}/ice40/portpins.inc)
        add_custom_command(OUTPUT ${DEV_CC_DB}
                COMMAND python3 ${DB_PY} -b -p ${DEV_PORTS_INC} ${DEV_TXT_DB} > ${DEV_CC_DB}
                DEPENDS ${DEV_TXT_DB} ${DB_PY}
                )
        target_sources(ice40_chipdb PRIVATE ${DEV_CC_DB})
        set_source_files_properties(${DEV_CC_DB} PROPERTIES HEADER_FILE_ONLY TRUE)
        foreach (target ${family_targets})
            target_sources(${target} PRIVATE $<TARGET_OBJECTS:ice40_chipdb> ${CMAKE_CURRENT_SOURCE_DIR}/ice40/resource/chipdb.rc)
        endforeach (target)
    endforeach (dev)
else()
    target_compile_options(ice40_chipdb PRIVATE -g0 -O0 -w)
    foreach (dev ${devices})
        set(DEV_TXT_DB ${ICEBOX_ROOT}/chipdb-${dev}.txt)
        set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.cc)
        set(DEV_PORTS_INC ${CMAKE_CURRENT_SOURCE_DIR}/ice40/portpins.inc)
        add_custom_command(OUTPUT ${DEV_CC_DB}
                COMMAND python3 ${DB_PY} -c -p ${DEV_PORTS_INC} ${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>)<commit_msg>Python executable filename could be different<commit_after>if(ICE40_HX1K_ONLY)
    set(devices 1k)
    foreach (target ${family_targets})
        target_compile_definitions(${target} PRIVATE ICE40_HX1K_ONLY=1)
    endforeach (target)
else()
    set(devices 384 1k 5k 8k)
endif()

set(DB_PY ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdb.py)

set(ICEBOX_ROOT "/usr/local/share/icebox" CACHE STRING "icebox location root")
file(MAKE_DIRECTORY ice40/chipdbs/)
add_library(ice40_chipdb OBJECT ice40/chipdbs/)
target_compile_definitions(ice40_chipdb PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family})
target_include_directories(ice40_chipdb PRIVATE ${family}/)
if (MSVC)
    target_sources(ice40_chipdb PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/ice40/resource/embed.cc)
    set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/ice40/resources/chipdb.rc PROPERTIES LANGUAGE RC)
    foreach (dev ${devices})
        set(DEV_TXT_DB ${ICEBOX_ROOT}/chipdb-${dev}.txt)
        set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.bin)
        set(DEV_PORTS_INC ${CMAKE_CURRENT_SOURCE_DIR}/ice40/portpins.inc)
        add_custom_command(OUTPUT ${DEV_CC_DB}
                COMMAND ${PYTHON_EXECUTABLE} ${DB_PY} -b -p ${DEV_PORTS_INC} ${DEV_TXT_DB} > ${DEV_CC_DB}
                DEPENDS ${DEV_TXT_DB} ${DB_PY}
                )
        target_sources(ice40_chipdb PRIVATE ${DEV_CC_DB})
        set_source_files_properties(${DEV_CC_DB} PROPERTIES HEADER_FILE_ONLY TRUE)
        foreach (target ${family_targets})
            target_sources(${target} PRIVATE $<TARGET_OBJECTS:ice40_chipdb> ${CMAKE_CURRENT_SOURCE_DIR}/ice40/resource/chipdb.rc)
        endforeach (target)
    endforeach (dev)
else()
    target_compile_options(ice40_chipdb PRIVATE -g0 -O0 -w)
    foreach (dev ${devices})
        set(DEV_TXT_DB ${ICEBOX_ROOT}/chipdb-${dev}.txt)
        set(DEV_CC_DB ${CMAKE_CURRENT_SOURCE_DIR}/ice40/chipdbs/chipdb-${dev}.cc)
        set(DEV_PORTS_INC ${CMAKE_CURRENT_SOURCE_DIR}/ice40/portpins.inc)
        add_custom_command(OUTPUT ${DEV_CC_DB}
                COMMAND ${PYTHON_EXECUTABLE} ${DB_PY} -c -p ${DEV_PORTS_INC} ${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>)
{'fraction_non_alphanumeric': 0.11667356226727348, 'fraction_numerical': 0.022755482002482418, 'mean_word_length': 3.9640657084188913, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1502595', 'n_tokens_mistral': 1874, 'n_tokens_neox': 1737, 'n_words': 260}