diff --git a/src/musredit_qt5/mupp/CMakeLists.txt b/src/musredit_qt5/mupp/CMakeLists.txt index 5ce201f9..27a556ae 100644 --- a/src/musredit_qt5/mupp/CMakeLists.txt +++ b/src/musredit_qt5/mupp/CMakeLists.txt @@ -1,9 +1,11 @@ -#--- mupp for Qt > 5.0 -------------------------------------------------------- +#--- mupp for Qt = 5.x -------------------------------------------------------- #--- Find includes in corresponding build directories ------------------------- set(CMAKE_INCLUDE_CURRENT_DIR ON) #--- instruct CMake to run moc automatically when needed ---------------------- set(CMAKE_AUTOMOC ON) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) #--- define mupp version ------------------------------------------------------ set(mupp_VERSION 1.0.0) @@ -34,9 +36,6 @@ add_custom_target( add_subdirectory(plotter) -qt5_add_resources(qrc_mupp.cpp mupp.qrc) -set_property(SOURCE qrc_mupp.cpp PROPERTY SKIP_AUTOMOC ON) # needed for cmake 3.x - set(GENERATED_HEADER_FILES mupp_version.h ) @@ -55,10 +54,10 @@ if (APPLE) set(RESOURCE_FILES icons/mupp.icns) add_executable(mupp MACOSX_BUNDLE ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} - qrc_mupp.cpp ${RESOURCE_FILES} + mupp.qrc ${RESOURCE_FILES} ) else (APPLE) - add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} qrc_mupp.cpp) + add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} mupp.qrc) endif (APPLE) #--- check if project source is repo ------------------------------------------ @@ -89,7 +88,7 @@ target_include_directories(mupp ) #--- use the Widgets and XML modules from Qt5 --------------------------------- -target_link_libraries(mupp Qt5::Widgets Qt5::Xml) +target_link_libraries(mupp PRIVATE Qt5::Widgets Qt5::Xml) #--- if macOS make an app rather than just a command line executable ---------- set_target_properties(mupp PROPERTIES diff --git a/src/musredit_qt5/musrStep/CMakeLists.txt b/src/musredit_qt5/musrStep/CMakeLists.txt index 9e3cf812..c6f00199 100644 --- a/src/musredit_qt5/musrStep/CMakeLists.txt +++ b/src/musredit_qt5/musrStep/CMakeLists.txt @@ -1,4 +1,4 @@ -#--- musrStep for Qt > 5.0 ---------------------------------------------------- +#--- musrStep for Qt = 5.x ---------------------------------------------------- #--- check if project source is repo ------------------------------------------ if (IS_GIT_REPO) @@ -7,6 +7,13 @@ else (IS_GIT_REPO) set(HAVE_GIT_REV_H "") endif (IS_GIT_REPO) +#--- instruct CMake to run moc automatically when needed ---------------------- +set(CMAKE_AUTOMOC ON) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(qt_libs Qt5::Core Qt5::Widgets Qt5::Svg) set(musrStep_src @@ -14,34 +21,17 @@ set(musrStep_src musrStep.cpp ) -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -#[==[ -# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files -# in the same directory as the cpp-files. -# Create code from a list of Qt designer ui files -set(CMAKE_AUTOUIC ON) -#]==] -set(CMAKE_AUTOUIC OFF) - -# add qt/rcc -qt5_add_resources(musrStep_rcc musrStep.qrc) - -# remove generated files from automoc and autouic -set_property(SOURCE qrc_musrStep.cpp PROPERTY SKIP_AUTOMOC ON) - set(macosx_icon icons/musrStep.icns) if (APPLE) add_executable(musrStep MACOSX_BUNDLE ${musrStep_src} - ${musrStep_rcc} + musrStep.qrc ${macosx_icon} ) else (APPLE) add_executable(musrStep ${musrStep_src} - ${musrStep_rcc} + musrStep.qrc ) endif (APPLE) @@ -59,7 +49,7 @@ target_compile_options(musrStep "${HAVE_GIT_REV_H}" ) -target_link_libraries(musrStep ${qt_libs}) +target_link_libraries(musrStep PRIVATE ${qt_libs}) #--- installation info -------------------------------------------------------- if (APPLE) diff --git a/src/musredit_qt5/musrWiz/CMakeLists.txt b/src/musredit_qt5/musrWiz/CMakeLists.txt index 5835b7e0..3d6a35ba 100644 --- a/src/musredit_qt5/musrWiz/CMakeLists.txt +++ b/src/musredit_qt5/musrWiz/CMakeLists.txt @@ -1,4 +1,4 @@ -#--- musrWiz for Qt > 5.0 ----------------------------------------------------- +#--- musrWiz for Qt = 5.x ----------------------------------------------------- #--- check if project source is repo ------------------------------------------ if (IS_GIT_REPO) @@ -7,6 +7,13 @@ else (IS_GIT_REPO) set(HAVE_GIT_REV_H "") endif (IS_GIT_REPO) +#--- instruct CMake to run moc automatically when needed ---------------------- +set(CMAKE_AUTOMOC ON) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(qt_libs Qt5::Core Qt5::Widgets Qt5::Svg Qt5::Xml) set(musrWiz_src @@ -18,34 +25,17 @@ set(musrWiz_src musrWiz.cpp ) -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -#[==[ -# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files -# in the same directory as the cpp-files. -# Create code from a list of Qt designer ui files -set(CMAKE_AUTOUIC ON) -#]==] -set(CMAKE_AUTOUIC OFF) - -# add qt/rcc -qt5_add_resources(musrWiz_rcc musrWiz.qrc) - -# remove generated files from automoc and autouic -set_property(SOURCE qrc_musrWiz.cpp PROPERTY SKIP_AUTOMOC ON) - set(macosx_icon icons/musrWiz.icns) if (APPLE) add_executable(musrWiz MACOSX_BUNDLE ${musrWiz_src} - ${musrWiz_rcc} + musrWiz.qrc ${macosx_icon} ) else (APPLE) add_executable(musrWiz ${musrWiz_src} - ${musrWiz_rcc} + musrWiz.qrc ) endif (APPLE) @@ -63,7 +53,7 @@ target_compile_options(musrWiz "${HAVE_GIT_REV_H}" ) -target_link_libraries(musrWiz ${qt_libs}) +target_link_libraries(musrWiz PRIVATE ${qt_libs}) #--- installation info -------------------------------------------------------- if (APPLE) diff --git a/src/musredit_qt5/musredit/CMakeLists.txt b/src/musredit_qt5/musredit/CMakeLists.txt index 8ab45807..8c287f8f 100644 --- a/src/musredit_qt5/musredit/CMakeLists.txt +++ b/src/musredit_qt5/musredit/CMakeLists.txt @@ -1,167 +1,141 @@ -#--- musredit for Qt > 5.0 ---------------------------------------------------- - -#--- check if project source is repo ------------------------------------------ -if (IS_GIT_REPO) - set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H") -else (IS_GIT_REPO) - set(HAVE_GIT_REV_H "") -endif (IS_GIT_REPO) - -set(qt_libs Qt5::Core Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Svg Qt5::PrintSupport) - -set(musredit_src - PTextEdit.cpp - PSubTextEdit.cpp - PAdmin.cpp - PFindDialog.cpp - PReplaceDialog.cpp - PReplaceConfirmationDialog.cpp - PFitOutputHandler.cpp - PDumpOutputHandler.cpp - PPrefsDialog.cpp - PGetMusrFTOptionsDialog.cpp - PGetTitleBlockDialog.cpp - PGetParameterBlockDialog.cpp - PGetTheoryBlockDialog.cpp - PGetFunctionsBlockDialog.cpp - PGetAsymmetryRunBlockDialog.cpp - PGetSingleHistoRunBlockDialog.cpp - PGetNonMusrRunBlockDialog.cpp - PGetFourierBlockDialog.cpp - PGetPlotBlockDialog.cpp - PMsr2DataDialog.cpp - PChangeDefaultPathsDialog.cpp - PMusrEditAbout.cpp - main.cpp -) - -set(musredit_ui - forms/PFindDialog.ui - forms/PReplaceDialog.ui - forms/PReplaceConfirmationDialog.ui - forms/PMusrEditAbout.ui - forms/PPrefsDialog.ui - forms/PGetMusrFTOptionsDialog.ui - forms/PGetTitleBlockDialog.ui - forms/PGetParameterBlockDialog.ui - forms/PGetTheoryBlockDialog.ui - forms/PGetFunctionsBlockDialog.ui - forms/PGetAsymmetryRunBlockDialog.ui - forms/PGetSingleHistoRunBlockDialog.ui - forms/PGetNonMusrRunBlockDialog.ui - forms/PGetFourierBlockDialog.ui - forms/PGetPlotBlockDialog.ui - forms/PMsr2DataDialog.ui - forms/PChangeDefaultPathsDialog.ui -) - -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -#[==[ -# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files -# in the same directory as the cpp-files. -# Create code from a list of Qt designer ui files -set(CMAKE_AUTOUIC ON) -#]==] -set(CMAKE_AUTOUIC OFF) - -# call qt/uic -qt5_wrap_ui(out_ui ${musredit_ui}) -# add qt/rcc -qt5_add_resources(musredit_rcc musredit.qrc) - -# remove generated files from automoc and autouic -set_property(SOURCE ui_PFindDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PReplaceDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PReplaceConfirmationDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PMusrEditAbout.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PPrefsDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetMusrFTOptionsDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetTitleBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetParameterBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetTheoryBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetFunctionsBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetAsymmetryRunBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetSingleHistoRunBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetNonMusrRunBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetFourierBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetPlotBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PMsr2DataDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PChangeDefaultPathsDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE qrc_musredit.cpp PROPERTY SKIP_AUTOMOC ON) - -if (APPLE) - if (${CMAKE_HOST_SYSTEM_VERSION} GREATER_EQUAL "20.3.0") - set(macosx_icon_name musredit-bigsur.icns) - else() - set(macosx_icon_name musredit.icns) - endif() - set(macosx_icon "icons/${macosx_icon_name}") -message(STATUS "macosx_icon: ${macosx_icon}") - add_executable(musredit MACOSX_BUNDLE - ${musredit_src} - ${out_ui} - ${musredit_rcc} - ${macosx_icon} - ) -else (APPLE) - add_executable(musredit - ${musredit_src} - ${out_ui} - ${musredit_rcc} - ) -endif (APPLE) - -target_include_directories(musredit - BEFORE PRIVATE - $ - $ - $ - $ - $ - $ -) - -target_compile_options(musredit - PRIVATE - "${HAVE_GIT_REV_H}" -) - -target_link_libraries(musredit ${qt_libs}) - -#--- installation info -------------------------------------------------------- -if (APPLE) - set_target_properties(musredit PROPERTIES - MACOSX_BUNDLE TRUE - MACOSX_BUNDLE_BUNDLE_NAME "musredit" - MACOSX_BUNDLE_INFO_STRING "musrfit: musredit simplifies the handling of the msr-files for uSR fitting." - MACOSX_BUNDLE_ICON_FILE "${macosx_icon_name}" - MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}" - MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.musredit" - MACOSX_BUNDLE_COPYRIGHT "Andreas Suter" - RESOURCE ${macosx_icon} - ) -endif (APPLE) - -if (APPLE) - install( TARGETS musredit - BUNDLE DESTINATION /Applications - ) -else (APPLE) - install( TARGETS musredit - RUNTIME DESTINATION bin - ) -endif (APPLE) - -#--- documentation installation info ------------------------------------------ -install( - DIRECTORY - ${CMAKE_SOURCE_DIR}/doc/examples - ${CMAKE_SOURCE_DIR}/doc/html - ${CMAKE_SOURCE_DIR}/doc/memos - DESTINATION - ${CMAKE_INSTALL_PREFIX}/share/doc/musrfit - MESSAGE_NEVER -) - +#--- musredit for Qt = 5.x ---------------------------------------------------- + +#--- check if project source is repo ------------------------------------------ +if (IS_GIT_REPO) + set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H") +else (IS_GIT_REPO) + set(HAVE_GIT_REV_H "") +endif (IS_GIT_REPO) + +#--- instruct CMake to run moc automatically when needed ---------------------- +set(CMAKE_AUTOMOC ON) +#--- create code from a list of Qt designer ui files -------------------------- +set(CMAKE_AUTOUIC ON) +#--- add forms to the uic search path ----------------------------------------- +set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/forms) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(qt_libs Qt5::Core Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Svg Qt5::PrintSupport) + +set(musredit_src + PTextEdit.cpp + PSubTextEdit.cpp + PAdmin.cpp + PFindDialog.cpp + PReplaceDialog.cpp + PReplaceConfirmationDialog.cpp + PFitOutputHandler.cpp + PDumpOutputHandler.cpp + PPrefsDialog.cpp + PGetMusrFTOptionsDialog.cpp + PGetTitleBlockDialog.cpp + PGetParameterBlockDialog.cpp + PGetTheoryBlockDialog.cpp + PGetFunctionsBlockDialog.cpp + PGetAsymmetryRunBlockDialog.cpp + PGetSingleHistoRunBlockDialog.cpp + PGetNonMusrRunBlockDialog.cpp + PGetFourierBlockDialog.cpp + PGetPlotBlockDialog.cpp + PMsr2DataDialog.cpp + PChangeDefaultPathsDialog.cpp + PMusrEditAbout.cpp + main.cpp +) + +set(musredit_ui + forms/PFindDialog.ui + forms/PReplaceDialog.ui + forms/PReplaceConfirmationDialog.ui + forms/PMusrEditAbout.ui + forms/PPrefsDialog.ui + forms/PGetMusrFTOptionsDialog.ui + forms/PGetTitleBlockDialog.ui + forms/PGetParameterBlockDialog.ui + forms/PGetTheoryBlockDialog.ui + forms/PGetFunctionsBlockDialog.ui + forms/PGetAsymmetryRunBlockDialog.ui + forms/PGetSingleHistoRunBlockDialog.ui + forms/PGetNonMusrRunBlockDialog.ui + forms/PGetFourierBlockDialog.ui + forms/PGetPlotBlockDialog.ui + forms/PMsr2DataDialog.ui + forms/PChangeDefaultPathsDialog.ui +) + +if (APPLE) + if (${CMAKE_HOST_SYSTEM_VERSION} GREATER_EQUAL "20.3.0") + set(macosx_icon_name musredit-bigsur.icns) + else() + set(macosx_icon_name musredit.icns) + endif() + set(macosx_icon "icons/${macosx_icon_name}") +message(STATUS "macosx_icon: ${macosx_icon}") + add_executable(musredit MACOSX_BUNDLE + ${musredit_src} + ${musredit_ui} + musredit.qrc + ${macosx_icon} + ) +else (APPLE) + add_executable(musredit + ${musredit_src} + ${musredit_ui} + musredit.qrc + ) +endif (APPLE) + +target_include_directories(musredit + BEFORE PRIVATE + $ + $ + $ + $ + $ + $ +) + +target_compile_options(musredit + PRIVATE + "${HAVE_GIT_REV_H}" +) + +target_link_libraries(musredit PRIVATE ${qt_libs}) + +#--- installation info -------------------------------------------------------- +if (APPLE) + set_target_properties(musredit PROPERTIES + MACOSX_BUNDLE TRUE + MACOSX_BUNDLE_BUNDLE_NAME "musredit" + MACOSX_BUNDLE_INFO_STRING "musrfit: musredit simplifies the handling of the msr-files for uSR fitting." + MACOSX_BUNDLE_ICON_FILE "${macosx_icon_name}" + MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_VERSION}" + MACOSX_BUNDLE_GUI_IDENTIFIER "ch.psi.lmu.musredit" + MACOSX_BUNDLE_COPYRIGHT "Andreas Suter" + RESOURCE ${macosx_icon} + ) +endif (APPLE) + +if (APPLE) + install( TARGETS musredit + BUNDLE DESTINATION /Applications + ) +else (APPLE) + install( TARGETS musredit + RUNTIME DESTINATION bin + ) +endif (APPLE) + +#--- documentation installation info ------------------------------------------ +install( + DIRECTORY + ${CMAKE_SOURCE_DIR}/doc/examples + ${CMAKE_SOURCE_DIR}/doc/html + ${CMAKE_SOURCE_DIR}/doc/memos + DESTINATION + ${CMAKE_INSTALL_PREFIX}/share/doc/musrfit + MESSAGE_NEVER +) diff --git a/src/musredit_qt6/mupp/CMakeLists.txt b/src/musredit_qt6/mupp/CMakeLists.txt index 4ccadb65..a5aaf056 100644 --- a/src/musredit_qt6/mupp/CMakeLists.txt +++ b/src/musredit_qt6/mupp/CMakeLists.txt @@ -1,9 +1,11 @@ -#--- mupp for Qt > 6.0 -------------------------------------------------------- +#--- mupp for Qt = 6.x -------------------------------------------------------- #--- Find includes in corresponding build directories ------------------------- set(CMAKE_INCLUDE_CURRENT_DIR ON) #--- instruct CMake to run moc automatically when needed ---------------------- set(CMAKE_AUTOMOC ON) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) #--- define mupp version ------------------------------------------------------ set(mupp_VERSION 1.0.0) @@ -34,9 +36,6 @@ add_custom_target( add_subdirectory(plotter) -qt6_add_resources(qrc_mupp.cpp mupp.qrc) -set_property(SOURCE qrc_mupp.cpp PROPERTY SKIP_AUTOMOC ON) # needed for cmake 3.x - set(GENERATED_HEADER_FILES mupp_version.h ) @@ -55,10 +54,10 @@ if (APPLE) set(RESOURCE_FILES icons/mupp.icns) add_executable(mupp MACOSX_BUNDLE ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} - qrc_mupp.cpp ${RESOURCE_FILES} + mupp.qrc ${RESOURCE_FILES} ) else (APPLE) - add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} qrc_mupp.cpp) + add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} mupp.qrc) endif (APPLE) #--- check if project source is repo ------------------------------------------ @@ -89,7 +88,7 @@ target_include_directories(mupp ) #--- use the Widgets and XML modules from Qt5 --------------------------------- -target_link_libraries(mupp Qt6::Widgets Qt6::Xml) +target_link_libraries(mupp PRIVATE Qt6::Widgets Qt6::Xml) #--- if macOS make an app rather than just a command line executable ---------- set_target_properties(mupp PROPERTIES diff --git a/src/musredit_qt6/musrStep/CMakeLists.txt b/src/musredit_qt6/musrStep/CMakeLists.txt index 623cebcf..4758704d 100644 --- a/src/musredit_qt6/musrStep/CMakeLists.txt +++ b/src/musredit_qt6/musrStep/CMakeLists.txt @@ -1,4 +1,4 @@ -#--- musrStep for Qt > 6.0 ---------------------------------------------------- +#--- musrStep for Qt = 6.x ---------------------------------------------------- #--- check if project source is repo ------------------------------------------ if (IS_GIT_REPO) @@ -7,6 +7,13 @@ else (IS_GIT_REPO) set(HAVE_GIT_REV_H "") endif (IS_GIT_REPO) +#--- instruct CMake to run moc automatically when needed ---------------------- +set(CMAKE_AUTOMOC ON) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(qt_libs Qt6::Core Qt6::Widgets Qt6::Svg) set(musrStep_src @@ -14,34 +21,17 @@ set(musrStep_src musrStep.cpp ) -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -#[==[ -# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files -# in the same directory as the cpp-files. -# Create code from a list of Qt designer ui files -set(CMAKE_AUTOUIC ON) -#]==] -set(CMAKE_AUTOUIC OFF) - -# add qt/rcc -qt6_add_resources(musrStep_rcc musrStep.qrc) - -# remove generated files from automoc and autouic -set_property(SOURCE qrc_musrStep.cpp PROPERTY SKIP_AUTOMOC ON) - set(macosx_icon icons/musrStep.icns) if (APPLE) add_executable(musrStep MACOSX_BUNDLE ${musrStep_src} - ${musrStep_rcc} + musrStep.qrc ${macosx_icon} ) else (APPLE) add_executable(musrStep ${musrStep_src} - ${musrStep_rcc} + musrStep.qrc ) endif (APPLE) @@ -59,7 +49,7 @@ target_compile_options(musrStep "${HAVE_GIT_REV_H}" ) -target_link_libraries(musrStep ${qt_libs}) +target_link_libraries(musrStep PRIVATE ${qt_libs}) #--- installation info -------------------------------------------------------- if (APPLE) diff --git a/src/musredit_qt6/musrWiz/CMakeLists.txt b/src/musredit_qt6/musrWiz/CMakeLists.txt index 0213045d..4242dccd 100644 --- a/src/musredit_qt6/musrWiz/CMakeLists.txt +++ b/src/musredit_qt6/musrWiz/CMakeLists.txt @@ -1,4 +1,4 @@ -#--- musrWiz for Qt > 6.0 ----------------------------------------------------- +#--- musrWiz for Qt = 6.x ----------------------------------------------------- #--- check if project source is repo ------------------------------------------ if (IS_GIT_REPO) @@ -7,6 +7,13 @@ else (IS_GIT_REPO) set(HAVE_GIT_REV_H "") endif (IS_GIT_REPO) +#--- instruct CMake to run moc automatically when needed ---------------------- +set(CMAKE_AUTOMOC ON) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(qt_libs Qt6::Core Qt6::Widgets Qt6::Svg Qt6::Xml) set(musrWiz_src @@ -18,34 +25,17 @@ set(musrWiz_src musrWiz.cpp ) -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -#[==[ -# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files -# in the same directory as the cpp-files. -# Create code from a list of Qt designer ui files -set(CMAKE_AUTOUIC ON) -#]==] -set(CMAKE_AUTOUIC OFF) - -# add qt/rcc -qt6_add_resources(musrWiz_rcc musrWiz.qrc) - -# remove generated files from automoc and autouic -set_property(SOURCE qrc_musrWiz.cpp PROPERTY SKIP_AUTOMOC ON) - set(macosx_icon icons/musrWiz.icns) if (APPLE) add_executable(musrWiz MACOSX_BUNDLE ${musrWiz_src} - ${musrWiz_rcc} + musrWiz.qrc ${macosx_icon} ) else (APPLE) add_executable(musrWiz ${musrWiz_src} - ${musrWiz_rcc} + musrWiz.qrc ) endif (APPLE) @@ -63,7 +53,7 @@ target_compile_options(musrWiz "${HAVE_GIT_REV_H}" ) -target_link_libraries(musrWiz ${qt_libs}) +target_link_libraries(musrWiz PRIVATE ${qt_libs}) #--- installation info -------------------------------------------------------- if (APPLE) diff --git a/src/musredit_qt6/musredit/CMakeLists.txt b/src/musredit_qt6/musredit/CMakeLists.txt index ed91d344..d389395f 100644 --- a/src/musredit_qt6/musredit/CMakeLists.txt +++ b/src/musredit_qt6/musredit/CMakeLists.txt @@ -1,4 +1,4 @@ -#--- musredit for Qt > 6.0 ---------------------------------------------------- +#--- musredit for Qt = 6.x ---------------------------------------------------- #--- check if project source is repo ------------------------------------------ if (IS_GIT_REPO) @@ -7,6 +7,17 @@ else (IS_GIT_REPO) set(HAVE_GIT_REV_H "") endif (IS_GIT_REPO) +#--- instruct CMake to run moc automatically when needed ---------------------- +set(CMAKE_AUTOMOC ON) +#--- create code from a list of Qt designer ui files -------------------------- +set(CMAKE_AUTOUIC ON) +#--- add forms to the uic search path ----------------------------------------- +set(CMAKE_AUTOUIC_SEARCH_PATHS ${CMAKE_CURRENT_SOURCE_DIR}/forms) +#--- deal with the resources -------------------------------------------------- +set(CMAKE_AUTORCC ON) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + set(qt_libs Qt6::Core Qt6::Widgets Qt6::Network Qt6::Xml Qt6::Svg Qt6::PrintSupport) set(musredit_src @@ -55,42 +66,6 @@ set(musredit_ui forms/PChangeDefaultPathsDialog.ui ) -# Instruct CMake to run moc automatically when needed -set(CMAKE_AUTOMOC ON) - -#[==[ -# as35 currently CMAKE_AUTOUIC -> ON doesn't work since it requires the ui-files -# in the same directory as the cpp-files. -# Create code from a list of Qt designer ui files -set(CMAKE_AUTOUIC ON) -#]==] -set(CMAKE_AUTOUIC OFF) - -# call qt/uic -qt6_wrap_ui(out_ui ${musredit_ui}) -# add qt/rcc -qt6_add_resources(musredit_rcc musredit.qrc) - -# remove generated files from automoc and autouic -set_property(SOURCE ui_PFindDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PReplaceDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PReplaceConfirmationDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PMusrEditAbout.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PPrefsDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetMusrFTOptionsDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetTitleBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetParameterBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetTheoryBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetFunctionsBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetAsymmetryRunBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetSingleHistoRunBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetNonMusrRunBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetFourierBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PGetPlotBlockDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PMsr2DataDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE ui_PChangeDefaultPathsDialog.h PROPERTY SKIP_AUTOMOC ON) -set_property(SOURCE qrc_musredit.cpp PROPERTY SKIP_AUTOMOC ON) - if (APPLE) if (${CMAKE_HOST_SYSTEM_VERSION} GREATER_EQUAL "20.3.0") set(macosx_icon_name musredit-bigsur.icns) @@ -100,15 +75,15 @@ if (APPLE) set(macosx_icon "icons/${macosx_icon_name}") add_executable(musredit MACOSX_BUNDLE ${musredit_src} - ${out_ui} - ${musredit_rcc} + ${musredit_ui} + musredit.qrc ${macosx_icon} ) else (APPLE) add_executable(musredit ${musredit_src} - ${out_ui} - ${musredit_rcc} + ${musredit_ui} + musredit.qrc ) endif (APPLE) @@ -127,7 +102,7 @@ target_compile_options(musredit "${HAVE_GIT_REV_H}" ) -target_link_libraries(musredit ${qt_libs}) +target_link_libraries(musredit PRIVATE ${qt_libs}) #--- installation info -------------------------------------------------------- if (APPLE)