From 155b781e76305f29f17e9247d9ff1db72a9bf10f Mon Sep 17 00:00:00 2001 From: Gennady Pospelov <g.pospelov@fz-juelich.de> Date: Tue, 17 Jun 2014 11:38:09 +0200 Subject: [PATCH] New library libBornAgainGUI --- GUI/CMakeLists.txt | 5 +--- GUI/coregui/CMakeLists.txt | 27 ++++++++++++++------- GUI/coregui/mainwindow/mainwindow.cpp | 13 +--------- GUI/coregui/mainwindow/mainwindow.h | 7 ------ GUI/coregui/mainwindow/projectmanager.cpp | 1 + GUI/main/CMakeLists.txt | 29 +++++++++++++++++++++++ GUI/{coregui/mainwindow => main}/main.cpp | 0 Tests/FunctionalTests/CMakeLists.txt | 2 +- 8 files changed, 52 insertions(+), 32 deletions(-) create mode 100644 GUI/main/CMakeLists.txt rename GUI/{coregui/mainwindow => main}/main.cpp (100%) diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt index a8d4950a0d9..6defccd8fb3 100644 --- a/GUI/CMakeLists.txt +++ b/GUI/CMakeLists.txt @@ -12,9 +12,6 @@ find_package(Qt5Widgets REQUIRED) add_subdirectory(externals/qt-manhattan-style) add_subdirectory(externals/qcustomplot) -#add_subdirectory(externals/qt-root) -#add_subdirectory(externals/qt-root-gui-factory) add_subdirectory(externals/qtpropertybrowser) add_subdirectory(coregui) - - +add_subdirectory(main) diff --git a/GUI/coregui/CMakeLists.txt b/GUI/coregui/CMakeLists.txt index f4489d2c258..985bb690a1a 100644 --- a/GUI/coregui/CMakeLists.txt +++ b/GUI/coregui/CMakeLists.txt @@ -8,7 +8,7 @@ if(POLICY CMP0020) cmake_policy(SET CMP0020 NEW) endif() -set(executable_name coregui) +set(library_name BornAgainGUI) # --- source and include files --- set(include_dirs @@ -78,9 +78,22 @@ set(CMAKE_AUTOMOC ON) qt5_add_resources(RC_SRCS ${resource_files}) add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x040900) -add_executable(${executable_name} ${source_files} ${RC_SRCS} ${include_files}) +#add_executable(${executable_name} ${source_files} ${RC_SRCS} ${include_files}) -qt5_use_modules(${executable_name} Widgets Core Gui Script Designer PrintSupport) +# --- making library --- +add_library( + ${library_name} + SHARED + ${source_files} ${RC_SRCS} ${include_files} +) +set_Target_properties(${library_name} PROPERTIES PREFIX ${libprefix} SUFFIX ${libsuffix}) +set(${library_name}_LIBRARY_TYPE SHARED) +# exposing library name and list of include directories outside +set(${library_name}_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE) +set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE) + + +qt5_use_modules(${library_name} Widgets Core Gui Script Designer PrintSupport) # --- dependencies --- include_directories( @@ -98,22 +111,20 @@ include_directories( ) -target_link_libraries(${executable_name} +target_link_libraries(${library_name} ${ManhattanStyle_LIBRARY} ${qcustomplot_LIBRARY} ${qtpropertybrowser_LIBRARY} -# ${GQt_LIBRARY} -# ${QtRoot_LIBRARY} ${PYTHON_LIBRARY} ${Boost_LIBRARIES} -# ${ROOT_LIBRARIES} ${BornAgainCore_LIBRARY} ${BornAgainFit_LIBRARY} ) # --- Installation --- -install (TARGETS ${executable_name} DESTINATION ${destination_bin} COMPONENT Applications) +#install (TARGETS ${executable_name} DESTINATION ${destination_bin} COMPONENT Applications) +install (TARGETS ${library_name} DESTINATION ${destination_lib} COMPONENT Libraries) # system libraries: ROOT installation if(WIN32) diff --git a/GUI/coregui/mainwindow/mainwindow.cpp b/GUI/coregui/mainwindow/mainwindow.cpp index 5569d6f4db0..f2ec4c13ba4 100644 --- a/GUI/coregui/mainwindow/mainwindow.cpp +++ b/GUI/coregui/mainwindow/mainwindow.cpp @@ -36,6 +36,7 @@ #include "SampleBuilderFactory.h" #include "GUIObjectBuilder.h" #include "tooltipdatabase.h" +#include "mainwindow_constants.h" #include <QApplication> #include <QStatusBar> @@ -214,18 +215,6 @@ void MainWindow::initSimModel() //mp_sim_data_model->addSample(tr("Default cylinder single layer"), createDefaultSample()); } -//Instrument *MainWindow::createDefaultInstrument() -//{ -// Instrument *p_result = new Instrument; -// p_result->setBeamParameters(0.1*Units::nanometer, 0.2*Units::degree, 0.0); -// p_result->setBeamIntensity(1e7); -//// p_result->setDetectorParameters(100, -1.0*Units::degree, 1.0*Units::degree, -//// 100, 0.0*Units::degree, 2.0*Units::degree); -// p_result->setDetectorParameters(100, 0.0*Units::degree, 2.0*Units::degree, -// 100, 0.0*Units::degree, 2.0*Units::degree, true); -// return p_result; -//} - void MainWindow::initJobQueueModel() { diff --git a/GUI/coregui/mainwindow/mainwindow.h b/GUI/coregui/mainwindow/mainwindow.h index c37a5ea15c9..cb74010992b 100644 --- a/GUI/coregui/mainwindow/mainwindow.h +++ b/GUI/coregui/mainwindow/mainwindow.h @@ -3,8 +3,6 @@ #include <QMainWindow> #include "fancymainwindow.h" -#include "mainwindow_constants.h" - namespace Manhattan { class FancyTabWidget; @@ -97,11 +95,6 @@ private: void updateInstruments(); void testGUIObjectBuilder(); - - - // dummy instrument creator -// Instrument *createDefaultInstrument(); -// ISample *createDefaultSample(); }; #endif // MAINWINDOW_H diff --git a/GUI/coregui/mainwindow/projectmanager.cpp b/GUI/coregui/mainwindow/projectmanager.cpp index d5e0cd92429..24f41ededc1 100644 --- a/GUI/coregui/mainwindow/projectmanager.cpp +++ b/GUI/coregui/mainwindow/projectmanager.cpp @@ -3,6 +3,7 @@ #include "mainwindow.h" #include "projectdocument.h" #include "actionmanager.h" +#include "mainwindow_constants.h" #include "GUIHelpers.h" #include <QDir> #include <QFileDialog> diff --git a/GUI/main/CMakeLists.txt b/GUI/main/CMakeLists.txt new file mode 100644 index 00000000000..4a241c68e8e --- /dev/null +++ b/GUI/main/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR) + +if(POLICY CMP0020) +cmake_policy(SET CMP0020 NEW) +endif() + +set(executable_name BornAgain) + +include_directories( + ${CMAKE_SOURCE_DIR}/GUI/coregui/mainwindow + ${ManhattanStyle_INCLUDE_DIRS} +) + +add_executable(${executable_name} main.cpp) + +target_link_libraries(${executable_name} + ${ManhattanStyle_LIBRARY} + ${qcustomplot_LIBRARY} + ${qtpropertybrowser_LIBRARY} + ${PYTHON_LIBRARY} + ${Boost_LIBRARIES} + ${BornAgainCore_LIBRARY} + ${BornAgainFit_LIBRARY} + ${BornAgainGUI_LIBRARY} +) + +# --- Installation --- +install (TARGETS ${executable_name} DESTINATION ${destination_bin} COMPONENT Applications) + diff --git a/GUI/coregui/mainwindow/main.cpp b/GUI/main/main.cpp similarity index 100% rename from GUI/coregui/mainwindow/main.cpp rename to GUI/main/main.cpp diff --git a/Tests/FunctionalTests/CMakeLists.txt b/Tests/FunctionalTests/CMakeLists.txt index 421f6080e45..a8e8d8a5d89 100644 --- a/Tests/FunctionalTests/CMakeLists.txt +++ b/Tests/FunctionalTests/CMakeLists.txt @@ -19,7 +19,7 @@ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/T #COPY_IF_DIFFERENT( ${CMAKE_SOURCE_DIR}/Tests/FunctionalTests/TestPyFit ${CMAKE_BINARY_DIR}/Tests/FunctionalTests/TestPyFit ${SRC_FILES} IncludeTargets "Includes") if(BORNAGAIN_GUI) - add_subdirectory(TestGUI) +# add_subdirectory(TestGUI) endif() #add_subdirectory(TestCore) -- GitLab