From b39546fe81c583c95c5f28ed1a6105f14927c9f0 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut@gmail.com" Date: Tue, 14 Dec 2010 21:44:12 +0000 Subject: [PATCH] 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 --- CMakeLists.txt | 26 -------------------------- cmake/Pcsx2Utils.cmake | 25 ------------------------- pcsx2/CMakeLists.txt | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 34 insertions(+), 53 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d5540dee45..482ab2e0ef 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) -#------------------------------------------------------------------------------- - diff --git a/cmake/Pcsx2Utils.cmake b/cmake/Pcsx2Utils.cmake index 38097cea46..28223536dd 100644 --- a/cmake/Pcsx2Utils.cmake +++ b/cmake/Pcsx2Utils.cmake @@ -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 #------------------------------------------------------------------------------- diff --git a/pcsx2/CMakeLists.txt b/pcsx2/CMakeLists.txt index dd636f6de1..a4cc5f4124 100644 --- a/pcsx2/CMakeLists.txt +++ b/pcsx2/CMakeLists.txt @@ -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)