Add opetion to defie ICEBOX_ROOT, fix compile on other location

This commit is contained in:
Miodrag Milanovic 2018-07-03 20:46:05 +02:00
parent 1a8b4591f5
commit fd3c124f87
3 changed files with 10 additions and 7 deletions

View File

@ -52,12 +52,12 @@ execute_process(
)
if (BUILD_TESTS)
add_subdirectory(3rdparty/googletest/googletest generated/3rdparty/googletest EXCLUDE_FROM_ALL)
add_subdirectory(3rdparty/googletest/googletest ${CMAKE_CURRENT_BINARY_DIR}/generated/3rdparty/googletest EXCLUDE_FROM_ALL)
enable_testing()
endif()
if (BUILD_GUI)
add_subdirectory(3rdparty/QtPropertyBrowser generated/3rdparty/QtPropertyBrowser)
add_subdirectory(3rdparty/QtPropertyBrowser ${CMAKE_CURRENT_BINARY_DIR}/generated/3rdparty/QtPropertyBrowser)
endif()
add_definitions("-DGIT_COMMIT_HASH=${GIT_COMMIT_HASH}")
@ -136,7 +136,7 @@ foreach (family ${FAMILIES})
aux_source_directory(${family}/ ${ufamily}_FILES)
if (BUILD_GUI)
add_subdirectory(gui generated/gui/${family})
add_subdirectory(gui ${CMAKE_CURRENT_BINARY_DIR}/generated/gui/${family})
endif()
# Add the CLI binary target
@ -175,7 +175,7 @@ foreach (family ${FAMILIES})
include(${family}/family.cmake)
foreach (target ${family_targets})
# Include family-specific source files to all family targets and set defines appropriately
target_include_directories(${target} PRIVATE ${family}/ generated/)
target_include_directories(${target} PRIVATE ${family}/ ${CMAKE_CURRENT_BINARY_DIR}/generated/)
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family})
target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES})
add_sanitizers(${target})

View File

@ -10,6 +10,7 @@ group = parser.add_mutually_exclusive_group()
group.add_argument("-b", "--binary", action="store_true")
group.add_argument("-c", "--c_file", action="store_true")
parser.add_argument("filename", type=str, help="chipdb input filename")
parser.add_argument("-p", "--portspins", type=str, help="path to portpins.inc")
args = parser.parse_args()
endianness = "le"
@ -53,7 +54,7 @@ beltypes = dict()
tiletypes = dict()
wiretypes = dict()
with open("ice40/portpins.inc") as f:
with open(args.portspins) as f:
for line in f:
line = line.replace("(", " ")
line = line.replace(")", " ")

View File

@ -13,11 +13,13 @@ add_library(ice40_chipdb OBJECT ice40/chipdbs/)
target_compile_options(ice40_chipdb PRIVATE -g0 -O0 -w)
target_compile_definitions(ice40_chipdb PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family})
target_include_directories(ice40_chipdb PRIVATE ${family}/)
set(ICEBOX_ROOT "/usr/local/share/icebox" CACHE STRING "icebox location root")
foreach (dev ${devices})
set(DEV_TXT_DB /usr/local/share/icebox/chipdb-${dev}.txt)
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 ${DEV_TXT_DB} > ${DEV_CC_DB}.new
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}
)