DolphinWX: Allow building both GUI and NoGUI at the same time

Restructure our build system so we have multiple targets. Right now we
only build MainNoGUI if we are using X11, since that's the only truly
supported backend: the OS X code actually doesn't compile, according to
comments made on IRC.
This commit is contained in:
Jasper St. Pierre 2014-08-06 15:32:41 -04:00
parent 2b8a476a05
commit cd641bd0e3

View file

@ -23,62 +23,56 @@ if(LIBAV_FOUND)
set(LIBS ${LIBS} ${LIBAV_LIBRARIES}) set(LIBS ${LIBS} ${LIBAV_LIBRARIES})
endif() endif()
if(wxWidgets_FOUND) set(GUI_SRCS
set(SRCS ARCodeAddEdit.cpp
ARCodeAddEdit.cpp AboutDolphin.cpp
AboutDolphin.cpp CheatsWindow.cpp
CheatsWindow.cpp ConfigMain.cpp
ConfigMain.cpp Debugger/BreakpointDlg.cpp
Debugger/BreakpointDlg.cpp Debugger/BreakpointView.cpp
Debugger/BreakpointView.cpp Debugger/BreakpointWindow.cpp
Debugger/BreakpointWindow.cpp Debugger/CodeView.cpp
Debugger/CodeView.cpp Debugger/CodeWindow.cpp
Debugger/CodeWindow.cpp Debugger/CodeWindowFunctions.cpp
Debugger/CodeWindowFunctions.cpp Debugger/DSPDebugWindow.cpp
Debugger/DSPDebugWindow.cpp Debugger/DSPRegisterView.cpp
Debugger/DSPRegisterView.cpp Debugger/DebuggerPanel.cpp
Debugger/DebuggerPanel.cpp Debugger/DebuggerUIUtil.cpp
Debugger/DebuggerUIUtil.cpp Debugger/JitWindow.cpp
Debugger/JitWindow.cpp Debugger/MemoryCheckDlg.cpp
Debugger/MemoryCheckDlg.cpp Debugger/MemoryView.cpp
Debugger/MemoryView.cpp Debugger/MemoryWindow.cpp
Debugger/MemoryWindow.cpp Debugger/RegisterView.cpp
Debugger/RegisterView.cpp Debugger/RegisterWindow.cpp
Debugger/RegisterWindow.cpp FifoPlayerDlg.cpp
FifoPlayerDlg.cpp Frame.cpp
Frame.cpp FrameAui.cpp
FrameAui.cpp FrameTools.cpp
FrameTools.cpp GameListCtrl.cpp
GameListCtrl.cpp GeckoCodeDiag.cpp
GeckoCodeDiag.cpp HotkeyDlg.cpp
HotkeyDlg.cpp ISOFile.cpp
ISOFile.cpp ISOProperties.cpp
ISOProperties.cpp InputConfigDiag.cpp
InputConfigDiag.cpp InputConfigDiagBitmaps.cpp
InputConfigDiagBitmaps.cpp LogConfigWindow.cpp
LogConfigWindow.cpp LogWindow.cpp
LogWindow.cpp Main.cpp
Main.cpp MemcardManager.cpp
MemcardManager.cpp MemoryCards/WiiSaveCrypted.cpp
MemoryCards/WiiSaveCrypted.cpp NetWindow.cpp
NetWindow.cpp PatchAddEdit.cpp
PatchAddEdit.cpp SoftwareVideoConfigDialog.cpp
SoftwareVideoConfigDialog.cpp TASInputDlg.cpp
TASInputDlg.cpp VideoConfigDiag.cpp
VideoConfigDiag.cpp WXInputBase.cpp
WXInputBase.cpp WiimoteConfigDiag.cpp
WiimoteConfigDiag.cpp WxUtils.cpp)
WxUtils.cpp)
set(WXLIBS ${wxWidgets_LIBRARIES} dl) set(WXLIBS ${wxWidgets_LIBRARIES} dl)
else()
if(ANDROID) set(ANDROID_SRCS Android/ButtonManager.cpp
set(SRCS Android/ButtonManager.cpp MainAndroid.cpp)
MainAndroid.cpp)
else()
set(SRCS MainNoGUI.cpp)
endif()
endif()
if(USE_EGL) if(USE_EGL)
set(SRCS ${SRCS} GLInterface/Platform.cpp set(SRCS ${SRCS} GLInterface/Platform.cpp
@ -102,6 +96,8 @@ else()
endif() endif()
set(SRCS ${SRCS} GLInterface/GLInterface.cpp) set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
set(NOGUI_SRCS MainNoGUI.cpp)
if(WIN32) if(WIN32)
set(SRCS ${SRCS} stdafx.cpp) set(SRCS ${SRCS} stdafx.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@ -140,11 +136,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
else() else()
set(DOLPHIN_EXE_BASE dolphin-emu) set(DOLPHIN_EXE_BASE dolphin-emu)
endif() endif()
if(wxWidgets_FOUND)
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}) set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE})
else()
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}-nogui)
endif()
if(USE_UPNP) if(USE_UPNP)
set(LIBS ${LIBS} miniupnpc) set(LIBS ${LIBS} miniupnpc)
@ -159,7 +152,7 @@ endif()
if(ANDROID) if(ANDROID)
set(DOLPHIN_EXE main) set(DOLPHIN_EXE main)
add_library(${DOLPHIN_EXE} SHARED ${SRCS}) add_library(${DOLPHIN_EXE} SHARED ${SRCS} ${ANDROID_SRCS})
target_link_libraries(${DOLPHIN_EXE} target_link_libraries(${DOLPHIN_EXE}
log log
android android
@ -180,8 +173,10 @@ if(ANDROID)
add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD
COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/Shaders ${CMAKE_SOURCE_DIR}/Source/Android/assets/ COMMAND cp ARGS -r ${CMAKE_SOURCE_DIR}/Data/Sys/Shaders ${CMAKE_SOURCE_DIR}/Source/Android/assets/
) )
else()
add_executable(${DOLPHIN_EXE} ${SRCS}) set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE})
elseif(wxWidgets_FOUND)
add_executable(${DOLPHIN_EXE} ${SRCS} ${GUI_SRCS})
target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS}) target_link_libraries(${DOLPHIN_EXE} ${LIBS} ${WXLIBS})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(BundleUtilities) include(BundleUtilities)
@ -268,6 +263,13 @@ else()
else() else()
install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir})
endif() endif()
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE})
endif() endif()
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) if(USE_X11)
set(DOLPHIN_NOGUI_EXE ${DOLPHIN_EXE_BASE}-nogui)
add_executable(${DOLPHIN_NOGUI_EXE} ${SRCS} ${NOGUI_SRCS})
target_link_libraries(${DOLPHIN_NOGUI_EXE} ${LIBS})
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_NOGUI_EXE})
endif()