reveresed logic for enabling main file, and made tests link arch files
This commit is contained in:
parent
301136db03
commit
9953012154
@ -82,33 +82,35 @@ set(CMAKE_BUILD_TYPE Debug)
|
|||||||
foreach (family ${FAMILIES})
|
foreach (family ${FAMILIES})
|
||||||
string(TOUPPER ${family} ufamily)
|
string(TOUPPER ${family} ufamily)
|
||||||
aux_source_directory(${family}/ ${ufamily}_FILES)
|
aux_source_directory(${family}/ ${ufamily}_FILES)
|
||||||
|
aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES)
|
||||||
# Add the CLI binary target
|
# Add the CLI binary target
|
||||||
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} ${GUI_SOURCE_FILES})
|
add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} ${GUI_SOURCE_FILES})
|
||||||
|
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
|
||||||
|
|
||||||
# Add the importable Python module target
|
# Add the importable Python module target
|
||||||
PYTHON_ADD_MODULE(nextpnrpy_${family} ${COMMON_FILES} ${${ufamily}_FILES})
|
PYTHON_ADD_MODULE(nextpnrpy_${family} ${COMMON_FILES} ${${ufamily}_FILES})
|
||||||
target_compile_definitions(nextpnrpy_${family} PRIVATE PYTHON_MODULE)
|
|
||||||
# Add any new per-architecture targets here
|
# Add any new per-architecture targets here
|
||||||
|
|
||||||
|
add_executable(nextpnr-${family}-test ${${ufamily}_TEST_FILES} ${COMMON_FILES} ${${ufamily}_FILES})
|
||||||
|
target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
|
||||||
|
add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
|
||||||
|
|
||||||
# Set ${family_targets} to the list of targets being build for this family
|
# Set ${family_targets} to the list of targets being build for this family
|
||||||
set(family_targets nextpnr-${family} nextpnrpy_${family})
|
set(family_targets nextpnr-${family} nextpnrpy_${family} nextpnr-${family}-test)
|
||||||
# Include the family-specific CMakeFile
|
# Include the family-specific CMakeFile
|
||||||
include(${family}/family.cmake)
|
include(${family}/family.cmake)
|
||||||
foreach (target ${family_targets})
|
foreach (target ${family_targets})
|
||||||
# Include family-specific source files to all family targets and set defines appropriately
|
# Include family-specific source files to all family targets and set defines appropriately
|
||||||
target_include_directories(${target} PRIVATE ${family}/)
|
target_include_directories(${target} PRIVATE ${family}/)
|
||||||
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} -DQT_NO_KEYWORDS)
|
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS)
|
||||||
target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES})
|
target_link_libraries(${target} LINK_PUBLIC ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES})
|
||||||
endforeach (target)
|
endforeach (target)
|
||||||
|
|
||||||
add_executable(nextpnr-${family}-test "")
|
|
||||||
target_sources(nextpnr-${family}-test PRIVATE tests/${family}/main.cpp)
|
|
||||||
target_link_libraries(nextpnr-${family}-test PRIVATE gtest_main)
|
|
||||||
add_test(${family}-test ${CMAKE_CURRENT_BINARY_DIR}/nextpnr-${family}-test)
|
|
||||||
endforeach (family)
|
endforeach (family)
|
||||||
|
|
||||||
file(GLOB_RECURSE CLANGFORMAT_FILES *.cc *.h)
|
file(GLOB_RECURSE CLANGFORMAT_FILES *.cc *.h)
|
||||||
string(REGEX REPLACE "[^;]*/ice40/chipdbs/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
|
string(REGEX REPLACE "[^;]*/ice40/chipdbs/chipdb-[^;]*.cc" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
|
||||||
string(REGEX REPLACE "[^;]*/3rdparty[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
|
string(REGEX REPLACE "[^;]*/3rdparty[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
|
||||||
|
string(REGEX REPLACE "[^;]*/generated[^;]*" "" CLANGFORMAT_FILES "${CLANGFORMAT_FILES}")
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
clangformat
|
clangformat
|
||||||
|
@ -140,7 +140,7 @@ static wchar_t *program;
|
|||||||
|
|
||||||
void init_python(const char *executable)
|
void init_python(const char *executable)
|
||||||
{
|
{
|
||||||
#ifndef PYTHON_MODULE
|
#ifdef MAIN_EXECUTABLE
|
||||||
program = Py_DecodeLocale(executable, NULL);
|
program = Py_DecodeLocale(executable, NULL);
|
||||||
if (program == NULL) {
|
if (program == NULL) {
|
||||||
fprintf(stderr, "Fatal error: cannot decode executable filename\n");
|
fprintf(stderr, "Fatal error: cannot decode executable filename\n");
|
||||||
@ -162,7 +162,7 @@ void init_python(const char *executable)
|
|||||||
|
|
||||||
void deinit_python()
|
void deinit_python()
|
||||||
{
|
{
|
||||||
#ifndef PYTHON_MODULE
|
#ifdef MAIN_EXECUTABLE
|
||||||
Py_Finalize();
|
Py_Finalize();
|
||||||
PyMem_RawFree(program);
|
PyMem_RawFree(program);
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PYTHON_MODULE
|
#ifdef MAIN_EXECUTABLE
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
@ -18,16 +18,41 @@ MainWindow::MainWindow(Design *_design, QWidget *parent)
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ui->treeWidget->setColumnCount(1);
|
ui->treeWidget->setColumnCount(1);
|
||||||
ui->treeWidget->setHeaderLabel(QString("Items"));
|
ui->treeWidget->setHeaderLabel(QString("Items"));
|
||||||
QTreeWidgetItem *belroot = new QTreeWidgetItem(ui->treeWidget);
|
|
||||||
belroot->setText(0, QString("Bels"));
|
QTreeWidgetItem *bel_root = new QTreeWidgetItem(ui->treeWidget);
|
||||||
ui->treeWidget->insertTopLevelItem(0, belroot);
|
bel_root->setText(0, QString("Bels"));
|
||||||
QList<QTreeWidgetItem *> items;
|
ui->treeWidget->insertTopLevelItem(0, bel_root);
|
||||||
|
QList<QTreeWidgetItem *> bel_items;
|
||||||
for (auto bel : design->chip.getBels()) {
|
for (auto bel : design->chip.getBels()) {
|
||||||
auto name = design->chip.getBelName(bel);
|
auto name = design->chip.getBelName(bel);
|
||||||
items.append(new QTreeWidgetItem((QTreeWidget *)nullptr,
|
bel_items.append(new QTreeWidgetItem((QTreeWidget *)nullptr,
|
||||||
QStringList(QString(name.c_str()))));
|
QStringList(QString(name.c_str()))));
|
||||||
}
|
}
|
||||||
belroot->addChildren(items);
|
bel_root->addChildren(bel_items);
|
||||||
|
|
||||||
|
QTreeWidgetItem *wire_root = new QTreeWidgetItem(ui->treeWidget);
|
||||||
|
QList<QTreeWidgetItem *> wire_items;
|
||||||
|
wire_root->setText(0, QString("Wires"));
|
||||||
|
ui->treeWidget->insertTopLevelItem(0, wire_root);
|
||||||
|
for (auto wire : design->chip.getWires()) {
|
||||||
|
auto name = design->chip.getWireName(wire);
|
||||||
|
wire_items.append(new QTreeWidgetItem((QTreeWidget *)nullptr,
|
||||||
|
QStringList(QString(name.c_str()))));
|
||||||
|
}
|
||||||
|
wire_root->addChildren(wire_items);
|
||||||
|
|
||||||
|
QTreeWidgetItem *pip_root = new QTreeWidgetItem(ui->treeWidget);
|
||||||
|
QList<QTreeWidgetItem *> pip_items;
|
||||||
|
pip_root->setText(0, QString("Pips"));
|
||||||
|
ui->treeWidget->insertTopLevelItem(0, pip_root);
|
||||||
|
for (auto pip : design->chip.getPips()) {
|
||||||
|
auto name = design->chip.getPipName(pip);
|
||||||
|
pip_items.append(new QTreeWidgetItem((QTreeWidget *)nullptr,
|
||||||
|
QStringList(QString(name.c_str()))));
|
||||||
|
}
|
||||||
|
pip_root->addChildren(pip_items);
|
||||||
|
|
||||||
|
|
||||||
PyImport_ImportModule("emb");
|
PyImport_ImportModule("emb");
|
||||||
|
|
||||||
write = [this](std::string s) {
|
write = [this](std::string s) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef PYTHON_MODULE
|
#ifdef MAIN_EXECUTABLE
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <boost/filesystem/convenience.hpp>
|
#include <boost/filesystem/convenience.hpp>
|
||||||
|
Loading…
Reference in New Issue
Block a user