cmake: rework the resource stuff. Avoid rebuild and files are clear by cmake.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4095 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut@gmail.com 2010-12-14 21:44:12 +00:00
parent 0f772de2ec
commit b39546fe81
3 changed files with 34 additions and 53 deletions

View File

@ -65,29 +65,3 @@ endif(EXISTS "${PROJECT_SOURCE_DIR}/pcsx2" AND pcsx2_core)
if(EXISTS "${PROJECT_SOURCE_DIR}/plugins")
add_subdirectory(plugins)
endif(EXISTS "${PROJECT_SOURCE_DIR}/plugins")
#-------------------------------------------------------------------------------
# Resources
#-------------------------------------------------------------------------------
# Specify all binary images to convert them into c/c++ header files.
#
#-------------------------------------------------------------------------------
# add resources here
set(resourceList AppIcon16.png
AppIcon32.png
AppIcon64.png
BackgroundLogo.png
ConfigIcon_Appearance.png
ButtonIcon_Camera.png
ConfigIcon_Cpu.png
ConfigIcon_Gamefixes.png
ConfigIcon_MemoryCard.png
ConfigIcon_Paths.png
ConfigIcon_Plugins.png
ConfigIcon_Speedhacks.png
ConfigIcon_Video.png
Dualshock.jpg)
createResourceTarget(${resourceList})
#-------------------------------------------------------------------------------

View File

@ -1,30 +1,5 @@
# additonal cmake macros and functions
#-------------------------------------------------------------------------------
# createResourceTarget
#-------------------------------------------------------------------------------
# This function is used to generate header files, used as resources.
# A list of Resources taken as input parameter.
#-------------------------------------------------------------------------------
function(createResourceTarget)
# working directory
set(workdir ${PROJECT_SOURCE_DIR}/pcsx2/gui/Resources)
# create dummy target depending on bin2cpp
add_custom_target(Resources
DEPENDS bin2cpp)
# create a custom command for every resource file
foreach(entry IN LISTS ARGV)
# create custom command and assign to target Resources
add_custom_command(TARGET Resources POST_BUILD
COMMAND bin2cpp ${entry}
WORKING_DIRECTORY ${workdir})
endforeach(entry)
endfunction(createResourceTarget)
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# detectOperatingSystem
#-------------------------------------------------------------------------------

View File

@ -363,6 +363,24 @@ set(pcsx2GuiHeaders
gui/RecentIsoList.h
)
# Gui resources headers
set(pcsx2GuiResources
gui/Resources/AppIcon16.h
gui/Resources/AppIcon32.h
gui/Resources/AppIcon64.h
gui/Resources/BackgroundLogo.h
gui/Resources/ConfigIcon_Appearance.h
gui/Resources/ButtonIcon_Camera.h
gui/Resources/ConfigIcon_Cpu.h
gui/Resources/ConfigIcon_Gamefixes.h
gui/Resources/ConfigIcon_MemoryCard.h
gui/Resources/ConfigIcon_Paths.h
gui/Resources/ConfigIcon_Plugins.h
gui/Resources/ConfigIcon_Speedhacks.h
gui/Resources/ConfigIcon_Video.h
gui/Resources/Dualshock.h
)
# IPU sources
set(pcsx2IPUSources
IPU/IPU.cpp
@ -568,6 +586,7 @@ set(Common
${pcsx2DebugToolsSources}
${pcsx2DebugToolsSources}
${pcsx2GuiSources}
${pcsx2GuiResources}
${pcsx2GuiHeaders}
${pcsx2IPUSources}
${pcsx2IPUHeaders}
@ -618,8 +637,21 @@ add_executable(${Output}
${Common}
${Platform})
# add dependencies
add_dependencies(${Output} Resources)
# Generate the resources files
add_custom_command(OUTPUT "gui/Resources/AppIcon16.h" COMMAND bin2cpp "gui/Resources/AppIcon16.png")
add_custom_command(OUTPUT "gui/Resources/AppIcon32.h" COMMAND bin2cpp "gui/Resources/AppIcon32.png")
add_custom_command(OUTPUT "gui/Resources/AppIcon64.h" COMMAND bin2cpp "gui/Resources/AppIcon64.png")
add_custom_command(OUTPUT "gui/Resources/BackgroundLogo.h" COMMAND bin2cpp "gui/Resources/BackgroundLogo.png")
add_custom_command(OUTPUT "gui/Resources/ButtonIcon_Camera.h" COMMAND bin2cpp "gui/Resources/ButtonIcon_Camera.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Appearance.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Appearance.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Cpu.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Cpu.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Gamefixes.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Gamefixes.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_MemoryCard.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_MemoryCard.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Paths.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Paths.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Plugins.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Plugins.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Speedhacks.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Speedhacks.png")
add_custom_command(OUTPUT "gui/Resources/ConfigIcon_Video.h" COMMAND bin2cpp "gui/Resources/ConfigIcon_Video.png")
add_custom_command(OUTPUT "gui/Resources/Dualshock.h" COMMAND bin2cpp "gui/Resources/Dualshock.jpg")
# link target with project internal libraries
target_link_libraries(${Output} Utilities x86emitter)