diff options
| -rw-r--r-- | 3rdparty/QtPropertyBrowser/src/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | CMakeLists.txt | 14 | ||||
| -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 | 
6 files changed, 27 insertions, 95 deletions
diff --git a/3rdparty/QtPropertyBrowser/src/CMakeLists.txt b/3rdparty/QtPropertyBrowser/src/CMakeLists.txt index abee16a1..a312a10d 100644 --- a/3rdparty/QtPropertyBrowser/src/CMakeLists.txt +++ b/3rdparty/QtPropertyBrowser/src/CMakeLists.txt @@ -32,7 +32,6 @@ add_library(${TARGET_NAME} STATIC    ${_SRCS}    ${_UI_SRCS}    ${_QRC_SRCS} -  ${_IMPL_HDRS}    )  target_link_libraries(${TARGET_NAME} Qt5::Widgets) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f2cce58..be2edb62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,10 @@ find_package(PythonLibs 3.5 REQUIRED)  find_package(Boost REQUIRED COMPONENTS ${boost_libs}) +# Find the Qt5 libraries +find_package(Qt5 COMPONENTS Core Widgets OpenGL REQUIRED) +find_package(OpenGL REQUIRED) +  # Get the latest abbreviated commit hash of the working branch  execute_process(    COMMAND git log -1 --format=%h @@ -74,7 +78,6 @@ endif ()  if (NOT Boost_PYTHON_FOUND )      message( FATAL_ERROR "No version of Boost::Python 3.x could be found.")  endif () -include(gui/gui.cmake)  include_directories(common/ gui/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} 3rdparty/QtPropertyBrowser/src)  aux_source_directory(common/ COMMON_SRC_FILES) @@ -90,8 +93,11 @@ foreach (family ${FAMILIES})      string(TOUPPER ${family} ufamily)      aux_source_directory(${family}/ ${ufamily}_FILES)      aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES) + +    add_subdirectory(gui generated/gui/${family}) +      # Add the CLI binary target -    add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} ${GUI_SOURCE_FILES}) +    add_executable(nextpnr-${family} ${COMMON_FILES} ${${ufamily}_FILES} )      install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)      target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE) @@ -109,9 +115,9 @@ 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}/) +        target_include_directories(${target} PRIVATE ${family}/ generated/)          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 gui_${family} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES_${ufamily}})      endforeach (target)  endforeach (family) 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); };
  | 
