mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-27 06:38:44 -05:00
Tidy up resource generation with a CMake function
This change generates all the resources using a CMake function add_resources() and substitution into a template .qrc file. The location of resource files in the source tree is no longer related to the path of the resources in the embedded executable resources file system. Instead the roesources are embedded with predetermined paths e.g. :/, :/Palettes/ and, :/samples/ . git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5131 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
75bbb2869d
commit
8f7f6b43b9
@ -383,19 +383,50 @@ set (all_C_and_CXXSRCS
|
|||||||
${all_CXXSRCS}
|
${all_CXXSRCS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set (TOP_LEVEL_RESOURCES
|
||||||
|
shortcuts.txt
|
||||||
|
mouse_commands.txt
|
||||||
|
prefixes.txt
|
||||||
|
cty.dat
|
||||||
|
kvasd.dat
|
||||||
|
)
|
||||||
|
|
||||||
|
set (PALETTE_FILES
|
||||||
|
Palettes/Banana.pal
|
||||||
|
Palettes/Blue1.pal
|
||||||
|
Palettes/Blue2.pal
|
||||||
|
Palettes/Blue3.pal
|
||||||
|
Palettes/Brown.pal
|
||||||
|
Palettes/Cyan1.pal
|
||||||
|
Palettes/Cyan2.pal
|
||||||
|
Palettes/Cyan3.pal
|
||||||
|
Palettes/Default.pal
|
||||||
|
Palettes/Digipan.pal
|
||||||
|
Palettes/Fldigi.pal
|
||||||
|
Palettes/Gray1.pal
|
||||||
|
Palettes/Gray2.pal
|
||||||
|
Palettes/Green1.pal
|
||||||
|
Palettes/Green2.pal
|
||||||
|
Palettes/Jungle.pal
|
||||||
|
Palettes/Linrad.pal
|
||||||
|
Palettes/Negative.pal
|
||||||
|
Palettes/Orange.pal
|
||||||
|
Palettes/Pink.pal
|
||||||
|
Palettes/Rainbow.pal
|
||||||
|
Palettes/Scope.pal
|
||||||
|
Palettes/Sunburst.pal
|
||||||
|
Palettes/VK4BDJ.pal
|
||||||
|
Palettes/YL2KF.pal
|
||||||
|
Palettes/Yellow1.pal
|
||||||
|
Palettes/Yellow2.pal
|
||||||
|
Palettes/ZL1FZ.pal
|
||||||
|
)
|
||||||
|
|
||||||
set (SAMPLE_FILES
|
set (SAMPLE_FILES
|
||||||
samples/130418_1742.wav
|
samples/130418_1742.wav
|
||||||
samples/130610_2343.wav
|
samples/130610_2343.wav
|
||||||
)
|
)
|
||||||
|
|
||||||
if (WSJT_EMBED_SAMPLES)
|
|
||||||
foreach (SAMPLE ${SAMPLE_FILES})
|
|
||||||
set (SAMPLE_PATHS "${SAMPLE_PATHS}\n <file alias=\"samples/${SAMPLE}\">${CMAKE_SOURCE_DIR}/${SAMPLE}</file>")
|
|
||||||
endforeach (SAMPLE ${SAMPLE_FILES})
|
|
||||||
endif (WSJT_EMBED_SAMPLES)
|
|
||||||
|
|
||||||
configure_file (wsjtx.qrc.in wsjtx.qrc @ONLY)
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
set (WSJTX_ICON_FILE ${CMAKE_PROJECT_NAME}.icns)
|
set (WSJTX_ICON_FILE ${CMAKE_PROJECT_NAME}.icns)
|
||||||
set (ICONSRCS
|
set (ICONSRCS
|
||||||
@ -688,6 +719,26 @@ elseif (CMAKE_HOST_WIN32)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
|
||||||
|
# embedded resources
|
||||||
|
function (add_resources resources path)
|
||||||
|
foreach (resource_file_ ${ARGN})
|
||||||
|
get_filename_component (name_ ${resource_file_} NAME)
|
||||||
|
file (TO_NATIVE_PATH ${CMAKE_SOURCE_DIR}/${resource_file_} source_)
|
||||||
|
file (TO_NATIVE_PATH ${path}/${name_} dest_)
|
||||||
|
set (resources_ "${resources_}\n <file alias=\"${dest_}\">${source_}</file>")
|
||||||
|
set (${resources} ${${resources}}${resources_} PARENT_SCOPE)
|
||||||
|
endforeach (resource_file_ ${ARGN})
|
||||||
|
endfunction (add_resources resources path)
|
||||||
|
|
||||||
|
add_resources (wsjtx_RESOURCES "" ${TOP_LEVEL_RESOURCES})
|
||||||
|
add_resources (wsjtx_RESOURCES /Palettes ${PALETTE_FILES})
|
||||||
|
if (WSJT_EMBED_SAMPLES)
|
||||||
|
add_resources (wsjtx_RESOURCES /samples ${SAMPLE_FILES})
|
||||||
|
endif (WSJT_EMBED_SAMPLES)
|
||||||
|
|
||||||
|
configure_file (wsjtx.qrc.in wsjtx.qrc @ONLY)
|
||||||
|
|
||||||
|
|
||||||
# UI generation
|
# UI generation
|
||||||
qt5_wrap_ui (wsjt_qt_GENUISRCS ${wsjt_qt_UISRCS})
|
qt5_wrap_ui (wsjt_qt_GENUISRCS ${wsjt_qt_UISRCS})
|
||||||
qt5_wrap_ui (wsjtx_GENUISRCS ${wsjtx_UISRCS})
|
qt5_wrap_ui (wsjtx_GENUISRCS ${wsjtx_UISRCS})
|
||||||
|
41
wsjtx.qrc.in
41
wsjtx.qrc.in
@ -1,38 +1,5 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<!DOCTYPE RCC>
|
||||||
<qresource>
|
<RCC version="1.0">
|
||||||
<file alias="shortcuts.txt">@CMAKE_SOURCE_DIR@/shortcuts.txt</file>
|
<qresource>@wsjtx_RESOURCES@
|
||||||
<file alias="mouse_commands.txt">@CMAKE_SOURCE_DIR@/mouse_commands.txt</file>
|
</qresource>
|
||||||
<file alias="prefixes.txt">@CMAKE_SOURCE_DIR@/prefixes.txt</file>
|
|
||||||
<file alias="cty.dat">@CMAKE_SOURCE_DIR@/cty.dat</file>
|
|
||||||
<file alias="kvasd.dat">@CMAKE_SOURCE_DIR@/kvasd.dat</file>
|
|
||||||
<file alias="Palettes/Banana.pal">@CMAKE_SOURCE_DIR@/Palettes/Banana.pal</file>
|
|
||||||
<file alias="Palettes/Blue1.pal">@CMAKE_SOURCE_DIR@/Palettes/Blue1.pal</file>
|
|
||||||
<file alias="Palettes/Blue2.pal">@CMAKE_SOURCE_DIR@/Palettes/Blue2.pal</file>
|
|
||||||
<file alias="Palettes/Blue3.pal">@CMAKE_SOURCE_DIR@/Palettes/Blue3.pal</file>
|
|
||||||
<file alias="Palettes/Brown.pal">@CMAKE_SOURCE_DIR@/Palettes/Brown.pal</file>
|
|
||||||
<file alias="Palettes/Cyan1.pal">@CMAKE_SOURCE_DIR@/Palettes/Cyan1.pal</file>
|
|
||||||
<file alias="Palettes/Cyan2.pal">@CMAKE_SOURCE_DIR@/Palettes/Cyan2.pal</file>
|
|
||||||
<file alias="Palettes/Cyan3.pal">@CMAKE_SOURCE_DIR@/Palettes/Cyan3.pal</file>
|
|
||||||
<file alias="Palettes/Default.pal">@CMAKE_SOURCE_DIR@/Palettes/Default.pal</file>
|
|
||||||
<file alias="Palettes/Digipan.pal">@CMAKE_SOURCE_DIR@/Palettes/Digipan.pal</file>
|
|
||||||
<file alias="Palettes/Fldigi.pal">@CMAKE_SOURCE_DIR@/Palettes/Fldigi.pal</file>
|
|
||||||
<file alias="Palettes/Gray1.pal">@CMAKE_SOURCE_DIR@/Palettes/Gray1.pal</file>
|
|
||||||
<file alias="Palettes/Gray2.pal">@CMAKE_SOURCE_DIR@/Palettes/Gray2.pal</file>
|
|
||||||
<file alias="Palettes/Green1.pal">@CMAKE_SOURCE_DIR@/Palettes/Green1.pal</file>
|
|
||||||
<file alias="Palettes/Green2.pal">@CMAKE_SOURCE_DIR@/Palettes/Green2.pal</file>
|
|
||||||
<file alias="Palettes/Jungle.pal">@CMAKE_SOURCE_DIR@/Palettes/Jungle.pal</file>
|
|
||||||
<file alias="Palettes/Linrad.pal">@CMAKE_SOURCE_DIR@/Palettes/Linrad.pal</file>
|
|
||||||
<file alias="Palettes/Negative.pal">@CMAKE_SOURCE_DIR@/Palettes/Negative.pal</file>
|
|
||||||
<file alias="Palettes/Orange.pal">@CMAKE_SOURCE_DIR@/Palettes/Orange.pal</file>
|
|
||||||
<file alias="Palettes/Pink.pal">@CMAKE_SOURCE_DIR@/Palettes/Pink.pal</file>
|
|
||||||
<file alias="Palettes/Rainbow.pal">@CMAKE_SOURCE_DIR@/Palettes/Rainbow.pal</file>
|
|
||||||
<file alias="Palettes/Scope.pal">@CMAKE_SOURCE_DIR@/Palettes/Scope.pal</file>
|
|
||||||
<file alias="Palettes/Sunburst.pal">@CMAKE_SOURCE_DIR@/Palettes/Sunburst.pal</file>
|
|
||||||
<file alias="Palettes/VK4BDJ.pal">@CMAKE_SOURCE_DIR@/Palettes/VK4BDJ.pal</file>
|
|
||||||
<file alias="Palettes/YL2KF.pal">@CMAKE_SOURCE_DIR@/Palettes/YL2KF.pal</file>
|
|
||||||
<file alias="Palettes/Yellow1.pal">@CMAKE_SOURCE_DIR@/Palettes/Yellow1.pal</file>
|
|
||||||
<file alias="Palettes/Yellow2.pal">@CMAKE_SOURCE_DIR@/Palettes/Yellow2.pal</file>
|
|
||||||
<file alias="Palettes/ZL1FZ.pal">@CMAKE_SOURCE_DIR@/Palettes/ZL1FZ.pal</file>
|
|
||||||
@SAMPLE_PATHS@
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
</RCC>
|
||||||
|
Loading…
Reference in New Issue
Block a user