Skip to content
Snippets Groups Projects
Commit 14b6bfc4 authored by Jan Möbius's avatar Jan Möbius
Browse files

Enabled autouic, does not work as only ui_file.h and not .hh ist accepted

parent 74bbcae6
No related branches found
No related tags found
1 merge request!123Enable autouic
......@@ -80,9 +80,6 @@ acg_append_files (ui "*.ui" ${directories})
# remove template cc files from source file list
acg_drop_templates (sources)
# genereate uic targets
acg_qt5_autouic (uic_targets ${ui})
set(RC_SRC "")
if ( EXISTS ${BRANDING_DIRECTORY}/branding.qrc )
......@@ -114,14 +111,14 @@ RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR}/../../ )
if (WIN32)
# add app icon rc file to windows build
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${uic_targets} ${sources} ${headers} ${RC_SRC})
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${ui} ${sources} ${headers} ${RC_SRC})
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries (${OPENFLIPPER_PRODUCT_STRING} ${QT_QTMAIN_LIBRARY})
elseif (APPLE)
# generate bundle on mac
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} MACOSX_BUNDLE ${uic_targets} ${sources} ${headers} ${RC_SRC})
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} MACOSX_BUNDLE ${ui} ${sources} ${headers} ${RC_SRC})
else ()
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} ${uic_targets} ${sources} ${headers} ${RC_SRC})
acg_add_executable (${OPENFLIPPER_PRODUCT_STRING} ${ui} ${sources} ${headers} ${RC_SRC})
endif ()
# Mark this build part as building OpenFlippers Core
......
......@@ -142,22 +142,13 @@ endforeach ()
# remove template cc files from source file list
acg_drop_templates (sources)
#=======================================================
# Moc/UIC handling
#=======================================================
# genereate uic and moc targets
if (QT5_FOUND)
acg_qt5_autouic (uic_targets ${ui})
endif ()
#=======================================================
# Create library
#=======================================================
RECURSE_GROUPS( ${CMAKE_CURRENT_SOURCE_DIR}/../../ )
if (QT5_FOUND)
acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} )
acg_add_library (OpenFlipperPluginLib SHARED ${ui} ${sources} ${headers} )
endif ()
......
......@@ -153,38 +153,6 @@ macro (acg_qt5)
endif ()
endmacro ()
# generate uic targets for sources in list
macro (acg_qt5_autouic uic_SRCS)
set (_matching_FILES )
foreach (_current_FILE ${ARGN})
get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE)
if ( EXISTS ${_abs_FILE} )
file (READ ${_abs_FILE} _contents)
get_filename_component (_abs_PATH ${_abs_FILE} PATH)
get_filename_component (_basename ${_current_FILE} NAME_WE)
string (REGEX REPLACE "Ui$" "" _cbasename ${_basename})
set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh)
set (_header ${_basename}.hh)
set (_source ${_abs_PATH}/${_cbasename}.cc)
add_custom_command (OUTPUT ${_outfile}
COMMAND ${Qt5Widgets_UIC_EXECUTABLE}
ARGS -o ${_outfile} ${_abs_FILE}
MAIN_DEPENDENCY ${_abs_FILE} VERBATIM)
add_file_dependencies (${_source} ${_outfile})
set (${uic_SRCS} ${${uic_SRCS}} ${_outfile})
endif ()
endforeach ()
endmacro ()
# generate qrc targets for sources in list
macro (acg_qt5_autoqrc qrc_SRCS)
......
......@@ -60,6 +60,7 @@ set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/OpenFlipper/cmak
# Enable automoc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
......
......@@ -373,10 +373,7 @@ macro (_plugin_licensemanagement)
acg_append_files (keygen_src "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
acg_append_files (keygen_ui "*.ui" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
# genereate uic targets
acg_qt5_autouic (keygen_uic ${keygen_ui})
add_executable (Plugin-${plugin}-keygen ${keygen_uic} ${keygen_hdr} ${keygen_src})
add_executable (Plugin-${plugin}-keygen ${keygen_ui} ${keygen_hdr} ${keygen_src})
target_link_libraries (
Plugin-${plugin}-keygen
......@@ -641,12 +638,11 @@ function (_build_openflipper_plugin plugin)
add_definitions(${${_PLUGIN}_TYPE_DEFINITIONS})
# genereate uic targets
acg_qt5_autouic (uic_targets ${ui})
# genereate qrc targets
acg_qt5_autoqrc (qrc_targets ${qrc})
add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${qrc_targets} ${${_PLUGIN}_ADDSRC})
add_library (Plugin-${plugin} MODULE ${ui} ${sources} ${headers} ${qrc_targets} ${${_PLUGIN}_ADDSRC})
#group projects by parent folder name on MSVC (used for e.g. plugincollection)
get_filename_component(PARENT_DIR ${CMAKE_CURRENT_SOURCE_DIR} DIRECTORY)
get_filename_component(PARENT_DIR_NAME "${PARENT_DIR}" NAME)
......@@ -656,7 +652,7 @@ function (_build_openflipper_plugin plugin)
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "1")
if (STATIC_PLUGIN_${_PLUGIN})
add_library (Plugin-Static-${plugin} STATIC ${uic_targets} ${sources} ${headers} ${qrc_targets} ${${_PLUGIN}_ADDSRC})
add_library (Plugin-Static-${plugin} STATIC ${ui} ${sources} ${headers} ${qrc_targets} ${${_PLUGIN}_ADDSRC})
set_target_properties(Plugin-Static-${plugin} PROPERTIES COMPILE_DEFINITIONS "QT_STATICPLUGIN")
get_target_property(PLUGIN_OUTPUT_FILENAME Plugin-${plugin} LOCATION)
get_filename_component(PLUGIN_OUTPUT_FILENAME "${PLUGIN_OUTPUT_FILENAME}" NAME)
......
......@@ -41,7 +41,6 @@ endif ()
acg_append_files_recursive (headers "*.hh" . )
acg_append_files_recursive (sources "*.cc" . )
acg_append_files_recursive (ui "*.ui" . )
acg_qt5_autouic (uic_targets ${ui})
# Match our current directory name
......@@ -62,7 +61,7 @@ include_directories (
# remove template cc files from source file list
acg_drop_templates (sources)
acg_add_library ( ${TYPENAME} SHARED ${uic_targets} ${sources} ${headers})
acg_add_library ( ${TYPENAME} SHARED ${ui} ${sources} ${headers})
set_target_properties ( ${TYPENAME} PROPERTIES MACOSX_RPATH 0 )
add_dependencies( ${TYPENAME} OpenMeshCore OpenMeshTools ACG OpenFlipperPluginLib)
......
......@@ -115,13 +115,12 @@ acg_drop_templates (sources)
# genereate uic and moc targets
if (QT5_FOUND)
acg_qt5_autouic (uic_targets ${ui})
acg_qt5_autoqrc (qrc_targets ${qrc})
endif()
if (QT5_FOUND)
acg_add_library (ACG SHARED ${uic_targets} ${sources} ${headers} ${qrc_targets})
acg_add_library (ACG SHARED ${ui} ${sources} ${headers} ${qrc_targets})
endif()
if ( NOT WIN32 )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment