CMake: remove DolphinWX $DOLPHIN_EXE abstraction

This commit is contained in:
Michael Maltese 2017-04-24 15:05:19 -07:00
parent bd4ffb680c
commit b955805b2b

View File

@ -104,16 +104,8 @@ if(WIN32)
) )
endif() endif()
if(APPLE) add_executable(dolphin-emu ${SRCS})
set(DOLPHIN_EXE_BASE Dolphin) target_link_libraries(dolphin-emu ${LIBS})
else()
set(DOLPHIN_EXE_BASE dolphin-emu)
endif()
set(DOLPHIN_EXE ${DOLPHIN_EXE_BASE})
add_executable(${DOLPHIN_EXE} ${SRCS})
target_link_libraries(${DOLPHIN_EXE} ${LIBS})
# Handle localization # Handle localization
find_package(Gettext) find_package(Gettext)
@ -121,7 +113,7 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot") set(pot_file "${CMAKE_SOURCE_DIR}/Languages/po/dolphin-emu.pot")
file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po) file(GLOB LINGUAS ${CMAKE_SOURCE_DIR}/Languages/po/*.po)
target_sources(${DOLPHIN_EXE} PRIVATE ${pot_file} ${LINGUAS}) target_sources(dolphin-emu PRIVATE ${pot_file} ${LINGUAS})
source_group("Localization" FILES ${LINGUAS}) source_group("Localization" FILES ${LINGUAS})
source_group("Localization\\\\Generated" FILES ${pot_file}) source_group("Localization\\\\Generated" FILES ${pot_file})
@ -130,7 +122,7 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang}) set(mo_dir ${CMAKE_CURRENT_BINARY_DIR}/${lang})
set(mo ${mo_dir}/dolphin-emu.mo) set(mo ${mo_dir}/dolphin-emu.mo)
target_sources(${DOLPHIN_EXE} PRIVATE ${mo}) target_sources(dolphin-emu PRIVATE ${mo})
source_group("Localization\\\\Generated" FILES ${mo}) source_group("Localization\\\\Generated" FILES ${mo})
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
@ -149,19 +141,18 @@ if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE)
endif() endif()
if(APPLE) if(APPLE)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app)
# Ask for an application bundle. # Ask for an application bundle.
set_target_properties(${DOLPHIN_EXE} PROPERTIES set_target_properties(dolphin-emu PROPERTIES
MACOSX_BUNDLE true MACOSX_BUNDLE true
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in
OUTPUT_NAME Dolphin
) )
# Copy resources in the bundle # Copy resources in the bundle
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys") set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/Data/Sys")
file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*") file(GLOB_RECURSE resources RELATIVE "${CMAKE_SOURCE_DIR}/Data" "${CMAKE_SOURCE_DIR}/Data/Sys/*")
foreach(res ${resources}) foreach(res ${resources})
target_sources(${DOLPHIN_EXE} PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}") target_sources(dolphin-emu PRIVATE "${CMAKE_SOURCE_DIR}/Data/${res}")
get_filename_component(resdir "${res}" DIRECTORY) get_filename_component(resdir "${res}" DIRECTORY)
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/${res}" PROPERTIES
MACOSX_PACKAGE_LOCATION "Resources/${resdir}") MACOSX_PACKAGE_LOCATION "Resources/${resdir}")
@ -170,19 +161,19 @@ if(APPLE)
# Update library references to make the bundle portable # Update library references to make the bundle portable
include(DolphinPostprocessBundle) include(DolphinPostprocessBundle)
dolphin_postprocess_bundle(${DOLPHIN_EXE}) dolphin_postprocess_bundle(dolphin-emu)
# Install bundle into systemwide /Applications directory. # Install bundle into systemwide /Applications directory.
install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) install(TARGETS dolphin-emu DESTINATION /Applications)
elseif(WIN32) elseif(WIN32)
set_target_properties(${DOLPHIN_EXE} PROPERTIES set_target_properties(dolphin-emu PROPERTIES
WIN32_EXECUTABLE ON WIN32_EXECUTABLE ON
) )
add_custom_command(TARGET ${DOLPHIN_EXE} add_custom_command(TARGET dolphin-emu
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $<TARGET_FILE_DIR:${DOLPHIN_EXE}>/Sys COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Data/Sys $<TARGET_FILE_DIR:dolphin-emu>/Sys
) )
else() else()
install(TARGETS ${DOLPHIN_EXE} RUNTIME DESTINATION ${bindir}) install(TARGETS dolphin-emu RUNTIME DESTINATION ${bindir})
endif() endif()
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE}) set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} dolphin-emu)