CMakeLists.txt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. cmake_minimum_required(VERSION 3.7)
  2. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
  3. list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
  4. include(DownloadExternals)
  5. include(CMakeDependentOption)
  6. project(yuzu)
  7. # Set bundled sdl2/qt as dependent options.
  8. # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON
  9. option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
  10. CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
  11. option(ENABLE_QT "Enable the Qt frontend" ON)
  12. CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF)
  13. option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON)
  14. option(YUZU_USE_BUNDLED_UNICORN "Build/Download bundled Unicorn" ON)
  15. option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
  16. option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
  17. option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence" OFF)
  18. if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit)
  19. message(STATUS "Copying pre-commit hook")
  20. file(COPY hooks/pre-commit
  21. DESTINATION ${PROJECT_SOURCE_DIR}/.git/hooks)
  22. endif()
  23. # Sanity check : Check that all submodules are present
  24. # =======================================================================
  25. function(check_submodules_present)
  26. file(READ "${PROJECT_SOURCE_DIR}/.gitmodules" gitmodules)
  27. string(REGEX MATCHALL "path *= *[^ \t\r\n]*" gitmodules ${gitmodules})
  28. foreach(module ${gitmodules})
  29. string(REGEX REPLACE "path *= *" "" module ${module})
  30. if (NOT EXISTS "${PROJECT_SOURCE_DIR}/${module}/.git")
  31. message(FATAL_ERROR "Git submodule ${module} not found. "
  32. "Please run: git submodule update --init --recursive")
  33. endif()
  34. endforeach()
  35. endfunction()
  36. check_submodules_present()
  37. configure_file(${PROJECT_SOURCE_DIR}/dist/compatibility_list/compatibility_list.qrc
  38. ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.qrc
  39. COPYONLY)
  40. if (ENABLE_COMPATIBILITY_LIST_DOWNLOAD AND NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
  41. message(STATUS "Downloading compatibility list for yuzu...")
  42. file(DOWNLOAD
  43. https://api.yuzu-emu.org/gamedb/
  44. "${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json" SHOW_PROGRESS)
  45. endif()
  46. if (NOT EXISTS ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json)
  47. file(WRITE ${PROJECT_BINARY_DIR}/dist/compatibility_list/compatibility_list.json "")
  48. endif()
  49. # Detect current compilation architecture and create standard definitions
  50. # =======================================================================
  51. include(CheckSymbolExists)
  52. function(detect_architecture symbol arch)
  53. if (NOT DEFINED ARCHITECTURE)
  54. set(CMAKE_REQUIRED_QUIET 1)
  55. check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
  56. unset(CMAKE_REQUIRED_QUIET)
  57. # The output variable needs to be unique across invocations otherwise
  58. # CMake's crazy scope rules will keep it defined
  59. if (ARCHITECTURE_${arch})
  60. set(ARCHITECTURE "${arch}" PARENT_SCOPE)
  61. set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
  62. add_definitions(-DARCHITECTURE_${arch}=1)
  63. endif()
  64. endif()
  65. endfunction()
  66. if (NOT ENABLE_GENERIC)
  67. if (MSVC)
  68. detect_architecture("_M_AMD64" x86_64)
  69. detect_architecture("_M_IX86" x86)
  70. detect_architecture("_M_ARM" ARM)
  71. detect_architecture("_M_ARM64" ARM64)
  72. else()
  73. detect_architecture("__x86_64__" x86_64)
  74. detect_architecture("__i386__" x86)
  75. detect_architecture("__arm__" ARM)
  76. detect_architecture("__aarch64__" ARM64)
  77. endif()
  78. endif()
  79. if (NOT DEFINED ARCHITECTURE)
  80. set(ARCHITECTURE "GENERIC")
  81. set(ARCHITECTURE_GENERIC 1)
  82. add_definitions(-DARCHITECTURE_GENERIC=1)
  83. endif()
  84. message(STATUS "Target architecture: ${ARCHITECTURE}")
  85. # Configure compilation flags
  86. # ===========================
  87. set(CMAKE_CXX_STANDARD 17)
  88. set(CMAKE_CXX_STANDARD_REQUIRED ON)
  89. if (NOT MSVC)
  90. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
  91. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
  92. if (MINGW)
  93. add_definitions(-DMINGW_HAS_SECURE_API)
  94. if (MINGW_STATIC_BUILD)
  95. add_definitions(-DQT_STATICPLUGIN)
  96. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
  97. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
  98. endif()
  99. endif()
  100. else()
  101. # Silence "deprecation" warnings
  102. add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS)
  103. # Avoid windows.h junk
  104. add_definitions(/DNOMINMAX)
  105. # Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors.
  106. add_definitions(/DWIN32_LEAN_AND_MEAN)
  107. set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
  108. # Tweak optimization settings
  109. # As far as I can tell, there's no way to override the CMake defaults while leaving user
  110. # changes intact, so we'll just clobber everything and say sorry.
  111. message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.")
  112. # /W3 - Level 3 warnings
  113. # /MP - Multi-threaded compilation
  114. # /Zi - Output debugging information
  115. # /Zo - enhanced debug info for optimized builds
  116. # /permissive- - enables stricter C++ standards conformance checks
  117. set(CMAKE_C_FLAGS "/W3 /MP /Zi /Zo /permissive-" CACHE STRING "" FORCE)
  118. # /EHsc - C++-only exception handling semantics
  119. # /Zc:throwingNew - let codegen assume `operator new` will never return null
  120. # /Zc:inline - let codegen omit inline functions in object files
  121. set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} /EHsc /std:c++latest /Zc:throwingNew,inline" CACHE STRING "" FORCE)
  122. # /MDd - Multi-threaded Debug Runtime DLL
  123. set(CMAKE_C_FLAGS_DEBUG "/Od /MDd" CACHE STRING "" FORCE)
  124. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "" FORCE)
  125. # /O2 - Optimization level 2
  126. # /GS- - No stack buffer overflow checks
  127. # /MD - Multi-threaded runtime DLL
  128. set(CMAKE_C_FLAGS_RELEASE "/O2 /GS- /MD" CACHE STRING "" FORCE)
  129. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
  130. set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)
  131. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
  132. endif()
  133. # Fix GCC C++17 and Boost.ICL incompatibility (needed to build dynarmic)
  134. # See https://bugzilla.redhat.com/show_bug.cgi?id=1485641#c1
  135. if (CMAKE_COMPILER_IS_GNUCC)
  136. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-new-ttp-matching")
  137. endif()
  138. # Set file offset size to 64 bits.
  139. #
  140. # On modern Unixes, this is typically already the case. The lone exception is
  141. # glibc, which may default to 32 bits. glibc allows this to be configured
  142. # by setting _FILE_OFFSET_BITS.
  143. if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
  144. add_definitions(-D_FILE_OFFSET_BITS=64)
  145. endif()
  146. # CMake seems to only define _DEBUG on Windows
  147. set_property(DIRECTORY APPEND PROPERTY
  148. COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
  149. # System imported libraries
  150. # ======================
  151. find_package(Boost 1.63.0 QUIET)
  152. if (NOT Boost_FOUND)
  153. message(STATUS "Boost 1.63.0 or newer not found, falling back to externals")
  154. set(BOOST_ROOT "${PROJECT_SOURCE_DIR}/externals/boost")
  155. set(Boost_NO_SYSTEM_PATHS OFF)
  156. find_package(Boost QUIET REQUIRED)
  157. endif()
  158. # Output binaries to bin/
  159. set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
  160. # Prefer the -pthread flag on Linux.
  161. set(THREADS_PREFER_PTHREAD_FLAG ON)
  162. find_package(Threads REQUIRED)
  163. if (ENABLE_SDL2)
  164. if (YUZU_USE_BUNDLED_SDL2)
  165. # Detect toolchain and platform
  166. if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) AND ARCHITECTURE_x86_64)
  167. set(SDL2_VER "SDL2-2.0.8")
  168. else()
  169. message(FATAL_ERROR "No bundled SDL2 binaries for your toolchain. Disable YUZU_USE_BUNDLED_SDL2 and provide your own.")
  170. endif()
  171. if (DEFINED SDL2_VER)
  172. download_bundled_external("sdl2/" ${SDL2_VER} SDL2_PREFIX)
  173. endif()
  174. set(SDL2_FOUND YES)
  175. set(SDL2_INCLUDE_DIR "${SDL2_PREFIX}/include" CACHE PATH "Path to SDL2 headers")
  176. set(SDL2_LIBRARY "${SDL2_PREFIX}/lib/x64/SDL2.lib" CACHE PATH "Path to SDL2 library")
  177. set(SDL2_DLL_DIR "${SDL2_PREFIX}/lib/x64/" CACHE PATH "Path to SDL2.dll")
  178. else()
  179. find_package(SDL2 REQUIRED)
  180. endif()
  181. if (SDL2_FOUND)
  182. # TODO(yuriks): Make FindSDL2.cmake export an IMPORTED library instead
  183. add_library(SDL2 INTERFACE)
  184. target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
  185. target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
  186. endif()
  187. else()
  188. set(SDL2_FOUND NO)
  189. endif()
  190. # If unicorn isn't found, msvc -> download bundled unicorn; everyone else -> build external
  191. if (YUZU_USE_BUNDLED_UNICORN)
  192. if (MSVC)
  193. message(STATUS "unicorn not found, falling back to bundled")
  194. # Detect toolchain and platform
  195. if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) AND ARCHITECTURE_x86_64)
  196. set(UNICORN_VER "unicorn-yuzu")
  197. else()
  198. message(FATAL_ERROR "No bundled Unicorn binaries for your toolchain. Disable YUZU_USE_BUNDLED_UNICORN and provide your own.")
  199. endif()
  200. if (DEFINED UNICORN_VER)
  201. download_bundled_external("unicorn/" ${UNICORN_VER} UNICORN_PREFIX)
  202. endif()
  203. if (DEFINED UNICORN_VER)
  204. download_bundled_external("unicorn/" ${UNICORN_VER} UNICORN_PREFIX)
  205. endif()
  206. set(UNICORN_FOUND YES)
  207. set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE)
  208. set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/lib/x64/unicorn_dynload.lib" CACHE PATH "Path to Unicorn library" FORCE)
  209. set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/lib/x64/" CACHE PATH "Path to unicorn.dll" FORCE)
  210. else()
  211. message(STATUS "unicorn not found, falling back to externals")
  212. if (MINGW)
  213. set(UNICORN_LIB_NAME "unicorn.a")
  214. else()
  215. set(UNICORN_LIB_NAME "libunicorn.a")
  216. endif()
  217. set(UNICORN_FOUND YES)
  218. set(UNICORN_PREFIX ${PROJECT_SOURCE_DIR}/externals/unicorn)
  219. set(LIBUNICORN_LIBRARY "${UNICORN_PREFIX}/${UNICORN_LIB_NAME}" CACHE PATH "Path to Unicorn library" FORCE)
  220. set(LIBUNICORN_INCLUDE_DIR "${UNICORN_PREFIX}/include" CACHE PATH "Path to Unicorn headers" FORCE)
  221. set(UNICORN_DLL_DIR "${UNICORN_PREFIX}/" CACHE PATH "Path to unicorn dynamic library" FORCE)
  222. find_package(PythonInterp 2.7 REQUIRED)
  223. if (MINGW)
  224. add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
  225. COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh cross-win64
  226. WORKING_DIRECTORY ${UNICORN_PREFIX}
  227. )
  228. else()
  229. add_custom_command(OUTPUT ${LIBUNICORN_LIBRARY}
  230. COMMAND ${CMAKE_COMMAND} -E env UNICORN_ARCHS="aarch64" PYTHON="${PYTHON_EXECUTABLE}" /bin/sh make.sh macos-universal-no
  231. WORKING_DIRECTORY ${UNICORN_PREFIX}
  232. )
  233. endif()
  234. # ALL makes this custom target build every time
  235. # but it won't actually build if LIBUNICORN_LIBRARY is up to date
  236. add_custom_target(unicorn-build ALL
  237. DEPENDS ${LIBUNICORN_LIBRARY}
  238. )
  239. unset(UNICORN_LIB_NAME)
  240. endif()
  241. else()
  242. find_package(Unicorn REQUIRED)
  243. endif()
  244. if (UNICORN_FOUND)
  245. add_library(unicorn INTERFACE)
  246. add_dependencies(unicorn unicorn-build)
  247. target_link_libraries(unicorn INTERFACE "${LIBUNICORN_LIBRARY}")
  248. target_include_directories(unicorn INTERFACE "${LIBUNICORN_INCLUDE_DIR}")
  249. else()
  250. message(FATAL_ERROR "Could not find or build unicorn which is required.")
  251. endif()
  252. if (ENABLE_QT)
  253. if (YUZU_USE_BUNDLED_QT)
  254. if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1920) AND ARCHITECTURE_x86_64)
  255. set(QT_VER qt-5.12.0-msvc2017_64)
  256. else()
  257. message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
  258. endif()
  259. if (DEFINED QT_VER)
  260. download_bundled_external("qt/" ${QT_VER} QT_PREFIX)
  261. endif()
  262. set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
  263. else()
  264. # Passing an empty HINTS seems to cause default system paths to get ignored in CMake 2.8 so
  265. # make sure to not pass anything if we don't have one.
  266. set(QT_PREFIX_HINT)
  267. endif()
  268. find_package(Qt5 REQUIRED COMPONENTS Widgets OpenGL ${QT_PREFIX_HINT})
  269. if (YUZU_USE_QT_WEB_ENGINE)
  270. find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets ${QT_PREFIX_HINT})
  271. endif ()
  272. endif()
  273. # Platform-specific library requirements
  274. # ======================================
  275. IF (APPLE)
  276. find_library(COCOA_LIBRARY Cocoa) # Umbrella framework for everything GUI-related
  277. set(PLATFORM_LIBRARIES ${COCOA_LIBRARY} ${IOKIT_LIBRARY} ${COREVIDEO_LIBRARY})
  278. if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
  279. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
  280. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
  281. endif()
  282. ELSEIF (WIN32)
  283. # WSAPoll and SHGetKnownFolderPath (AppData/Roaming) didn't exist before WinNT 6.x (Vista)
  284. add_definitions(-D_WIN32_WINNT=0x0600 -DWINVER=0x0600)
  285. set(PLATFORM_LIBRARIES winmm ws2_32)
  286. IF (MINGW)
  287. # PSAPI is the Process Status API
  288. set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} psapi imm32 version)
  289. ENDIF (MINGW)
  290. ELSEIF (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU|SunOS)$")
  291. set(PLATFORM_LIBRARIES rt)
  292. ENDIF (APPLE)
  293. # Setup a custom clang-format target (if clang-format can be found) that will run
  294. # against all the src files. This should be used before making a pull request.
  295. # =======================================================================
  296. set(CLANG_FORMAT_POSTFIX "-6.0")
  297. find_program(CLANG_FORMAT
  298. NAMES clang-format${CLANG_FORMAT_POSTFIX}
  299. clang-format
  300. PATHS ${PROJECT_BINARY_DIR}/externals)
  301. # if find_program doesn't find it, try to download from externals
  302. if (NOT CLANG_FORMAT)
  303. if (WIN32)
  304. message(STATUS "Clang format not found! Downloading...")
  305. set(CLANG_FORMAT "${PROJECT_BINARY_DIR}/externals/clang-format${CLANG_FORMAT_POSTFIX}.exe")
  306. file(DOWNLOAD
  307. https://github.com/yuzu-emu/ext-windows-bin/raw/master/clang-format${CLANG_FORMAT_POSTFIX}.exe
  308. "${CLANG_FORMAT}" SHOW_PROGRESS
  309. STATUS DOWNLOAD_SUCCESS)
  310. if (NOT DOWNLOAD_SUCCESS EQUAL 0)
  311. message(WARNING "Could not download clang format! Disabling the clang format target")
  312. file(REMOVE ${CLANG_FORMAT})
  313. unset(CLANG_FORMAT)
  314. endif()
  315. else()
  316. message(WARNING "Clang format not found! Disabling the clang format target")
  317. endif()
  318. endif()
  319. if (CLANG_FORMAT)
  320. set(SRCS ${PROJECT_SOURCE_DIR}/src)
  321. set(CCOMMENT "Running clang format against all the .h and .cpp files in src/")
  322. if (WIN32)
  323. add_custom_target(clang-format
  324. COMMAND powershell.exe -Command "Get-ChildItem ${SRCS}/* -Include *.cpp,*.h -Recurse | Foreach {${CLANG_FORMAT} -i $_.fullname}"
  325. COMMENT ${CCOMMENT})
  326. elseif(MINGW)
  327. add_custom_target(clang-format
  328. COMMAND find `cygpath -u ${SRCS}` -iname *.h -o -iname *.cpp | xargs `cygpath -u ${CLANG_FORMAT}` -i
  329. COMMENT ${CCOMMENT})
  330. else()
  331. add_custom_target(clang-format
  332. COMMAND find ${SRCS} -iname *.h -o -iname *.cpp | xargs ${CLANG_FORMAT} -i
  333. COMMENT ${CCOMMENT})
  334. endif()
  335. unset(SRCS)
  336. unset(CCOMMENT)
  337. endif()
  338. # Include source code
  339. # ===================
  340. # This function should be passed a list of all files in a target. It will automatically generate
  341. # file groups following the directory hierarchy, so that the layout of the files in IDEs matches the
  342. # one in the filesystem.
  343. function(create_target_directory_groups target_name)
  344. # Place any files that aren't in the source list in a separate group so that they don't get in
  345. # the way.
  346. source_group("Other Files" REGULAR_EXPRESSION ".")
  347. get_target_property(target_sources "${target_name}" SOURCES)
  348. foreach(file_name IN LISTS target_sources)
  349. get_filename_component(dir_name "${file_name}" PATH)
  350. # Group names use '\' as a separator even though the entire rest of CMake uses '/'...
  351. string(REPLACE "/" "\\" group_name "${dir_name}")
  352. source_group("${group_name}" FILES "${file_name}")
  353. endforeach()
  354. endfunction()
  355. # Gets a UTC timstamp and sets the provided variable to it
  356. function(get_timestamp _var)
  357. string(TIMESTAMP timestamp UTC)
  358. set(${_var} "${timestamp}" PARENT_SCOPE)
  359. endfunction()
  360. # generate git/build information
  361. include(GetGitRevisionDescription)
  362. get_git_head_revision(GIT_REF_SPEC GIT_REV)
  363. git_describe(GIT_DESC --always --long --dirty)
  364. git_branch_name(GIT_BRANCH)
  365. get_timestamp(BUILD_DATE)
  366. enable_testing()
  367. add_subdirectory(externals)
  368. add_subdirectory(src)
  369. # Set yuzu project or yuzu-cmd project as default StartUp Project in Visual Studio depending on whether QT is enabled or not
  370. if(ENABLE_QT)
  371. set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT yuzu)
  372. else()
  373. set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT yuzu-cmd)
  374. endif()
  375. # Installation instructions
  376. # =========================
  377. # Install freedesktop.org metadata files, following those specifications:
  378. # http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
  379. # http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
  380. # http://standards.freedesktop.org/shared-mime-info-spec/shared-mime-info-spec-latest.html
  381. if(ENABLE_QT AND UNIX AND NOT APPLE)
  382. install(FILES "${PROJECT_SOURCE_DIR}/dist/yuzu.desktop"
  383. DESTINATION "${CMAKE_INSTALL_PREFIX}/share/applications")
  384. install(FILES "${PROJECT_SOURCE_DIR}/dist/yuzu.svg"
  385. DESTINATION "${CMAKE_INSTALL_PREFIX}/share/icons/hicolor/scalable/apps")
  386. install(FILES "${PROJECT_SOURCE_DIR}/dist/yuzu.xml"
  387. DESTINATION "${CMAKE_INSTALL_PREFIX}/share/mime/packages")
  388. endif()