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,8 +23,7 @@ if(LIBAV_FOUND)
set(LIBS ${LIBS} ${LIBAV_LIBRARIES})
endif()
if(wxWidgets_FOUND)
set(SRCS
set(GUI_SRCS
ARCodeAddEdit.cpp
AboutDolphin.cpp
CheatsWindow.cpp
@ -71,14 +70,9 @@ if(wxWidgets_FOUND)
WxUtils.cpp)
set(WXLIBS ${wxWidgets_LIBRARIES} dl)
else()
if(ANDROID)
set(SRCS Android/ButtonManager.cpp
set(ANDROID_SRCS Android/ButtonManager.cpp
MainAndroid.cpp)
else()
set(SRCS MainNoGUI.cpp)
endif()
endif()
if(USE_EGL)
set(SRCS ${SRCS} GLInterface/Platform.cpp
@ -102,6 +96,8 @@ else()
endif()
set(SRCS ${SRCS} GLInterface/GLInterface.cpp)
set(NOGUI_SRCS MainNoGUI.cpp)
if(WIN32)
set(SRCS ${SRCS} stdafx.cpp)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
@ -140,11 +136,8 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
else()
set(DOLPHIN_EXE_BASE dolphin-emu)
endif()
if(wxWidgets_FOUND)
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE})
else()
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE}-nogui)
endif()
if(USE_UPNP)
set(LIBS ${LIBS} miniupnpc)
@ -159,7 +152,7 @@ endif()
if(ANDROID)
set(DOLPHIN_EXE main)
add_library(${DOLPHIN_EXE} SHARED ${SRCS})
add_library(${DOLPHIN_EXE} SHARED ${SRCS} ${ANDROID_SRCS})
target_link_libraries(${DOLPHIN_EXE}
log
android
@ -180,8 +173,10 @@ if(ANDROID)
add_custom_command(TARGET ${DOLPHIN_EXE} POST_BUILD
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})
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include(BundleUtilities)
@ -268,6 +263,13 @@ else()
else()
install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir})
endif()
endif()
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE})
endif()
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()