diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-20 16:13:49 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-06-20 16:15:33 +0200 |
commit | 36c16cd28e20b362a6185ce52525c98fc187ecf3 (patch) | |
tree | cfe36d3ca54a3ab7a95fd472b485d224f65225e6 /gui | |
parent | e14b8bac66bf9a65ddd709fba53aac017691f0c8 (diff) | |
download | nextpnr-36c16cd28e20b362a6185ce52525c98fc187ecf3.tar.gz nextpnr-36c16cd28e20b362a6185ce52525c98fc187ecf3.tar.bz2 nextpnr-36c16cd28e20b362a6185ce52525c98fc187ecf3.zip |
Cleanup of cmake files for easier development
Diffstat (limited to 'gui')
-rw-r--r-- | gui/CMakeLists.txt | 15 | ||||
-rw-r--r-- | gui/Qt5Customizations.cmake | 60 | ||||
-rw-r--r-- | gui/gui.cmake | 30 | ||||
-rw-r--r-- | gui/mainwindow.cc | 2 |
4 files changed, 17 insertions, 90 deletions
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt new file mode 100644 index 00000000..5db86a9b --- /dev/null +++ b/gui/CMakeLists.txt @@ -0,0 +1,15 @@ +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +aux_source_directory(. GUI_SOURCE_FILES) +set(_RESOURCES nextpnr.qrc) + +qt5_add_resources(GUI_RESOURCE_FILES ${_RESOURCES}) + +set(GUI_LIBRARY_FILES_${ufamily} Qt5::Widgets Qt5::OpenGL ${OPENGL_LIBRARIES} QtPropertyBrowser PARENT_SCOPE) + +add_library(gui_${family} STATIC ${GUI_SOURCE_FILES} ${GUI_RESOURCE_FILES}) + +target_include_directories(gui_${family} PRIVATE ../${family}/) +target_compile_definitions(gui_${family} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_NO_KEYWORDS) +target_link_libraries(gui_${family} Qt5::Widgets) diff --git a/gui/Qt5Customizations.cmake b/gui/Qt5Customizations.cmake deleted file mode 100644 index 39d3a644..00000000 --- a/gui/Qt5Customizations.cmake +++ /dev/null @@ -1,60 +0,0 @@ -include(CMakeParseArguments) - -# qt5_wrap_ui_custom(outfiles inputfile ... ) - -function(QT5_WRAP_UI_CUSTOM outfiles ) - set(options) - set(oneValueArgs) - set(multiValueArgs OPTIONS) - - cmake_parse_arguments(_WRAP_UI "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - set(ui_files ${_WRAP_UI_UNPARSED_ARGUMENTS}) - set(ui_options ${_WRAP_UI_OPTIONS}) - - foreach(it ${ui_files}) - get_filename_component(outfile ${it} NAME_WE) - get_filename_component(infile ${it} ABSOLUTE) - set(outfile ${CMAKE_CURRENT_BINARY_DIR}/generated/ui_${outfile}.h) - add_custom_command(OUTPUT ${outfile} - COMMAND ${Qt5Widgets_UIC_EXECUTABLE} - ARGS ${ui_options} -o ${outfile} ${infile} - MAIN_DEPENDENCY ${infile} VERBATIM) - list(APPEND ${outfiles} ${outfile}) - endforeach() - set(${outfiles} ${${outfiles}} PARENT_SCOPE) -endfunction() - -# qt5_add_resources_custom(outfiles inputfile ... ) - -function(QT5_ADD_RESOURCES_CUSTOM outfiles ) - - set(options) - set(oneValueArgs) - set(multiValueArgs OPTIONS) - - cmake_parse_arguments(_RCC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) - - set(rcc_files ${_RCC_UNPARSED_ARGUMENTS}) - set(rcc_options ${_RCC_OPTIONS}) - - if("${rcc_options}" MATCHES "-binary") - message(WARNING "Use qt5_add_binary_resources for binary option") - endif() - - foreach(it ${rcc_files}) - get_filename_component(outfilename ${it} NAME_WE) - get_filename_component(infile ${it} ABSOLUTE) - set(outfile ${CMAKE_CURRENT_BINARY_DIR}/generated/qrc_${outfilename}.cc) - - _QT5_PARSE_QRC_FILE(${infile} _out_depends _rc_depends) - - add_custom_command(OUTPUT ${outfile} - COMMAND ${Qt5Core_RCC_EXECUTABLE} - ARGS ${rcc_options} --name ${outfilename} --output ${outfile} ${infile} - MAIN_DEPENDENCY ${infile} - DEPENDS ${_rc_depends} "${out_depends}" VERBATIM) - list(APPEND ${outfiles} ${outfile}) - endforeach() - set(${outfiles} ${${outfiles}} PARENT_SCOPE) -endfunction()
\ No newline at end of file diff --git a/gui/gui.cmake b/gui/gui.cmake deleted file mode 100644 index 65705014..00000000 --- a/gui/gui.cmake +++ /dev/null @@ -1,30 +0,0 @@ -# Find the Qt5 libraries -find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED) -find_package(OpenGL REQUIRED) - -include( gui/Qt5Customizations.cmake ) - -# Find includes in corresponding build directories -include_directories(${CMAKE_CURRENT_BINARY_DIR}/generated) - -qt5_generate_moc(gui/mainwindow.h ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_mainwindow.cc) -qt5_generate_moc(gui/fpgaviewwidget.h ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_fpgaviewwidget.cc) -qt5_generate_moc(gui/pythontab.h ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_pythontab.cc) -qt5_generate_moc(gui/infotab.h ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_infotab.cc) -qt5_generate_moc(gui/designwidget.h ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_designwidget.cc) -qt5_generate_moc(gui/line_editor.h ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_line_editor.cc) - -set(GENERATED_MOC_FILES - ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_mainwindow.cc - ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_fpgaviewwidget.cc - ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_pythontab.cc - ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_infotab.cc - ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_designwidget.cc - ${CMAKE_CURRENT_BINARY_DIR}/generated/moc_line_editor.cc -) - -qt5_add_resources_custom(GUI_RESOURCE_FILES gui/nextpnr.qrc) - -aux_source_directory(gui/ GUI_ALL_SOURCE_FILES) -set(GUI_SOURCE_FILES ${GUI_ALL_SOURCE_FILES} ${GENERATED_MOC_FILES} ${GENERATED_UI_HEADERS} ${GUI_RESOURCE_FILES}) -set(GUI_LIBRARY_FILES Qt5::Widgets Qt5::OpenGL ${OPENGL_LIBRARIES} QtPropertyBrowser) diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index 087c54ba..91232390 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -25,6 +25,8 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent)
: QMainWindow(parent), ctx(_ctx)
{
+ Q_INIT_RESOURCE(nextpnr);
+
log_files.clear();
log_streams.clear();
log_write_function = [this](std::string text) { info->info(text); };
|