CMakeLists.txt 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. # /W3 - Level 3 warnings
  16. # /MP - Multi-threaded compilation
  17. # /Zi - Output debugging information
  18. # /Zo - enhanced debug info for optimized builds
  19. # /permissive- - enables stricter C++ standards conformance checks
  20. # /EHsc - C++-only exception handling semantics
  21. # /Zc:throwingNew - let codegen assume `operator new` will never return null
  22. # /Zc:inline - let codegen omit inline functions in object files
  23. add_compile_options(/W3 /MP /Zi /Zo /permissive- /EHsc /std:c++latest /Zc:throwingNew,inline)
  24. # /GS- - No stack buffer overflow checks
  25. add_compile_options("$<$<CONFIG:Release>:/GS->")
  26. set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)
  27. set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
  28. else()
  29. add_compile_options("-Wno-attributes")
  30. if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
  31. add_compile_options("-stdlib=libc++")
  32. endif()
  33. # Set file offset size to 64 bits.
  34. #
  35. # On modern Unixes, this is typically already the case. The lone exception is
  36. # glibc, which may default to 32 bits. glibc allows this to be configured
  37. # by setting _FILE_OFFSET_BITS.
  38. if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
  39. add_definitions(-D_FILE_OFFSET_BITS=64)
  40. endif()
  41. if (MINGW)
  42. add_definitions(-DMINGW_HAS_SECURE_API)
  43. if (MINGW_STATIC_BUILD)
  44. add_definitions(-DQT_STATICPLUGIN)
  45. add_compile_options("-static")
  46. endif()
  47. endif()
  48. endif()
  49. add_subdirectory(common)
  50. add_subdirectory(core)
  51. add_subdirectory(audio_core)
  52. add_subdirectory(video_core)
  53. add_subdirectory(input_common)
  54. add_subdirectory(tests)
  55. if (ENABLE_SDL2)
  56. add_subdirectory(yuzu_cmd)
  57. endif()
  58. if (ENABLE_QT)
  59. add_subdirectory(yuzu)
  60. endif()
  61. if (ENABLE_WEB_SERVICE)
  62. add_subdirectory(web_service)
  63. endif()