CMake: don't make DolphinWX link to dl

This commit is contained in:
Michael Maltese 2017-04-24 14:57:11 -07:00
parent c214c29b01
commit bd4ffb680c

View File

@ -89,11 +89,6 @@ set(LIBS
wxWidgets::wxWidgets wxWidgets::wxWidgets
) )
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
list(APPEND LIBS dl)
endif()
if(APPLE) if(APPLE)
# Add resource files to application bundle. # Add resource files to application bundle.
set(RESOURCES resources/Dolphin.icns) set(RESOURCES resources/Dolphin.icns)
@ -123,71 +118,71 @@ target_link_libraries(${DOLPHIN_EXE} ${LIBS})
# Handle localization # Handle localization
find_package(Gettext) find_package(Gettext)
if(GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE) 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_EXE} 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})
foreach(po ${LINGUAS}) foreach(po ${LINGUAS})
get_filename_component(lang ${po} NAME_WE) get_filename_component(lang ${po} NAME_WE)
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_EXE} 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")
set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj") set_source_files_properties(${mo} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources/${lang}.lproj")
else() else()
install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES) install(FILES ${mo} DESTINATION share/locale/${lang}/LC_MESSAGES)
endif() endif()
add_custom_command(OUTPUT ${mo} add_custom_command(OUTPUT ${mo}
COMMAND mkdir -p ${mo_dir} COMMAND mkdir -p ${mo_dir}
COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file} COMMAND ${GETTEXT_MSGMERGE_EXECUTABLE} --quiet --update --backup=none -s ${po} ${pot_file}
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po} COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo} ${po}
DEPENDS ${po} DEPENDS ${po}
) )
endforeach() endforeach()
endif() endif()
if(APPLE) if(APPLE)
set(BUNDLE_PATH ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DOLPHIN_EXE}.app) 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_EXE} 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
) )
# 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_EXE} 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}")
source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}") source_group("Resources" FILES "${CMAKE_SOURCE_DIR}/Data/${res}")
endforeach() endforeach()
# 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_EXE})
# Install bundle into systemwide /Applications directory. # Install bundle into systemwide /Applications directory.
install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications) install(TARGETS ${DOLPHIN_EXE} DESTINATION /Applications)
elseif(WIN32) elseif(WIN32)
set_target_properties(${DOLPHIN_EXE} PROPERTIES set_target_properties(${DOLPHIN_EXE} PROPERTIES
WIN32_EXECUTABLE ON WIN32_EXECUTABLE ON
) )
add_custom_command(TARGET ${DOLPHIN_EXE} add_custom_command(TARGET ${DOLPHIN_EXE}
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_EXE}>/Sys
) )
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}) set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} ${DOLPHIN_EXE})