cmake: add various option to disable plugin support

This commit is contained in:
Gregory Hainaut 2016-03-30 10:19:54 +02:00
parent f010f9458b
commit 1bd8113f66
8 changed files with 87 additions and 7 deletions

View File

@ -82,6 +82,40 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message(STATUS "Building with Clang/LLVM.")
endif()
#-------------------------------------------------------------------------------
# Select the support of plugin
#-------------------------------------------------------------------------------
option(BUILTIN_GS "Disable support of GS plugin (developer option)")
option(BUILTIN_PAD "Disable support of PAD plugin (developer option)")
option(BUILTIN_SPU2 "Disable support of SPU2 plugin (developer option)")
option(BUILTIN_USB "Disable support of USB plugin (developer option)")
option(BUILTIN_FW "Disable support of FW plugin (developer option)")
option(BUILTIN_DEV9 "Disable support of DEV9 plugin (developer option)")
option(BUILTIN_CDVD "Disable support of CDVD plugin (developer option)")
set(PLUGIN_SUPPORT "")
if(BUILTIN_GS)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_GS_PLUGIN")
endif()
if(BUILTIN_PAD)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_PAD_PLUGIN")
endif()
if(BUILTIN_SPU2)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_SPU2_PLUGIN")
endif()
if(BUILTIN_USB)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_USB_PLUGIN")
endif()
if(BUILTIN_FW)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_FW_PLUGIN")
endif()
if(BUILTIN_DEV)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_DEV_PLUGIN")
endif()
if(BUILTIN_CDVD)
set(PLUGIN_SUPPORT "${PLUGIN_SUPPORT} -DBUILTIN_CDVD_PLUGIN")
endif()
#-------------------------------------------------------------------------------
# Select the architecture
#-------------------------------------------------------------------------------
@ -312,7 +346,7 @@ else()
endif()
# Note: -DGTK_DISABLE_DEPRECATED can be used to test a build without gtk deprecated feature. It could be useful to port to a newer API
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS}")
set(DEFAULT_GCC_FLAG "${ARCH_FLAG} ${COMMON_FLAG} ${DEFAULT_WARNINGS} ${AGGRESSIVE_WARNING} ${HARDENING_FLAG} ${DEBUG_FLAG} ${ASAN_FLAG} ${OPTIMIZATION_FLAG} ${LTO_FLAGS} ${PLUGIN_SUPPORT}")
# c++ only flags
set(DEFAULT_CPP_FLAG "${DEFAULT_GCC_FLAG} -std=c++11 -Wno-invalid-offsetof")

View File

@ -630,6 +630,28 @@ set(pcsx2FinalLibs
${GCOV_LIBRARIES}
)
if(BUILTIN_GS)
set(pcsx2FinalLibs "${pcsx2FinalLibs} GSdx-1.0.0")
endif()
if(BUILTIN_PAD)
set(pcsx2FinalLibs "${pcsx2FinalLibs} onepad-1.2.0")
endif()
if(BUILTIN_SPU2)
set(pcsx2FinalLibs "${pcsx2FinalLibs} spu2x-2.0.0")
endif()
if(BUILTIN_USB)
set(pcsx2FinalLibs "${pcsx2FinalLibs} USBnull-0.7.0")
endif()
if(BUILTIN_FW)
set(pcsx2FinalLibs "${pcsx2FinalLibs} FWnull-0.7.0")
endif()
if(BUILTIN_DEV)
set(pcsx2FinalLibs "${pcsx2FinalLibs} dev9null-0.5.0")
endif()
if(BUILTIN_CDVD)
set(pcsx2FinalLibs "${pcsx2FinalLibs} CDVDnull")
endif()
# additonal include directories
include_directories(
gui

View File

@ -50,4 +50,8 @@ set(FWnullFinalLibs
${GTK2_LIBRARIES}
)
add_pcsx2_plugin(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}")
if(BUILTIN_FW)
add_pcsx2_lib(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${FWnullFinalSources}" "${FWnullFinalLibs}" "${FWnullFinalFlags}")
endif()

View File

@ -211,7 +211,11 @@ if (REBUILD_SHADER)
add_custom_command(OUTPUT res/glsl_source.h COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/glsl2h.pl)
endif()
add_pcsx2_plugin(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
if(BUILTIN_GS)
add_pcsx2_lib(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${GSdxFinalSources}" "${GSdxFinalLibs}" "${GSdxFinalFlags}")
endif()
################################### Replay Loader
if(BUILD_REPLAY_LOADERS)

View File

@ -50,4 +50,8 @@ set(USBnullFinalLibs
${GTK2_LIBRARIES}
)
add_pcsx2_plugin(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}")
if(BUILTIN_USB)
add_pcsx2_lib(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${USBnullFinalSources}" "${USBnullFinalLibs}" "${USBnullFinalFlags}")
endif()

View File

@ -47,4 +47,8 @@ set(dev9nullFinalLibs
${GTK2_LIBRARIES}
)
add_pcsx2_plugin(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}")
if(BUILTIN_DEV9)
add_pcsx2_lib(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${dev9nullFinalSources}" "${dev9nullFinalLibs}" "${dev9nullFinalFlags}")
endif()

View File

@ -126,4 +126,8 @@ foreach(result_file IN ITEMS
COMMAND perl ${CMAKE_SOURCE_DIR}/linux_various/hex2h.pl "${image_sources}/${result_file}.png" "${compiled_images}/${result_file}" )
endforeach()
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
if(BUILTIN_PAD)
add_pcsx2_lib(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${onepadFinalSources}" "${onepadFinalLibs}" "${onepadFinalFlags}")
endif()

View File

@ -114,4 +114,8 @@ else()
)
endif()
add_pcsx2_plugin(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}")
if(BUILTIN_SPU2)
add_pcsx2_lib(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}")
else()
add_pcsx2_plugin(${Output} "${spu2xFinalSources}" "${spu2xFinalLibs}" "${spu2xFinalFlags}")
endif()