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