Commit | Line | Data |
---|---|---|
72b9787e | 1 | # vim: syntax=cmake |
72b9787e | 2 | |
b53f7c52 JB |
3 | if(ENABLE_ASSEMBLY) |
4 | set_source_files_properties(primitives.cpp PROPERTIES COMPILE_FLAGS -DENABLE_ASSEMBLY=1) | |
5 | ||
6 | set(SSE3 vec/dct-sse3.cpp) | |
7 | set(SSSE3 vec/dct-ssse3.cpp) | |
8 | set(SSE41 vec/dct-sse41.cpp) | |
9 | ||
10 | if(MSVC AND X86) | |
72b9787e | 11 | set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41}) |
b53f7c52 JB |
12 | set(WARNDISABLE "/wd4100") # unreferenced formal parameter |
13 | if(INTEL_CXX) | |
14 | add_definitions(/Qwd111) # statement is unreachable | |
15 | add_definitions(/Qwd128) # loop is unreachable | |
16 | add_definitions(/Qwd177) # declared function is unused | |
17 | add_definitions(/Qwd185) # dynamic initialization in unreachable code | |
18 | add_definitions(/Qwd280) # conditional expression is constant | |
19 | endif() | |
20 | if(X64) | |
21 | set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE}") | |
22 | else() | |
23 | # x64 implies SSE4, so only add /arch:SSE2 if building for Win32 | |
24 | set_source_files_properties(${SSE3} ${SSSE3} ${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} /arch:SSE2") | |
25 | endif() | |
26 | endif() | |
27 | if(GCC AND X86) | |
28 | if(CLANG) | |
29 | # llvm intrinsic headers cause shadow warnings | |
30 | set(WARNDISABLE "-Wno-shadow -Wno-unused-parameter") | |
31 | else() | |
32 | set(WARNDISABLE "-Wno-unused-parameter") | |
33 | endif() | |
34 | if(INTEL_CXX OR CLANG OR (NOT CC_VERSION VERSION_LESS 4.3)) | |
35 | set(PRIMITIVES ${SSE3} ${SSSE3} ${SSE41}) | |
36 | set_source_files_properties(${SSE3} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse3") | |
37 | set_source_files_properties(${SSSE3} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -mssse3") | |
38 | set_source_files_properties(${SSE41} PROPERTIES COMPILE_FLAGS "${WARNDISABLE} -msse4.1") | |
39 | endif() | |
72b9787e | 40 | endif() |
b53f7c52 JB |
41 | set(VEC_PRIMITIVES vec/vec-primitives.cpp ${PRIMITIVES}) |
42 | source_group(Intrinsics FILES ${VEC_PRIMITIVES}) | |
72b9787e | 43 | |
72b9787e JB |
44 | set(C_SRCS asm-primitives.cpp pixel.h mc.h ipfilter8.h blockcopy8.h dct8.h loopfilter.h) |
45 | set(A_SRCS pixel-a.asm const-a.asm cpu-a.asm ssd-a.asm mc-a.asm | |
46 | mc-a2.asm pixel-util8.asm blockcopy8.asm | |
47 | pixeladd8.asm dct8.asm) | |
48 | if(HIGH_BIT_DEPTH) | |
49 | set(A_SRCS ${A_SRCS} sad16-a.asm intrapred16.asm ipfilter16.asm) | |
50 | else() | |
51 | set(A_SRCS ${A_SRCS} sad-a.asm intrapred8.asm ipfilter8.asm loopfilter.asm) | |
52 | endif() | |
53 | ||
54 | if(NOT X64) | |
55 | set(A_SRCS ${A_SRCS} pixel-32.asm) | |
56 | endif() | |
57 | ||
58 | if(MSVC_IDE OR XCODE) | |
59 | # MSVC requires custom build rules in the main cmake script for yasm | |
60 | set(MSVC_ASMS "${A_SRCS}" CACHE INTERNAL "yasm sources") | |
61 | set(A_SRCS) | |
62 | endif() | |
63 | ||
64 | enable_language(ASM_YASM) | |
65 | ||
66 | foreach(SRC ${A_SRCS} ${C_SRCS}) | |
67 | set(ASM_PRIMITIVES ${ASM_PRIMITIVES} x86/${SRC}) | |
68 | endforeach() | |
69 | source_group(Assembly FILES ${ASM_PRIMITIVES}) | |
70 | endif(ENABLE_ASSEMBLY) | |
71 | ||
72 | check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R) | |
73 | if(HAVE_STRTOK_R) | |
74 | set_source_files_properties(param.cpp PROPERTIES COMPILE_FLAGS -DHAVE_STRTOK_R=1) | |
75 | endif() | |
76 | ||
77 | if(GCC AND CC_HAS_NO_NARROWING) | |
78 | set_source_files_properties(cpu.cpp PROPERTIES COMPILE_FLAGS -Wno-narrowing) | |
79 | endif() | |
80 | if(WIN32) | |
81 | set(WINXP winxp.h winxp.cpp) | |
82 | endif(WIN32) | |
83 | ||
84 | set_source_files_properties(version.cpp PROPERTIES COMPILE_FLAGS -DX265_VERSION=${X265_VERSION}) | |
85 | ||
86 | add_library(common OBJECT | |
87 | ${ASM_PRIMITIVES} ${VEC_PRIMITIVES} | |
88 | ${LIBCOMMON_SRC} ${LIBCOMMON_HDR} ${WINXP} | |
89 | primitives.cpp primitives.h | |
90 | pixel.cpp dct.cpp ipfilter.cpp intrapred.cpp loopfilter.cpp | |
91 | constants.cpp constants.h | |
92 | cpu.cpp cpu.h version.cpp | |
93 | threading.cpp threading.h | |
94 | threadpool.cpp threadpool.h | |
95 | wavefront.h wavefront.cpp | |
96 | md5.cpp md5.h | |
97 | bitstream.h bitstream.cpp | |
98 | yuv.cpp yuv.h | |
99 | shortyuv.cpp shortyuv.h | |
100 | picyuv.cpp picyuv.h | |
101 | common.cpp common.h | |
102 | param.cpp param.h | |
103 | frame.cpp frame.h | |
104 | framedata.cpp framedata.h | |
105 | cudata.cpp cudata.h | |
106 | slice.cpp slice.h | |
107 | lowres.cpp lowres.h mv.h | |
108 | piclist.cpp piclist.h | |
109 | predict.cpp predict.h | |
110 | scalinglist.cpp scalinglist.h | |
111 | quant.cpp quant.h contexts.h | |
112 | deblock.cpp deblock.h) |