CMakeLists.txt 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. # Enable modules to include each other's files
  2. include_directories(.)
  3. # CMake seems to only define _DEBUG on Windows
  4. set_property(DIRECTORY APPEND PROPERTY
  5. COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
  6. # Set compilation flags
  7. if (MSVC)
  8. set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
  9. # Silence "deprecation" warnings
  10. add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
  11. # Avoid windows.h junk
  12. add_definitions(-DNOMINMAX)
  13. # Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors.
  14. add_definitions(-DWIN32_LEAN_AND_MEAN)
  15. # Ensure that projects build with Unicode support.
  16. add_definitions(-DUNICODE -D_UNICODE)
  17. # /W3 - Level 3 warnings
  18. # /MP - Multi-threaded compilation
  19. # /Zi - Output debugging information
  20. # /Zo - Enhanced debug info for optimized builds
  21. # /permissive- - Enables stricter C++ standards conformance checks
  22. # /EHsc - C++-only exception handling semantics
  23. # /Zc:externConstexpr - Allow extern constexpr variables to have external linkage, like the standard mandates
  24. # /Zc:inline - Let codegen omit inline functions in object files
  25. # /Zc:throwingNew - Let codegen assume `operator new` (without std::nothrow) will never return null
  26. add_compile_options(
  27. /W3
  28. /MP
  29. /Zi
  30. /Zo
  31. /permissive-
  32. /EHsc
  33. /std:c++latest
  34. /Zc:externConstexpr
  35. /Zc:inline
  36. /Zc:throwingNew
  37. )
  38. # /GS- - No stack buffer overflow checks
  39. add_compile_options("$<$<CONFIG:Release>:/GS->")
  40. set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)
  41. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
  42. else()
  43. add_compile_options("-Wno-attributes")
  44. if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
  45. add_compile_options("-stdlib=libc++")
  46. endif()
  47. # Set file offset size to 64 bits.
  48. #
  49. # On modern Unixes, this is typically already the case. The lone exception is
  50. # glibc, which may default to 32 bits. glibc allows this to be configured
  51. # by setting _FILE_OFFSET_BITS.
  52. if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
  53. add_definitions(-D_FILE_OFFSET_BITS=64)
  54. endif()
  55. if (MINGW)
  56. add_definitions(-DMINGW_HAS_SECURE_API)
  57. if (MINGW_STATIC_BUILD)
  58. add_definitions(-DQT_STATICPLUGIN)
  59. add_compile_options("-static")
  60. endif()
  61. endif()
  62. endif()
  63. add_subdirectory(common)
  64. add_subdirectory(core)
  65. add_subdirectory(audio_core)
  66. add_subdirectory(video_core)
  67. add_subdirectory(input_common)
  68. add_subdirectory(tests)
  69. if (ENABLE_SDL2)
  70. add_subdirectory(yuzu_cmd)
  71. endif()
  72. if (ENABLE_QT)
  73. add_subdirectory(yuzu)
  74. endif()
  75. if (ENABLE_WEB_SERVICE)
  76. add_subdirectory(web_service)
  77. endif()