summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index f69d00a2b..be797d0aa 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,18 +1,87 @@
1# Enable modules to include each other's files 1# Enable modules to include each other's files
2include_directories(.) 2include_directories(.)
3 3
4# CMake seems to only define _DEBUG on Windows
5set_property(DIRECTORY APPEND PROPERTY
6 COMPILE_DEFINITIONS $<$<CONFIG:Debug>:_DEBUG> $<$<NOT:$<CONFIG:Debug>>:NDEBUG>)
7
8# Set compilation flags
9if (MSVC)
10 # Silence "deprecation" warnings
11 add_definitions(/D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D_SCL_SECURE_NO_WARNINGS)
12 # Avoid windows.h junk
13 add_definitions(/DNOMINMAX)
14 # Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors.
15 add_definitions(/DWIN32_LEAN_AND_MEAN)
16
17 set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE STRING "" FORCE)
18
19 # Tweak optimization settings
20 # As far as I can tell, there's no way to override the CMake defaults while leaving user
21 # changes intact, so we'll just clobber everything and say sorry.
22 message(STATUS "Cache compiler flags ignored, please edit CMakeLists.txt to change the flags.")
23
24 # /W3 - Level 3 warnings
25 # /MP - Multi-threaded compilation
26 # /Zi - Output debugging information
27 # /Zo - enhanced debug info for optimized builds
28 # /permissive- - enables stricter C++ standards conformance checks
29 # /EHsc - C++-only exception handling semantics
30 # /Zc:throwingNew - let codegen assume `operator new` will never return null
31 # /Zc:inline - let codegen omit inline functions in object files
32 set(CMAKE_CXX_FLAGS "/W3 /MP /Zi /Zo /permissive- /EHsc /std:c++latest /Zc:throwingNew,inline" CACHE STRING "" FORCE)
33
34 # /O2 - Optimization level 2
35 # /GS- - No stack buffer overflow checks
36 # /MD - Multi-threaded runtime DLL
37 set(CMAKE_C_FLAGS_RELEASE "/O2 /GS- /MD" CACHE STRING "" FORCE)
38 set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "" FORCE)
39
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)
42else()
43 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-attributes")
44
45 if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
46 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
47 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")
48 endif()
49
50 # Set file offset size to 64 bits.
51 #
52 # On modern Unixes, this is typically already the case. The lone exception is
53 # glibc, which may default to 32 bits. glibc allows this to be configured
54 # by setting _FILE_OFFSET_BITS.
55 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
56 add_definitions(-D_FILE_OFFSET_BITS=64)
57 endif()
58
59 if (MINGW)
60 add_definitions(-DMINGW_HAS_SECURE_API)
61
62 if (MINGW_STATIC_BUILD)
63 add_definitions(-DQT_STATICPLUGIN)
64 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
65 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
66 endif()
67 endif()
68endif()
69
4add_subdirectory(common) 70add_subdirectory(common)
5add_subdirectory(core) 71add_subdirectory(core)
6add_subdirectory(audio_core) 72add_subdirectory(audio_core)
7add_subdirectory(video_core) 73add_subdirectory(video_core)
8add_subdirectory(input_common) 74add_subdirectory(input_common)
9add_subdirectory(tests) 75add_subdirectory(tests)
76
10if (ENABLE_SDL2) 77if (ENABLE_SDL2)
11 add_subdirectory(yuzu_cmd) 78 add_subdirectory(yuzu_cmd)
12endif() 79endif()
80
13if (ENABLE_QT) 81if (ENABLE_QT)
14 add_subdirectory(yuzu) 82 add_subdirectory(yuzu)
15endif() 83endif()
84
16if (ENABLE_WEB_SERVICE) 85if (ENABLE_WEB_SERVICE)
17 add_subdirectory(web_service) 86 add_subdirectory(web_service)
18endif() 87endif()