Cleanup of cmake files for easier development
This commit is contained in:
parent
e14b8bac66
commit
36c16cd28e
@ -32,7 +32,6 @@ add_library(${TARGET_NAME} STATIC
|
|||||||
${_SRCS}
|
${_SRCS}
|
||||||
${_UI_SRCS}
|
${_UI_SRCS}
|
||||||
${_QRC_SRCS}
|
${_QRC_SRCS}
|
||||||
${_IMPL_HDRS}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(${TARGET_NAME} Qt5::Widgets)
|
target_link_libraries(${TARGET_NAME} Qt5::Widgets)
|
||||||
|
@ -15,6 +15,10 @@ find_package(PythonLibs 3.5 REQUIRED)
|
|||||||
|
|
||||||
find_package(Boost REQUIRED COMPONENTS ${boost_libs})
|
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
|
# Get the latest abbreviated commit hash of the working branch
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND git log -1 --format=%h
|
COMMAND git log -1 --format=%h
|
||||||
@ -74,7 +78,6 @@ endif ()
|
|||||||
if (NOT Boost_PYTHON_FOUND )
|
if (NOT Boost_PYTHON_FOUND )
|
||||||
message( FATAL_ERROR "No version of Boost::Python 3.x could be found.")
|
message( FATAL_ERROR "No version of Boost::Python 3.x could be found.")
|
||||||
endif ()
|
endif ()
|
||||||
include(gui/gui.cmake)
|
|
||||||
|
|
||||||
include_directories(common/ gui/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} 3rdparty/QtPropertyBrowser/src)
|
include_directories(common/ gui/ frontend/json ${Boost_INCLUDE_DIRS} ${PYTHON_INCLUDE_DIRS} 3rdparty/QtPropertyBrowser/src)
|
||||||
aux_source_directory(common/ COMMON_SRC_FILES)
|
aux_source_directory(common/ COMMON_SRC_FILES)
|
||||||
@ -90,8 +93,11 @@ 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)
|
aux_source_directory(tests/${family}/ ${ufamily}_TEST_FILES)
|
||||||
|
|
||||||
|
add_subdirectory(gui generated/gui/${family})
|
||||||
|
|
||||||
# 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} )
|
||||||
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
|
install(TARGETS nextpnr-${family} RUNTIME DESTINATION bin)
|
||||||
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
|
target_compile_definitions(nextpnr-${family} PRIVATE MAIN_EXECUTABLE)
|
||||||
|
|
||||||
@ -109,9 +115,9 @@ foreach (family ${FAMILIES})
|
|||||||
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}/ generated/)
|
||||||
target_compile_definitions(${target} PRIVATE NEXTPNR_NAMESPACE=nextpnr_${family} ARCH_${ufamily} ARCHNAME=${family} QT_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 gui_${family} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} ${GUI_LIBRARY_FILES_${ufamily}})
|
||||||
endforeach (target)
|
endforeach (target)
|
||||||
endforeach (family)
|
endforeach (family)
|
||||||
|
|
||||||
|
15
gui/CMakeLists.txt
Normal file
15
gui/CMakeLists.txt
Normal file
@ -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)
|
@ -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()
|
|
@ -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)
|
|
@ -25,6 +25,8 @@
|
|||||||
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
|
||||||
: QMainWindow(parent), ctx(_ctx)
|
: QMainWindow(parent), ctx(_ctx)
|
||||||
{
|
{
|
||||||
|
Q_INIT_RESOURCE(nextpnr);
|
||||||
|
|
||||||
log_files.clear();
|
log_files.clear();
|
||||||
log_streams.clear();
|
log_streams.clear();
|
||||||
log_write_function = [this](std::string text) { info->info(text); };
|
log_write_function = [this](std::string text) { info->info(text); };
|
||||||
|
Loading…
Reference in New Issue
Block a user