mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
add qrc file to cmake build process
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21045 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0e08bc5e16
commit
0f939f0a79
@ -204,3 +204,29 @@ macro(lyx_const_touched_files _allinone_name _list)
|
||||
endmacro(lyx_const_touched_files)
|
||||
|
||||
|
||||
macro(lyx_qt_resources_file _qrc_name _to_dir _list)
|
||||
if (NOT EXISTS ${_qrc_name})
|
||||
set(_rebuild_file 1)
|
||||
else()
|
||||
FILE(READ ${_qrc_name} _file_content)
|
||||
if (NOT _file_content)
|
||||
set(_rebuild_file 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (_rebuild_file)
|
||||
message(STATUS "Generating ${_qrc_name}")
|
||||
file(WRITE ${_qrc_name} "<!DOCTYPE RCC><RCC version=\"1.0\">\n")
|
||||
file(APPEND ${_qrc_name} "<qresource>\n")
|
||||
|
||||
foreach (_current_FILE ${${_list}})
|
||||
get_filename_component(_abs_FILE ${_current_FILE} ABSOLUTE)
|
||||
string(REGEX REPLACE "${_to_dir}" "" _file_name ${_abs_FILE})
|
||||
file(APPEND ${_qrc_name} " <file alias=\"${_file_name}\">${_abs_FILE}</file>\n")
|
||||
endforeach (_current_FILE)
|
||||
|
||||
file(APPEND ${_qrc_name} "</qresource>\n")
|
||||
file(APPEND ${_qrc_name} "</RCC>\n")
|
||||
endif()
|
||||
endmacro(lyx_const_touched_files)
|
||||
|
||||
|
@ -19,6 +19,12 @@ lyx_automoc(${frontends_qt4_sources})
|
||||
|
||||
lyx_add_ui_files(frontends_qt4_sources ui_files ${frontend_qt4_UI})
|
||||
|
||||
file(GLOB_RECURSE frontend_qt4_images ${TOP_SRC_DIR}/lib/images/*.png)
|
||||
set(resource_name ${CMAKE_CURRENT_BINARY_DIR}/Resources.qrc)
|
||||
lyx_qt_resources_file(${resource_name} "${TOP_SRC_DIR}/lib/" frontend_qt4_images)
|
||||
qt4_add_resources(resource_files ${resource_name})
|
||||
|
||||
|
||||
add_definitions(-DQT_GENUINE_STR -DLYX_BUILD_QT4_FRONTEND)
|
||||
|
||||
include_directories(
|
||||
@ -34,12 +40,13 @@ if(MERGE_FILES)
|
||||
set_source_files_properties(_allinone_touched.C
|
||||
PROPERTIES OBJECT_DEPENDS "${depends_moc_uic}")
|
||||
add_library(frontend_qt4 ${library_type}
|
||||
${_allinone_files} ${frontends_qt4_headers} ${ui_files})
|
||||
${_allinone_files} ${frontends_qt4_headers} ${ui_files} ${resource_files})
|
||||
else()
|
||||
add_library(frontend_qt4 ${library_type}
|
||||
${frontends_qt4_sources} ${frontends_qt4_headers} ${ui_files})
|
||||
${frontends_qt4_sources} ${frontends_qt4_headers} ${ui_files} ${resource_files})
|
||||
endif()
|
||||
|
||||
|
||||
target_link_libraries(frontend_qt4
|
||||
frontends
|
||||
${QT_QTCORE_LIBRARY}
|
||||
|
@ -45,10 +45,9 @@
|
||||
|
||||
static void initializeResources()
|
||||
{
|
||||
extern void qInitResources();
|
||||
static bool initialized = false;
|
||||
if (!initialized) {
|
||||
qInitResources();
|
||||
Q_INIT_RESOURCE(Resources);
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user