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