mirror of https://github.com/PCSX2/pcsx2.git
cmake: create the macro add_custom_glib_res to handle resources
This commit is contained in:
parent
ffcac1bc3b
commit
41990a6402
|
@ -139,3 +139,22 @@ macro(add_pcsx2_executable exe srcs libs flags)
|
||||||
install(TARGETS ${exe} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
|
install(TARGETS ${exe} DESTINATION ${CMAKE_SOURCE_DIR}/bin)
|
||||||
endif(PACKAGE_MODE)
|
endif(PACKAGE_MODE)
|
||||||
endmacro(add_pcsx2_executable)
|
endmacro(add_pcsx2_executable)
|
||||||
|
|
||||||
|
# Helper macro to generate resources on linux (based on glib)
|
||||||
|
macro(add_custom_glib_res out xml prefix)
|
||||||
|
set(RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res")
|
||||||
|
set(RESOURCE_FILES "${ARGN}")
|
||||||
|
# Note: trying to combine --generate-source and --generate-header doesn't work.
|
||||||
|
# It outputs whichever one comes last into the file named by the first
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${out}.h
|
||||||
|
COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-header
|
||||||
|
--c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.h
|
||||||
|
DEPENDS res/${xml} ${RESOURCE_FILES})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${out}.cpp
|
||||||
|
COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-source
|
||||||
|
--c-name ${prefix} "${RESOURCE_DIR}/${xml}" --target=${out}.cpp
|
||||||
|
DEPENDS res/${xml} ${RESOURCE_FILES})
|
||||||
|
endmacro()
|
||||||
|
|
|
@ -288,7 +288,6 @@ if(OPENCL_FOUND)
|
||||||
set(GSdxFinalLibs ${GSdxFinalLibs} ${OPENCL_LIBRARIES})
|
set(GSdxFinalLibs ${GSdxFinalLibs} ${OPENCL_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(RESOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/res")
|
|
||||||
set(RESOURCE_FILES
|
set(RESOURCE_FILES
|
||||||
res/logo-ogl.bmp
|
res/logo-ogl.bmp
|
||||||
res/fxaa.fx
|
res/fxaa.fx
|
||||||
|
@ -301,17 +300,7 @@ set(RESOURCE_FILES
|
||||||
res/glsl/tfx_fs.glsl
|
res/glsl/tfx_fs.glsl
|
||||||
res/glsl/tfx_vgs.glsl)
|
res/glsl/tfx_vgs.glsl)
|
||||||
|
|
||||||
# Note: trying to combine --generate-source and --generate-header doesn't work. It outputs whichever one comes last into the file named by the first
|
add_custom_glib_res("GSdxResources" "gsdx-res.xml" "GSdx_res" ${RESOURCE_FILES})
|
||||||
add_custom_command(
|
|
||||||
OUTPUT GSdxResources.h
|
|
||||||
COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-header
|
|
||||||
--c-name GSdx_res "${RESOURCE_DIR}/gsdx-res.xml" --target=GSdxResources.h
|
|
||||||
DEPENDS res/gsdx-res.xml ${RESOURCE_FILES})
|
|
||||||
add_custom_command(
|
|
||||||
OUTPUT GSdxResources.cpp
|
|
||||||
COMMAND glib-compile-resources --sourcedir "${RESOURCE_DIR}" --generate-source
|
|
||||||
--c-name GSdx_res "${RESOURCE_DIR}/gsdx-res.xml" --target=GSdxResources.cpp
|
|
||||||
DEPENDS res/gsdx-res.xml ${RESOURCE_FILES})
|
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue