annotate source/CMakeLists.txt @ 12578:f27e4c589564

API: New API to reconfigure zones
author Aruna Matheswaran <aruna@multicorewareinc.com>
date Thu, 17 Oct 2019 12:04:07 +0530
parents 354901970679
children 04db2bfee5d6
rev   line source
4430
ec98f30c5185 cmake: enable vim syntax hightlighting
Steve Borho <steve@borho.org>
parents: 4428
diff changeset
1 # vim: syntax=cmake
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
2 if(NOT CMAKE_BUILD_TYPE)
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
3 # default to Release build for GCC builds
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
4 set(CMAKE_BUILD_TYPE Release CACHE STRING
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
5 "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
6 FORCE)
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
7 endif()
5975
bb33ab0f4ef9 cmake: prevent warnings from recent builds of cmake
Steve Borho <steve@borho.org>
parents: 5970
diff changeset
8 message(STATUS "cmake version ${CMAKE_VERSION}")
7976
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
9 if(POLICY CMP0025)
5975
bb33ab0f4ef9 cmake: prevent warnings from recent builds of cmake
Steve Borho <steve@borho.org>
parents: 5970
diff changeset
10 cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
7976
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
11 endif()
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
12 if(POLICY CMP0042)
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
13 cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
5975
bb33ab0f4ef9 cmake: prevent warnings from recent builds of cmake
Steve Borho <steve@borho.org>
parents: 5970
diff changeset
14 endif()
9835
320d843e825a cmake: fix policy CMP0054 warning for cmake version > 3.0
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 9794
diff changeset
15 if(POLICY CMP0054)
320d843e825a cmake: fix policy CMP0054 warning for cmake version > 3.0
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 9794
diff changeset
16 cmake_policy(SET CMP0054 OLD) # Only interpret if() arguments as variables or keywords when unquoted
320d843e825a cmake: fix policy CMP0054 warning for cmake version > 3.0
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 9794
diff changeset
17 endif()
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
18
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
19 project (x265)
4333
5dceef85c58c cmake: bump minimum required version to 2.8.8
Steve Borho <steve@borho.org>
parents: 4332
diff changeset
20 cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
4658
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
21 include(CheckIncludeFiles)
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
22 include(CheckFunctionExists)
6369
3cbde0b893e3 cmake: detect strtok_r, use workaround when not present
Steve Borho <steve@borho.org>
parents: 6319
diff changeset
23 include(CheckSymbolExists)
5364
38719294293f cmake: gcc flag introspection to fix Mac OS X 10.6 build
Steve Borho <steve@borho.org>
parents: 5257
diff changeset
24 include(CheckCXXCompilerFlag)
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
25
9937
65d004d54895 cmake: introduce fprofile options
Steve Borho <steve@borho.org>
parents: 9917
diff changeset
26 option(FPROFILE_GENERATE "Compile executable to generate usage data" OFF)
65d004d54895 cmake: introduce fprofile options
Steve Borho <steve@borho.org>
parents: 9917
diff changeset
27 option(FPROFILE_USE "Compile executable using generated usage data" OFF)
9938
e5495a8cd07c cmake: add option for -march=native
Steve Borho <steve@borho.org>
parents: 9937
diff changeset
28 option(NATIVE_BUILD "Target the build CPU" OFF)
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
29 option(STATIC_LINK_CRT "Statically link C runtime for release builds" OFF)
9938
e5495a8cd07c cmake: add option for -march=native
Steve Borho <steve@borho.org>
parents: 9937
diff changeset
30 mark_as_advanced(FPROFILE_USE FPROFILE_GENERATE NATIVE_BUILD)
4447
abae6903e0af cmake: move X265_BUILD definition to near top of main CMakeLists.txt
Steve Borho <steve@borho.org>
parents: 4445
diff changeset
31 # X265_BUILD must be incremented each time the public API is changed
12578
f27e4c589564 API: New API to reconfigure zones
Aruna Matheswaran <aruna@multicorewareinc.com>
parents: 12567
diff changeset
32 set(X265_BUILD 181)
4447
abae6903e0af cmake: move X265_BUILD definition to near top of main CMakeLists.txt
Steve Borho <steve@borho.org>
parents: 4445
diff changeset
33 configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
abae6903e0af cmake: move X265_BUILD definition to near top of main CMakeLists.txt
Steve Borho <steve@borho.org>
parents: 4445
diff changeset
34 "${PROJECT_BINARY_DIR}/x265.def")
abae6903e0af cmake: move X265_BUILD definition to near top of main CMakeLists.txt
Steve Borho <steve@borho.org>
parents: 4445
diff changeset
35 configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
abae6903e0af cmake: move X265_BUILD definition to near top of main CMakeLists.txt
Steve Borho <steve@borho.org>
parents: 4445
diff changeset
36 "${PROJECT_BINARY_DIR}/x265_config.h")
abae6903e0af cmake: move X265_BUILD definition to near top of main CMakeLists.txt
Steve Borho <steve@borho.org>
parents: 4445
diff changeset
37
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
38 SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
39
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
40 # System architecture detection
5969
9e2b076968e1 cmake: use strlower on CMAKE_SYSTEM_PROCESSOR
Steve Borho <steve@borho.org>
parents: 5968
diff changeset
41 string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
6391
e7d3835fe752 cmake: use x86 alias list rather than repeated string compares (nit)
Steve Borho <steve@borho.org>
parents: 6388
diff changeset
42 set(X86_ALIASES x86 i386 i686 x86_64 amd64)
11296
9f7bdf2071b3 arm: added support for armv7l arch
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11294
diff changeset
43 set(ARM_ALIASES armv6l armv7l)
6391
e7d3835fe752 cmake: use x86 alias list rather than repeated string compares (nit)
Steve Borho <steve@borho.org>
parents: 6388
diff changeset
44 list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
11296
9f7bdf2071b3 arm: added support for armv7l arch
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11294
diff changeset
45 list(FIND ARM_ALIASES "${SYSPROC}" ARMMATCH)
10837
304baf3d1028 Fixed POWER CPU architecture detection
Peter Kovář <peter.kovar@reflexion.tv>
parents: 10836
diff changeset
46 set(POWER_ALIASES ppc64 ppc64le)
304baf3d1028 Fixed POWER CPU architecture detection
Peter Kovář <peter.kovar@reflexion.tv>
parents: 10836
diff changeset
47 list(FIND POWER_ALIASES "${SYSPROC}" POWERMATCH)
6391
e7d3835fe752 cmake: use x86 alias list rather than repeated string compares (nit)
Steve Borho <steve@borho.org>
parents: 6388
diff changeset
48 if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
5955
8769cd7b97ac cmake: attempt to support non-x86 compile targets
Steve Borho <steve@borho.org>
parents: 5954
diff changeset
49 set(X86 1)
8769cd7b97ac cmake: attempt to support non-x86 compile targets
Steve Borho <steve@borho.org>
parents: 5954
diff changeset
50 add_definitions(-DX265_ARCH_X86=1)
11993
22c127ff05d5 Fix 32 bit build error ( using CMAKE GUI) in Linux
Jayashree
parents: 11975
diff changeset
51 if(CMAKE_CXX_FLAGS STREQUAL "-m32")
22c127ff05d5 Fix 32 bit build error ( using CMAKE GUI) in Linux
Jayashree
parents: 11975
diff changeset
52 message(STATUS "Detected x86 target processor")
22c127ff05d5 Fix 32 bit build error ( using CMAKE GUI) in Linux
Jayashree
parents: 11975
diff changeset
53 elseif("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
5955
8769cd7b97ac cmake: attempt to support non-x86 compile targets
Steve Borho <steve@borho.org>
parents: 5954
diff changeset
54 set(X64 1)
8769cd7b97ac cmake: attempt to support non-x86 compile targets
Steve Borho <steve@borho.org>
parents: 5954
diff changeset
55 add_definitions(-DX86_64=1)
11107
6563218ce342 cmake: target processor message corrected (fixes #189)
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 11094
diff changeset
56 message(STATUS "Detected x86_64 target processor")
5955
8769cd7b97ac cmake: attempt to support non-x86 compile targets
Steve Borho <steve@borho.org>
parents: 5954
diff changeset
57 endif()
10837
304baf3d1028 Fixed POWER CPU architecture detection
Peter Kovář <peter.kovar@reflexion.tv>
parents: 10836
diff changeset
58 elseif(POWERMATCH GREATER "-1")
304baf3d1028 Fixed POWER CPU architecture detection
Peter Kovář <peter.kovar@reflexion.tv>
parents: 10836
diff changeset
59 message(STATUS "Detected POWER target processor")
304baf3d1028 Fixed POWER CPU architecture detection
Peter Kovář <peter.kovar@reflexion.tv>
parents: 10836
diff changeset
60 set(POWER 1)
304baf3d1028 Fixed POWER CPU architecture detection
Peter Kovář <peter.kovar@reflexion.tv>
parents: 10836
diff changeset
61 add_definitions(-DX265_ARCH_POWER=1)
11619
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
62 if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
63 set(PPC64 1)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
64 add_definitions(-DPPC64=1)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
65 message(STATUS "Detected POWER PPC64 target processor")
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
66 endif()
11296
9f7bdf2071b3 arm: added support for armv7l arch
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11294
diff changeset
67 elseif(ARMMATCH GREATER "-1")
11249
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
68 if(CROSS_COMPILE_ARM)
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
69 message(STATUS "Cross compiling for ARM arch")
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
70 else()
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
71 set(CROSS_COMPILE_ARM 0)
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
72 endif()
7321
a5024bfc0b50 cmake: nit - about target arch strings
Steve Borho <steve@borho.org>
parents: 7318
diff changeset
73 message(STATUS "Detected ARM target processor")
5966
0e734b111b1e cpu: port ARM cpu detection code from x264
Steve Borho <steve@borho.org>
parents: 5965
diff changeset
74 set(ARM 1)
6162
291b3a358a22 non-x86 build fixes
Steve Borho <steve@borho.org>
parents: 6124
diff changeset
75 add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
5964
7f1d29a897c1 cmake: improve handling of unknown system processor
Steve Borho <steve@borho.org>
parents: 5955
diff changeset
76 else()
7f1d29a897c1 cmake: improve handling of unknown system processor
Steve Borho <steve@borho.org>
parents: 5955
diff changeset
77 message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
7f1d29a897c1 cmake: improve handling of unknown system processor
Steve Borho <steve@borho.org>
parents: 5955
diff changeset
78 message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
79 endif()
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
80
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
81 if(UNIX)
9052
a04704062b6b add support for VTune profiling with task indicators
Steve Borho <steve@borho.org>
parents: 8986
diff changeset
82 list(APPEND PLATFORM_LIBS pthread)
7930
139d6b2a1b19 cmake: fix BSD link, only link with librt if it exists (closes #75)
Steve Borho <steve@borho.org>
parents: 7768
diff changeset
83 find_library(LIBRT rt)
139d6b2a1b19 cmake: fix BSD link, only link with librt if it exists (closes #75)
Steve Borho <steve@borho.org>
parents: 7768
diff changeset
84 if(LIBRT)
9052
a04704062b6b add support for VTune profiling with task indicators
Steve Borho <steve@borho.org>
parents: 8986
diff changeset
85 list(APPEND PLATFORM_LIBS rt)
7930
139d6b2a1b19 cmake: fix BSD link, only link with librt if it exists (closes #75)
Steve Borho <steve@borho.org>
parents: 7768
diff changeset
86 endif()
10945
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
87 mark_as_advanced(LIBRT)
10321
521643054a55 api: allow libx265 to forward x265_api_get() calls
Steve Borho <steve@borho.org>
parents: 10273
diff changeset
88 find_library(LIBDL dl)
521643054a55 api: allow libx265 to forward x265_api_get() calls
Steve Borho <steve@borho.org>
parents: 10273
diff changeset
89 if(LIBDL)
521643054a55 api: allow libx265 to forward x265_api_get() calls
Steve Borho <steve@borho.org>
parents: 10273
diff changeset
90 list(APPEND PLATFORM_LIBS dl)
521643054a55 api: allow libx265 to forward x265_api_get() calls
Steve Borho <steve@borho.org>
parents: 10273
diff changeset
91 endif()
10945
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
92 option(ENABLE_LIBNUMA "Enable libnuma usage (Linux only)" ON)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
93 if(ENABLE_LIBNUMA)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
94 find_package(Numa)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
95 if(NUMA_FOUND)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
96 link_directories(${NUMA_LIBRARY_DIR})
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
97 list(APPEND CMAKE_REQUIRED_LIBRARIES numa)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
98 check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
99 if(NUMA_V2)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
100 add_definitions(-DHAVE_LIBNUMA)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
101 message(STATUS "libnuma found, building with support for NUMA nodes")
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
102 list(APPEND PLATFORM_LIBS numa)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
103 include_directories(${NUMA_INCLUDE_DIR})
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
104 endif()
9599
6a9cff19ca93 cmake: ignore older versions of libnuma
Steve Borho <steve@borho.org>
parents: 9426
diff changeset
105 endif()
10945
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
106 mark_as_advanced(NUMA_FOUND)
eb5ec9343b07 Enabling the option to compile without libNUMA support in Linux.
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 10938
diff changeset
107 endif(ENABLE_LIBNUMA)
10919
ee04f391b7bc threading: add a slow-path for platforms with no system atomics (closes #85)
Steve Borho <steve@borho.org>
parents: 10911
diff changeset
108 option(NO_ATOMICS "Use a slow mutex to replace atomics" OFF)
ee04f391b7bc threading: add a slow-path for platforms with no system atomics (closes #85)
Steve Borho <steve@borho.org>
parents: 10911
diff changeset
109 if(NO_ATOMICS)
ee04f391b7bc threading: add a slow-path for platforms with no system atomics (closes #85)
Steve Borho <steve@borho.org>
parents: 10911
diff changeset
110 add_definitions(-DNO_ATOMICS=1)
ee04f391b7bc threading: add a slow-path for platforms with no system atomics (closes #85)
Steve Borho <steve@borho.org>
parents: 10911
diff changeset
111 endif(NO_ATOMICS)
12327
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
112 find_library(VMAF vmaf)
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
113 option(ENABLE_LIBVMAF "Enable VMAF" OFF)
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
114 if(ENABLE_LIBVMAF)
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
115 add_definitions(-DENABLE_LIBVMAF)
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
116 endif()
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
117 endif(UNIX)
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
118
8986
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
119 if(X64 AND NOT WIN32)
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
120 option(ENABLE_PIC "Enable Position Independent Code" ON)
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
121 else()
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
122 option(ENABLE_PIC "Enable Position Independent Code" OFF)
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
123 endif(X64 AND NOT WIN32)
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
124
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
125 # Compiler detection
5954
58cff481d6ed cmake: white-space nits
Steve Borho <steve@borho.org>
parents: 5834
diff changeset
126 if(CMAKE_GENERATOR STREQUAL "Xcode")
4006
74d7078f9afe cmake: detect Xcode generator, avoid static lib failure
Steve Borho <steve@borho.org>
parents: 4001
diff changeset
127 set(XCODE 1)
74d7078f9afe cmake: detect Xcode generator, avoid static lib failure
Steve Borho <steve@borho.org>
parents: 4001
diff changeset
128 endif()
10431
cff417129da5 cmake: spacing nits
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 10383
diff changeset
129 if(APPLE)
11699
bed9f6cbca09 Threadpool-fix: correctly detect MacOS
Praveen Tiwari <praveen@multicorewareinc.com>
parents: 11694
diff changeset
130 add_definitions(-DMACOS=1)
4011
8fdafe573ef7 cmake: set MACOS build flag on mac builds (fixes CPU count detection)
Steve Borho <steve@borho.org>
parents: 4006
diff changeset
131 endif()
4006
74d7078f9afe cmake: detect Xcode generator, avoid static lib failure
Steve Borho <steve@borho.org>
parents: 4001
diff changeset
132
9941
64697f08a047 cmake: avoid CMP0054 warnings in main script
Steve Borho <steve@borho.org>
parents: 9938
diff changeset
133 if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
4376
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
134 set(CLANG 1)
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
135 endif()
9941
64697f08a047 cmake: avoid CMP0054 warnings in main script
Steve Borho <steve@borho.org>
parents: 9938
diff changeset
136 if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel")
4376
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
137 set(INTEL_CXX 1)
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
138 endif()
9941
64697f08a047 cmake: avoid CMP0054 warnings in main script
Steve Borho <steve@borho.org>
parents: 9938
diff changeset
139 if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
4376
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
140 set(GCC 1)
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
141 endif()
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
142
4377
e282601b92d6 cmake: make intel C+-+- compiler detection independent of env vars
Steve Borho <steve@borho.org>
parents: 4376
diff changeset
143 if(INTEL_CXX AND WIN32)
4376
95f8e0c146b8 cmake: cleanup compiler determination
Steve Borho <steve@borho.org>
parents: 4370
diff changeset
144 # treat icl roughly like MSVC
3363
d4a7ea88c34d cmake: Intel's ICL mimics MSVC compiler commandline, treat as equiv
Steve Borho <steve@borho.org>
parents: 3250
diff changeset
145 set(MSVC 1)
d4a7ea88c34d cmake: Intel's ICL mimics MSVC compiler commandline, treat as equiv
Steve Borho <steve@borho.org>
parents: 3250
diff changeset
146 endif()
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
147 if(MSVC)
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
148 if(STATIC_LINK_CRT)
3018
c9625ddb711d cmake: add a cmake option to statically link CRT on Windows release builds
Steve Borho <steve@borho.org>
parents: 3015
diff changeset
149 set(CompilerFlags CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE)
c9625ddb711d cmake: add a cmake option to statically link CRT on Windows release builds
Steve Borho <steve@borho.org>
parents: 3015
diff changeset
150 foreach(CompilerFlag ${CompilerFlags})
c9625ddb711d cmake: add a cmake option to statically link CRT on Windows release builds
Steve Borho <steve@borho.org>
parents: 3015
diff changeset
151 string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
c9625ddb711d cmake: add a cmake option to statically link CRT on Windows release builds
Steve Borho <steve@borho.org>
parents: 3015
diff changeset
152 endforeach()
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
153 endif(STATIC_LINK_CRT)
6254
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
154 add_definitions(/W4) # Full warnings
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
155 add_definitions(/Ob2) # always inline
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
156 add_definitions(/MP) # multithreaded build
4658
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
157
6254
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
158 # disable Microsofts suggestions for proprietary secure APIs
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
159 add_definitions(/D_CRT_SECURE_NO_WARNINGS)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
160
4658
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
161 check_include_files(stdint.h HAVE_STDINT_H)
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
162 if(NOT HAVE_STDINT_H)
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
163 include_directories(compat/msvc)
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
164 endif()
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
165 endif(MSVC)
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
166
6869
5167067ed452 common: make a global X265_LL macro for printing uint64_t
Steve Borho <steve@borho.org>
parents: 6866
diff changeset
167 check_include_files(inttypes.h HAVE_INT_TYPES_H)
5167067ed452 common: make a global X265_LL macro for printing uint64_t
Steve Borho <steve@borho.org>
parents: 6866
diff changeset
168 if(HAVE_INT_TYPES_H)
5167067ed452 common: make a global X265_LL macro for printing uint64_t
Steve Borho <steve@borho.org>
parents: 6866
diff changeset
169 add_definitions(-DHAVE_INT_TYPES_H=1)
5167067ed452 common: make a global X265_LL macro for printing uint64_t
Steve Borho <steve@borho.org>
parents: 6866
diff changeset
170 endif()
5167067ed452 common: make a global X265_LL macro for printing uint64_t
Steve Borho <steve@borho.org>
parents: 6866
diff changeset
171
4377
e282601b92d6 cmake: make intel C+-+- compiler detection independent of env vars
Steve Borho <steve@borho.org>
parents: 4376
diff changeset
172 if(INTEL_CXX AND UNIX)
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
173 set(GCC 1) # treat icpc roughly like gcc
4449
fa90c915a323 cmake: do not query clang version, it is not used
Steve Borho <steve@borho.org>
parents: 4447
diff changeset
174 elseif(CLANG)
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
175 set(GCC 1) # treat clang roughly like gcc
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
176 elseif(CMAKE_COMPILER_IS_GNUCXX)
4449
fa90c915a323 cmake: do not query clang version, it is not used
Steve Borho <steve@borho.org>
parents: 4447
diff changeset
177 set(GCC 1)
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
178 endif()
11619
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
179
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
180 if(CC STREQUAL "xlc")
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
181 message(STATUS "Use XLC compiler")
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
182 set(XLC 1)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
183 set(GCC 0)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
184 #set(CMAKE_C_COMPILER "/usr/bin/xlc")
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
185 #set(CMAKE_CXX_COMPILER "/usr/bin/xlc++")
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
186 add_definitions(-D__XLC__=1)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
187 add_definitions(-O3 -qstrict -qhot -qaltivec)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
188 add_definitions(-qinline=level=10 -qpath=IL:/data/video_files/latest.tpo/)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
189 endif()
11758
0f5d8907184d cmake: restore order of options changed by commit d00f2f5 (important for GCC < 6)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11755
diff changeset
190 # this option is to enable the inclusion of dynamic HDR10 library to the libx265 compilation
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
191 option(ENABLE_HDR10_PLUS "Enable dynamic HDR10 compilation" OFF)
11870
fdf39a97ecb8 testbench: include intrinsics header corresponding to target architecture
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11868
diff changeset
192 if(MSVC AND (MSVC_VERSION LESS 1800) AND ENABLE_HDR10_PLUS)
fdf39a97ecb8 testbench: include intrinsics header corresponding to target architecture
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11868
diff changeset
193 message(FATAL_ERROR "MSVC version 12.0 or above required to support hdr10plus")
fdf39a97ecb8 testbench: include intrinsics header corresponding to target architecture
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11868
diff changeset
194 endif()
11894
0bc372b7ca78 Add Visual Studio 2017 build folders
indumathi@multicorewareinc.com
parents: 11879
diff changeset
195 if(WIN32 AND (MSVC_VERSION GREATER 1800))
11924
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
196 if(CMAKE_VERSION VERSION_LESS 3.7)
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
197 message(FATAL_ERROR "cmake version not compatible for VS 2017. Update the cmake to versions 3.7 or above")
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
198 endif()
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
199 endif()
6547
45af76338c8e cmake: fix MinGW build by forcing Vista as minimum target O/S (fixes #44)
Steve Borho <steve@borho.org>
parents: 6543
diff changeset
200 if(GCC)
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
201 add_definitions(-Wall -Wextra -Wshadow)
6922
af78d190e57b add -D__STDC_LIMIT_MACROS=1
Satoshi Nakagawa <nakagawa424@oki.com>
parents: 6912
diff changeset
202 add_definitions(-D__STDC_LIMIT_MACROS=1)
12458
7f391a6a8961 silence GCC 8 warnings -Wclass-memaccess and -Wcast-function-type
Ma0 <mateuszb@poczta.onet.pl>
parents: 12441
diff changeset
203 if(NOT INTEL_CXX AND NOT CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
7f391a6a8961 silence GCC 8 warnings -Wclass-memaccess and -Wcast-function-type
Ma0 <mateuszb@poczta.onet.pl>
parents: 12441
diff changeset
204 add_definitions(-Wno-class-memaccess)
7f391a6a8961 silence GCC 8 warnings -Wclass-memaccess and -Wcast-function-type
Ma0 <mateuszb@poczta.onet.pl>
parents: 12441
diff changeset
205 endif()
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
206 if(ENABLE_HDR10_PLUS)
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
207 if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.8")
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
208 message(FATAL_ERROR "gcc version above 4.8 required to support hdr10plus")
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
209 endif()
11758
0f5d8907184d cmake: restore order of options changed by commit d00f2f5 (important for GCC < 6)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11755
diff changeset
210 add_definitions(-std=gnu++11)
0f5d8907184d cmake: restore order of options changed by commit d00f2f5 (important for GCC < 6)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11755
diff changeset
211 else()
0f5d8907184d cmake: restore order of options changed by commit d00f2f5 (important for GCC < 6)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11755
diff changeset
212 add_definitions(-std=gnu++98)
0f5d8907184d cmake: restore order of options changed by commit d00f2f5 (important for GCC < 6)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11755
diff changeset
213 endif()
8986
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
214 if(ENABLE_PIC)
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
215 add_definitions(-fPIC)
ee36b6311aaf cmake: eoln and white-space fixes, slight refactor
Steve Borho <steve@borho.org>
parents: 8984
diff changeset
216 endif(ENABLE_PIC)
9938
e5495a8cd07c cmake: add option for -march=native
Steve Borho <steve@borho.org>
parents: 9937
diff changeset
217 if(NATIVE_BUILD)
9958
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
218 if(INTEL_CXX)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
219 add_definitions(-xhost)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
220 else()
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
221 add_definitions(-march=native)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
222 endif()
9938
e5495a8cd07c cmake: add option for -march=native
Steve Borho <steve@borho.org>
parents: 9937
diff changeset
223 elseif(X86 AND NOT X64)
11454
bebae72f9db7 cmake: apply -march=i686 for 32bit GCC only if there is no -march in CXXFLAGS (fixes #270)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11453
diff changeset
224 string(FIND "${CMAKE_CXX_FLAGS}" "-march" marchPos)
bebae72f9db7 cmake: apply -march=i686 for 32bit GCC only if there is no -march in CXXFLAGS (fixes #270)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11453
diff changeset
225 if(marchPos LESS "0")
bebae72f9db7 cmake: apply -march=i686 for 32bit GCC only if there is no -march in CXXFLAGS (fixes #270)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11453
diff changeset
226 add_definitions(-march=i686)
11532
49a0d1176aef cmake: fix unaligned stack in 32-bit Windows for GCC 6
Ma0 <mateuszb@poczta.onet.pl>
parents: 11525
diff changeset
227 if(WIN32 AND NOT INTEL_CXX AND NOT CLANG AND
49a0d1176aef cmake: fix unaligned stack in 32-bit Windows for GCC 6
Ma0 <mateuszb@poczta.onet.pl>
parents: 11525
diff changeset
228 CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
49a0d1176aef cmake: fix unaligned stack in 32-bit Windows for GCC 6
Ma0 <mateuszb@poczta.onet.pl>
parents: 11525
diff changeset
229 add_definitions(-mpreferred-stack-boundary=2)
49a0d1176aef cmake: fix unaligned stack in 32-bit Windows for GCC 6
Ma0 <mateuszb@poczta.onet.pl>
parents: 11525
diff changeset
230 endif()
11454
bebae72f9db7 cmake: apply -march=i686 for 32bit GCC only if there is no -march in CXXFLAGS (fixes #270)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11453
diff changeset
231 endif()
5976
eff52bc89e94 cmake: when x86 arch is detected, set gcc -march=i686 globally
Steve Borho <steve@borho.org>
parents: 5975
diff changeset
232 endif()
11249
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
233 if(ARM AND CROSS_COMPILE_ARM)
11506
d28364f1d761 arm: Fix build.Does not fix output change caused by <a5362b9>
Ramya Sriraman
parents: 11502
diff changeset
234 set(ARM_ARGS -march=armv6 -mfloat-abi=soft -mfpu=vfp -marm -fPIC)
11249
769081eb5f4c enable arm-linux cross compile build
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11247
diff changeset
235 elseif(ARM)
11481
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
236 find_package(Neon)
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
237 if(CPU_HAS_NEON)
11506
d28364f1d761 arm: Fix build.Does not fix output change caused by <a5362b9>
Ramya Sriraman
parents: 11502
diff changeset
238 set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=neon -marm -fPIC)
11481
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
239 add_definitions(-DHAVE_NEON)
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
240 else()
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
241 set(ARM_ARGS -mcpu=native -mfloat-abi=hard -mfpu=vfp -marm)
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
242 endif()
6088
5ddbdaefb783 cmake: a few fixes for building on ARM (Rapsbery Pi in particular)
Steve Borho <steve@borho.org>
parents: 6066
diff changeset
243 endif()
11481
6d3849d648f0 cmake: change tab indent into space
Ximing Cheng <ximingcheng@tencent.com>
parents: 11454
diff changeset
244 add_definitions(${ARM_ARGS})
9937
65d004d54895 cmake: introduce fprofile options
Steve Borho <steve@borho.org>
parents: 9917
diff changeset
245 if(FPROFILE_GENERATE)
9958
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
246 if(INTEL_CXX)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
247 add_definitions(-prof-gen -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
248 list(APPEND LINKER_OPTIONS "-prof-gen")
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
249 else()
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
250 check_cxx_compiler_flag(-fprofile-generate CC_HAS_PROFILE_GENERATE)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
251 if(CC_HAS_PROFILE_GENERATE)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
252 add_definitions(-fprofile-generate)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
253 list(APPEND LINKER_OPTIONS "-fprofile-generate")
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
254 endif(CC_HAS_PROFILE_GENERATE)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
255 endif(INTEL_CXX)
9937
65d004d54895 cmake: introduce fprofile options
Steve Borho <steve@borho.org>
parents: 9917
diff changeset
256 endif(FPROFILE_GENERATE)
65d004d54895 cmake: introduce fprofile options
Steve Borho <steve@borho.org>
parents: 9917
diff changeset
257 if(FPROFILE_USE)
9958
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
258 if(INTEL_CXX)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
259 add_definitions(-prof-use -prof-dir="${CMAKE_CURRENT_BINARY_DIR}")
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
260 list(APPEND LINKER_OPTIONS "-prof-use")
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
261 else()
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
262 check_cxx_compiler_flag(-fprofile-use CC_HAS_PROFILE_USE)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
263 check_cxx_compiler_flag(-fprofile-correction CC_HAS_PROFILE_CORRECTION)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
264 check_cxx_compiler_flag(-Wno-error=coverage-mismatch CC_HAS_COVMISMATCH)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
265 if(CC_HAS_PROFILE_USE)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
266 add_definitions(-fprofile-use)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
267 list(APPEND LINKER_OPTIONS "-fprofile-use")
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
268 endif(CC_HAS_PROFILE_USE)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
269 if(CC_HAS_PROFILE_CORRECTION)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
270 # auto-correct corrupted counters (happens a lot with x265)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
271 add_definitions(-fprofile-correction)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
272 endif(CC_HAS_PROFILE_CORRECTION)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
273 if(CC_HAS_COVMISMATCH)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
274 # ignore coverage mismatches (also happens a lot)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
275 add_definitions(-Wno-error=coverage-mismatch)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
276 endif(CC_HAS_COVMISMATCH)
4142e7deaf76 cmake: support PGO for Intel C+-+- (icpc)
Steve Borho <steve@borho.org>
parents: 9956
diff changeset
277 endif(INTEL_CXX)
9937
65d004d54895 cmake: introduce fprofile options
Steve Borho <steve@borho.org>
parents: 9917
diff changeset
278 endif(FPROFILE_USE)
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
279 if(STATIC_LINK_CRT)
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
280 add_definitions(-static)
11732
7e137e3ae083 cmake: Fix static-link-crt not working in linux
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11715
diff changeset
281 list(APPEND LINKER_OPTIONS "-static-libgcc")
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
282 endif(STATIC_LINK_CRT)
10042
1e47a8d8c226 cmake: avoid strict-overflow warnings in slicetype.cpp from GCC 4.9
Steve Borho <steve@borho.org>
parents: 9979
diff changeset
283 check_cxx_compiler_flag(-Wno-strict-overflow CC_HAS_NO_STRICT_OVERFLOW)
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
284 check_cxx_compiler_flag(-Wno-narrowing CC_HAS_NO_NARROWING)
8640
e3a3d17b821c cmake: add -Wno-array-bounds if the compiler supports it
Steve Borho <steve@borho.org>
parents: 8620
diff changeset
285 check_cxx_compiler_flag(-Wno-array-bounds CC_HAS_NO_ARRAY_BOUNDS)
e3a3d17b821c cmake: add -Wno-array-bounds if the compiler supports it
Steve Borho <steve@borho.org>
parents: 8620
diff changeset
286 if (CC_HAS_NO_ARRAY_BOUNDS)
e3a3d17b821c cmake: add -Wno-array-bounds if the compiler supports it
Steve Borho <steve@borho.org>
parents: 8620
diff changeset
287 add_definitions(-Wno-array-bounds) # these are unhelpful
e3a3d17b821c cmake: add -Wno-array-bounds if the compiler supports it
Steve Borho <steve@borho.org>
parents: 8620
diff changeset
288 endif()
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
289 check_cxx_compiler_flag(-ffast-math CC_HAS_FAST_MATH)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
290 if (CC_HAS_FAST_MATH)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
291 add_definitions(-ffast-math)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
292 endif()
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
293 check_cxx_compiler_flag(-mstackrealign CC_HAS_STACK_REALIGN)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
294 if (CC_HAS_STACK_REALIGN)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
295 add_definitions(-mstackrealign)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
296 endif()
6945
f21ce9406d4d Disable exceptions for all compilers which support fno-exceptions
Den Scherbin <dncodr at gmail.com>
parents: 6941
diff changeset
297 # Disable exceptions. Reduce executable size, increase compability.
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
298 check_cxx_compiler_flag(-fno-exceptions CC_HAS_FNO_EXCEPTIONS_FLAG)
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
299 if(CC_HAS_FNO_EXCEPTIONS_FLAG)
6945
f21ce9406d4d Disable exceptions for all compilers which support fno-exceptions
Den Scherbin <dncodr at gmail.com>
parents: 6941
diff changeset
300 add_definitions(-fno-exceptions)
f21ce9406d4d Disable exceptions for all compilers which support fno-exceptions
Den Scherbin <dncodr at gmail.com>
parents: 6941
diff changeset
301 endif()
9601
c19c94af303f cmake: more general support for clang/gcc -fsanitize options
Steve Borho <steve@borho.org>
parents: 9600
diff changeset
302 set(FSANITIZE "" CACHE STRING "-fsanitize options for GCC/clang")
c19c94af303f cmake: more general support for clang/gcc -fsanitize options
Steve Borho <steve@borho.org>
parents: 9600
diff changeset
303 if(FSANITIZE)
c19c94af303f cmake: more general support for clang/gcc -fsanitize options
Steve Borho <steve@borho.org>
parents: 9600
diff changeset
304 add_definitions(-fsanitize=${FSANITIZE})
9654
e5a82ae75480 cmake: fix -fsanitize=address use with ENABLE_SHARED=ON
Steve Borho <steve@borho.org>
parents: 9650
diff changeset
305 # clang and gcc need the sanitize options to be passed at link
e5a82ae75480 cmake: fix -fsanitize=address use with ENABLE_SHARED=ON
Steve Borho <steve@borho.org>
parents: 9650
diff changeset
306 # time so the appropriate ASAN/TSAN runtime libraries can be
e5a82ae75480 cmake: fix -fsanitize=address use with ENABLE_SHARED=ON
Steve Borho <steve@borho.org>
parents: 9650
diff changeset
307 # linked.
9647
cb0127e26694 cmake: generalize adding additional linker options
Steve Borho <steve@borho.org>
parents: 9646
diff changeset
308 list(APPEND LINKER_OPTIONS "-fsanitize=${FSANITIZE}")
9601
c19c94af303f cmake: more general support for clang/gcc -fsanitize options
Steve Borho <steve@borho.org>
parents: 9600
diff changeset
309 endif()
9698
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
310 option(ENABLE_AGGRESSIVE_CHECKS "Enable stack protection and -ftrapv" OFF)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
311 if(ENABLE_AGGRESSIVE_CHECKS)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
312 # use with care, -ftrapv can cause testbench SIGILL exceptions
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
313 # since it is testing corner cases of signed integer math
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
314 add_definitions(-DUSING_FTRAPV=1)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
315 check_cxx_compiler_flag(-fsanitize=undefined-trap CC_HAS_CATCH_UNDEFINED) # clang
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
316 check_cxx_compiler_flag(-ftrapv CC_HAS_FTRAPV) # gcc
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
317 check_cxx_compiler_flag(-fstack-protector-all CC_HAS_STACK_PROTECT) # gcc
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
318 if(CC_HAS_FTRAPV)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
319 add_definitions(-ftrapv)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
320 endif()
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
321 if(CC_HAS_CATCH_UNDEFINED)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
322 add_definitions(-fsanitize=undefined-trap -fsanitize-undefined-trap-on-error)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
323 endif()
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
324 if(CC_HAS_STACK_PROTECT)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
325 add_definitions(-fstack-protector-all)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
326 if(MINGW)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
327 list(APPEND PLATFORM_LIBS ssp)
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
328 endif()
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
329 endif()
1f125d14f656 cmake: separate aggressive check flags from CHECKED_BUILD option
Steve Borho <steve@borho.org>
parents: 9654
diff changeset
330 endif(ENABLE_AGGRESSIVE_CHECKS)
6946
734956446ac1 cmake: move all "GCC-like" logic together, use consistent var names
Steve Borho <steve@borho.org>
parents: 6945
diff changeset
331 execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CC_VERSION)
3841
e694a5fbf527 cmake: make -Werror on GCC a build option defaulting to off
Steve Borho <steve@borho.org>
parents: 3788
diff changeset
332 endif(GCC)
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
333
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
334 find_package(Nasm)
11257
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
335 if(ARM OR CROSS_COMPILE_ARM)
11449
a5362b9533f6 arm: Enable asm by default, allow gcc to auto-detect cpu
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11393
diff changeset
336 option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
337 elseif(NASM_FOUND AND X86)
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
338 if (NASM_VERSION_STRING VERSION_LESS "2.13.0")
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
339 message(STATUS "Nasm version ${NASM_VERSION_STRING} is too old. 2.13.0 or later required")
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
340 option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF)
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
341 else()
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
342 message(STATUS "Found Nasm ${NASM_VERSION_STRING} to build assembly primitives")
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
343 option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" ON)
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
344 endif()
10911
d16b4f730c14 cmake: default ENABLE_ASSEMBLY=OFF for non-x86 builds (refs #167)
Steve Borho <steve@borho.org>
parents: 10857
diff changeset
345 else()
d16b4f730c14 cmake: default ENABLE_ASSEMBLY=OFF for non-x86 builds (refs #167)
Steve Borho <steve@borho.org>
parents: 10857
diff changeset
346 option(ENABLE_ASSEMBLY "Enable use of assembly coded primitives" OFF)
5970
737ceb148a27 cmake: fix warning
Steve Borho <steve@borho.org>
parents: 5969
diff changeset
347 endif()
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
348
9426
010aa61e154b cmake: be more aggressive with compiler flags in checked builds
Steve Borho <steve@borho.org>
parents: 9398
diff changeset
349 option(CHECKED_BUILD "Enable run-time sanity checks (debugging)" OFF)
010aa61e154b cmake: be more aggressive with compiler flags in checked builds
Steve Borho <steve@borho.org>
parents: 9398
diff changeset
350 if(CHECKED_BUILD)
010aa61e154b cmake: be more aggressive with compiler flags in checked builds
Steve Borho <steve@borho.org>
parents: 9398
diff changeset
351 add_definitions(-DCHECKED_BUILD=1)
010aa61e154b cmake: be more aggressive with compiler flags in checked builds
Steve Borho <steve@borho.org>
parents: 9398
diff changeset
352 endif()
010aa61e154b cmake: be more aggressive with compiler flags in checked builds
Steve Borho <steve@borho.org>
parents: 9398
diff changeset
353
5967
2812a45ace5c cmake: reorg main file for readability, no behavior changes
Steve Borho <steve@borho.org>
parents: 5966
diff changeset
354 # Build options
6542
a02a4ba9629e cmake: make lib and bin install folders user configurable (closes #40)
Steve Borho <steve@borho.org>
parents: 6540
diff changeset
355 set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
a02a4ba9629e cmake: make lib and bin install folders user configurable (closes #40)
Steve Borho <steve@borho.org>
parents: 6540
diff changeset
356 set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
10643
0902e35aee38 cmake: ugly hacks for adding arbitrary link library
Steve Borho <steve@borho.org>
parents: 10631
diff changeset
357 set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
10683
2cdab8d3b760 cmake: introduce multilib support for MSVC
Min Chen
parents: 10643
diff changeset
358 set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
10781
993bf36248f1 cmake: cleanup EXTRA_LINK_FLAGS, move all logic together
Steve Borho <steve@borho.org>
parents: 10779
diff changeset
359 if(EXTRA_LINK_FLAGS)
993bf36248f1 cmake: cleanup EXTRA_LINK_FLAGS, move all logic together
Steve Borho <steve@borho.org>
parents: 10779
diff changeset
360 list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
993bf36248f1 cmake: cleanup EXTRA_LINK_FLAGS, move all logic together
Steve Borho <steve@borho.org>
parents: 10779
diff changeset
361 endif()
10936
dd1284ce4d05 cmake: show multilib details in build info string
Steve Borho <steve@borho.org>
parents: 10919
diff changeset
362 if(EXTRA_LIB)
dd1284ce4d05 cmake: show multilib details in build info string
Steve Borho <steve@borho.org>
parents: 10919
diff changeset
363 option(LINKED_8BIT "8bit libx265 is being linked with this library" OFF)
dd1284ce4d05 cmake: show multilib details in build info string
Steve Borho <steve@borho.org>
parents: 10919
diff changeset
364 option(LINKED_10BIT "10bit libx265 is being linked with this library" OFF)
dd1284ce4d05 cmake: show multilib details in build info string
Steve Borho <steve@borho.org>
parents: 10919
diff changeset
365 option(LINKED_12BIT "12bit libx265 is being linked with this library" OFF)
dd1284ce4d05 cmake: show multilib details in build info string
Steve Borho <steve@borho.org>
parents: 10919
diff changeset
366 endif(EXTRA_LIB)
10683
2cdab8d3b760 cmake: introduce multilib support for MSVC
Min Chen
parents: 10643
diff changeset
367 mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)
6021
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
368
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
369 if(X64)
10707
e16b8c5fa3ac cmake: further cleanups for high-bit-depth comment and desc string
Steve Borho <steve@borho.org>
parents: 10691
diff changeset
370 # NOTE: We only officially support high-bit-depth compiles of x265
10688
78c562d38eea clarify 8bit/10bit in code comments
Steve Borho <steve@borho.org>
parents: 10685
diff changeset
371 # on 64bit architectures. Main10 plus large resolution plus slow
6021
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
372 # preset plus 32bit address space usually means malloc failure. You
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
373 # can disable this if(X64) check if you desparately need a 32bit
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
374 # build with 10bit/12bit support, but this violates the "shrink wrap
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
375 # license" so to speak. If it breaks you get to keep both halves.
10707
e16b8c5fa3ac cmake: further cleanups for high-bit-depth comment and desc string
Steve Borho <steve@borho.org>
parents: 10691
diff changeset
376 # You will need to disable assembly manually.
10747
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
377 option(HIGH_BIT_DEPTH "Store pixel samples as 16bit values (Main10/Main12)" OFF)
6021
2f54c7616ef8 cmake: only officially support 16bpp builds on x64 architectures
Steve Borho <steve@borho.org>
parents: 5983
diff changeset
378 endif(X64)
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
379 if(HIGH_BIT_DEPTH)
10747
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
380 option(MAIN12 "Support Main12 instead of Main10" OFF)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
381 if(MAIN12)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
382 add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=12)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
383 else()
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
384 add_definitions(-DHIGH_BIT_DEPTH=1 -DX265_DEPTH=10)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
385 endif()
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
386 else(HIGH_BIT_DEPTH)
10747
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
387 add_definitions(-DHIGH_BIT_DEPTH=0 -DX265_DEPTH=8)
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
388 endif(HIGH_BIT_DEPTH)
11758
0f5d8907184d cmake: restore order of options changed by commit d00f2f5 (important for GCC < 6)
Ma0 <mateuszb@poczta.onet.pl>
parents: 11755
diff changeset
389
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
390 if (ENABLE_HDR10_PLUS)
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
391 include_directories(. dynamicHDR10 "${PROJECT_BINARY_DIR}")
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
392 add_subdirectory(dynamicHDR10)
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
393 add_definitions(-DENABLE_HDR10_PLUS)
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
394 endif(ENABLE_HDR10_PLUS)
12490
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
395
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
396 option(ENABLE_SVT_HEVC "Enable SVT HEVC Encoder" OFF)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
397 if(ENABLE_SVT_HEVC)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
398 find_package(svthevc)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
399 if(SVTHEVC_FOUND)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
400 add_definitions(-DSVT_HEVC)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
401 include_directories(${SVT_HEVC_INCLUDE_DIR})
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
402 endif(SVTHEVC_FOUND)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
403 endif(ENABLE_SVT_HEVC)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
404
10588
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
405 # this option can only be used when linking multiple libx265 libraries
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
406 # together, and some alternate API access method is implemented.
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
407 option(EXPORT_C_API "Implement public C programming interface" ON)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
408 mark_as_advanced(EXPORT_C_API)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
409 if(EXPORT_C_API)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
410 set(X265_NS x265)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
411 add_definitions(-DEXPORT_C_API=1)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
412 elseif(HIGH_BIT_DEPTH)
10747
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
413 if(MAIN12)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
414 set(X265_NS x265_12bit)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
415 else()
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
416 set(X265_NS x265_10bit)
178bbc24e5ce cmake: plumb in build support for Main12
Steve Borho <steve@borho.org>
parents: 10719
diff changeset
417 endif()
10588
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
418 add_definitions(-DEXPORT_C_API=0)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
419 else()
10691
25390edc448a cmake: change multilib namespaces to x265_8bit/x265_10bit
Steve Borho <steve@borho.org>
parents: 10688
diff changeset
420 set(X265_NS x265_8bit)
10588
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
421 add_definitions(-DEXPORT_C_API=0)
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
422 endif()
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
423 add_definitions(-DX265_NS=${X265_NS})
52ca6e909590 cmake: introduce EXPORT_C_API build variable
Steve Borho <steve@borho.org>
parents: 10583
diff changeset
424
6254
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
425 option(WARNINGS_AS_ERRORS "Stop compiles on first warning" OFF)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
426 if(WARNINGS_AS_ERRORS)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
427 if(GCC)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
428 add_definitions(-Werror)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
429 elseif(MSVC)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
430 add_definitions(/WX)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
431 endif()
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
432 endif(WARNINGS_AS_ERRORS)
050273a10519 cmake: make /WX optional for MSVC
Steve Borho <steve@borho.org>
parents: 6199
diff changeset
433
10431
cff417129da5 cmake: spacing nits
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 10383
diff changeset
434 if(WIN32)
3401
e6ad89277005 cmake: add Windows-only option to make binary compatible with Windows XP
Steve Borho <steve@borho.org>
parents: 3363
diff changeset
435 # Visual leak detector
6108
f0d82bf20584 cmake: be quiet about missing optional packages
Steve Borho <steve@borho.org>
parents: 6107
diff changeset
436 find_package(VLD QUIET)
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
437 if(VLD_FOUND)
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
438 add_definitions(-DHAVE_VLD)
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
439 include_directories(${VLD_INCLUDE_DIRS})
9052
a04704062b6b add support for VTune profiling with task indicators
Steve Borho <steve@borho.org>
parents: 8986
diff changeset
440 list(APPEND PLATFORM_LIBS ${VLD_LIBRARIES})
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
441 link_directories(${VLD_LIBRARY_DIRS})
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
442 endif()
10161
34fa761d51bb cmake: specify default Windows target O/S as Win7, to enable NUMA APIs
Steve Borho <steve@borho.org>
parents: 10147
diff changeset
443 option(WINXP_SUPPORT "Make binaries compatible with Windows XP and Vista" OFF)
6625
3f78e639d9ce restore WINXP_SUPPORT build option, workaround for CONDITION_VARIABLE on XP
Steve Borho <steve@borho.org>
parents: 6612
diff changeset
444 if(WINXP_SUPPORT)
3f78e639d9ce restore WINXP_SUPPORT build option, workaround for CONDITION_VARIABLE on XP
Steve Borho <steve@borho.org>
parents: 6612
diff changeset
445 # force use of workarounds for CONDITION_VARIABLE and atomic
3f78e639d9ce restore WINXP_SUPPORT build option, workaround for CONDITION_VARIABLE on XP
Steve Borho <steve@borho.org>
parents: 6612
diff changeset
446 # intrinsics introduced after XP
10273
717dd61e2799 fix build fault on WinXP
Min Chen <chenm003@163.com>
parents: 10165
diff changeset
447 add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WINXP -D_WIN32_WINNT_WIN7=0x0601)
10161
34fa761d51bb cmake: specify default Windows target O/S as Win7, to enable NUMA APIs
Steve Borho <steve@borho.org>
parents: 10147
diff changeset
448 else(WINXP_SUPPORT)
34fa761d51bb cmake: specify default Windows target O/S as Win7, to enable NUMA APIs
Steve Borho <steve@borho.org>
parents: 10147
diff changeset
449 # default to targeting Windows 7 for the NUMA APIs
34fa761d51bb cmake: specify default Windows target O/S as Win7, to enable NUMA APIs
Steve Borho <steve@borho.org>
parents: 10147
diff changeset
450 add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN7)
34fa761d51bb cmake: specify default Windows target O/S as Win7, to enable NUMA APIs
Steve Borho <steve@borho.org>
parents: 10147
diff changeset
451 endif(WINXP_SUPPORT)
1870
cda100c6417f x265-cli: remove old CLI program and config files
Steve Borho <steve@borho.org>
parents: 1840
diff changeset
452 endif()
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
453
11619
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
454 if(POWER)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
455 # IBM Power8
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
456 option(ENABLE_ALTIVEC "Enable ALTIVEC profiling instrumentation" ON)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
457 if(ENABLE_ALTIVEC)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
458 add_definitions(-DHAVE_ALTIVEC=1 -maltivec -mabi=altivec)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
459 add_definitions(-flax-vector-conversions -fpermissive)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
460 else()
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
461 add_definitions(-DHAVE_ALTIVEC=0)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
462 endif()
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
463
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
464 option(CPU_POWER8 "Enable CPU POWER8 profiling instrumentation" ON)
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
465 if(CPU_POWER8)
11620
db11beebf83e [PATCH] [PPC] support option --no-asm to disable Altivec
Min Chen <min.chen@multicorewareinc.com>
parents: 11619
diff changeset
466 add_definitions(-mcpu=power8 -DX265_ARCH_POWER8=1)
11619
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
467 endif()
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
468 endif()
a43054bb5b94 [PPC] Altivec support on IBM Power8 CPU
Roger Moussalli <rmoussal@us.ibm.com>
parents: 11617
diff changeset
469
4432
6d5df4858df6 api: add exported strings which describe version and build info
Steve Borho <steve@borho.org>
parents: 4431
diff changeset
470 include(version) # determine X265_VERSION and X265_LATEST_TAG
8620
fd03d43c1a97 cleanup enough of the context tables to bring them into common/
Steve Borho <steve@borho.org>
parents: 8226
diff changeset
471 include_directories(. common encoder "${PROJECT_BINARY_DIR}")
9056
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
472
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
473 option(ENABLE_PPA "Enable PPA profiling instrumentation" OFF)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
474 if(ENABLE_PPA)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
475 add_definitions(-DENABLE_PPA)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
476 list(APPEND PLATFORM_LIBS PPA)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
477 if(UNIX)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
478 list(APPEND PLATFORM_LIBS dl)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
479 endif(UNIX)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
480 add_subdirectory(profile/PPA)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
481 endif(ENABLE_PPA)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
482
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
483 option(ENABLE_VTUNE "Enable Vtune profiling instrumentation" OFF)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
484 if(ENABLE_VTUNE)
11115
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
485 find_package(Vtune)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
486 if(VTUNE_FOUND)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
487 add_definitions(-DENABLE_VTUNE)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
488 include_directories(${VTUNE_INCLUDE_DIR})
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
489 list(APPEND PLATFORM_LIBS vtune)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
490 link_directories(${VTUNE_LIBRARY_DIR})
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
491 if(WIN32)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
492 list(APPEND PLATFORM_LIBS libittnotify.lib)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
493 else()
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
494 list(APPEND PLATFORM_LIBS libittnotify.a dl)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
495 endif()
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
496 add_subdirectory(profile/vtune)
351a12ca0fda cmake: moving vtune compilation into separate file
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11107
diff changeset
497 endif(VTUNE_FOUND)
9056
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
498 endif(ENABLE_VTUNE)
febe8be758de prof: cleanup profile integrations
Steve Borho <steve@borho.org>
parents: 9052
diff changeset
499
9259
95ad2b84c5bb search: add compile-time optional detailed CU stats
Steve Borho <steve@borho.org>
parents: 9236
diff changeset
500 option(DETAILED_CU_STATS "Enable internal profiling of encoder work" OFF)
95ad2b84c5bb search: add compile-time optional detailed CU stats
Steve Borho <steve@borho.org>
parents: 9236
diff changeset
501 if(DETAILED_CU_STATS)
95ad2b84c5bb search: add compile-time optional detailed CU stats
Steve Borho <steve@borho.org>
parents: 9236
diff changeset
502 add_definitions(-DDETAILED_CU_STATS)
95ad2b84c5bb search: add compile-time optional detailed CU stats
Steve Borho <steve@borho.org>
parents: 9236
diff changeset
503 endif(DETAILED_CU_STATS)
95ad2b84c5bb search: add compile-time optional detailed CU stats
Steve Borho <steve@borho.org>
parents: 9236
diff changeset
504
5821
3bc604fdd380 cmake: tweak order of compiles to improve parallel build times
Steve Borho <steve@borho.org>
parents: 5759
diff changeset
505 add_subdirectory(encoder)
3638
9f38435eee26 fix bug in WinXP mode
Min Chen <chenm003 at 163.com>
parents: 3401
diff changeset
506 add_subdirectory(common)
9f38435eee26 fix bug in WinXP mode
Min Chen <chenm003 at 163.com>
parents: 3401
diff changeset
507
11294
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
508 if((MSVC_IDE OR XCODE OR GCC) AND ENABLE_ASSEMBLY)
6760
c24c7b2d0eff cmake: export YASM_FLAGS from CMakeASM_YASMInformation.cmake
Steve Borho <steve@borho.org>
parents: 6751
diff changeset
509 # this is required because of this cmake bug
4813
3716c9f588df cmake: remove assembly library to fix MSVC static lib
Steve Borho <steve@borho.org>
parents: 4800
diff changeset
510 # http://www.cmake.org/Bug/print_bug_page.php?bug_id=8170
5256
f4e10e4d3f0d cmake: almost revive Xcode support
Steve Borho <steve@borho.org>
parents: 5110
diff changeset
511 if(WIN32)
f4e10e4d3f0d cmake: almost revive Xcode support
Steve Borho <steve@borho.org>
parents: 5110
diff changeset
512 set(SUFFIX obj)
f4e10e4d3f0d cmake: almost revive Xcode support
Steve Borho <steve@borho.org>
parents: 5110
diff changeset
513 else()
f4e10e4d3f0d cmake: almost revive Xcode support
Steve Borho <steve@borho.org>
parents: 5110
diff changeset
514 set(SUFFIX o)
4813
3716c9f588df cmake: remove assembly library to fix MSVC static lib
Steve Borho <steve@borho.org>
parents: 4800
diff changeset
515 endif()
11257
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
516
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
517 if(ARM OR CROSS_COMPILE_ARM)
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
518 # compile ARM arch asm files here
11294
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
519 enable_language(ASM)
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
520 foreach(ASM ${ARM_ASMS})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
521 set(ASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/arm/${ASM})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
522 list(APPEND ASM_SRCS ${ASM_SRC})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
523 list(APPEND ASM_OBJS ${ASM}.${SUFFIX})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
524 add_custom_command(
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
525 OUTPUT ${ASM}.${SUFFIX}
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
526 COMMAND ${CMAKE_CXX_COMPILER}
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
527 ARGS ${ARM_ARGS} -c ${ASM_SRC} -o ${ASM}.${SUFFIX}
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
528 DEPENDS ${ASM_SRC})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
529 endforeach()
11257
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
530 elseif(X86)
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
531 # compile X86 arch asm files here
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
532 foreach(ASM ${MSVC_ASMS})
11294
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
533 set(ASM_SRC ${CMAKE_CURRENT_SOURCE_DIR}/common/x86/${ASM})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
534 list(APPEND ASM_SRCS ${ASM_SRC})
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
535 list(APPEND ASM_OBJS ${ASM}.${SUFFIX})
11257
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
536 add_custom_command(
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
537 OUTPUT ${ASM}.${SUFFIX}
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
538 COMMAND ${NASM_EXECUTABLE} ARGS ${NASM_FLAGS} ${ASM_SRC} -o ${ASM}.${SUFFIX}
11294
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
539 DEPENDS ${ASM_SRC})
11257
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
540 endforeach()
a5309338d135 testbench: setup testbench for ARM assembly
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11249
diff changeset
541 endif()
4813
3716c9f588df cmake: remove assembly library to fix MSVC static lib
Steve Borho <steve@borho.org>
parents: 4800
diff changeset
542 endif()
11294
d6b76aadbd3c arm: Implement blockcopy_pp_16x16_neon. Modified include guards with ARM suffix.
Dnyaneshwar G <dnyaneshwar@multicorewareinc.com>
parents: 11261
diff changeset
543 source_group(ASM FILES ${ASM_SRCS})
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
544 if(ENABLE_HDR10_PLUS)
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
545 add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS})
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
546 add_library(hdr10plus-static STATIC $<TARGET_OBJECTS:dynamicHDR10>)
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
547 set_target_properties(hdr10plus-static PROPERTIES OUTPUT_NAME hdr10plus)
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
548 else()
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
549 add_library(x265-static STATIC $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS})
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
550 endif()
4445
28e2a3926c95 cmake: allow MinGW to rename x265-static to x265
Steve Borho <steve@borho.org>
parents: 4443
diff changeset
551 if(NOT MSVC)
4295
4b354b902b50 cmake: tweak static library names to avoid conflict
Steve Borho <steve@borho.org>
parents: 4294
diff changeset
552 set_target_properties(x265-static PROPERTIES OUTPUT_NAME x265)
4334
d7922b02ef3c cmake: detect clang compiler anf fix some link issues
Steve Borho <steve@borho.org>
parents: 4333
diff changeset
553 endif()
10773
0905ecb7d8b8 cmake: export C API from multilib, enables multibit shared libs (fixes #153)
Steve Borho <steve@borho.org>
parents: 10771
diff changeset
554 if(EXTRA_LIB)
0905ecb7d8b8 cmake: export C API from multilib, enables multibit shared libs (fixes #153)
Steve Borho <steve@borho.org>
parents: 10771
diff changeset
555 target_link_libraries(x265-static ${EXTRA_LIB})
0905ecb7d8b8 cmake: export C API from multilib, enables multibit shared libs (fixes #153)
Steve Borho <steve@borho.org>
parents: 10771
diff changeset
556 endif()
12327
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
557 if(ENABLE_LIBVMAF)
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
558 target_link_libraries(x265-static ${VMAF})
8bc1289c7a4b Add VMAF suppport to report per frame and aggregate VMAF score
IndumathiR<indumathi@multicorewareinc.com>
parents: 12015
diff changeset
559 endif()
12490
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
560 if(SVTHEVC_FOUND)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
561 target_link_libraries(x265-static ${SVT_HEVC_LIBRARY})
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
562 endif()
4428
1097e547c441 cmake: add install targets, machine generate x265.def and x265_config.h
Steve Borho <steve@borho.org>
parents: 4378
diff changeset
563 install(TARGETS x265-static
6542
a02a4ba9629e cmake: make lib and bin install folders user configurable (closes #40)
Steve Borho <steve@borho.org>
parents: 6540
diff changeset
564 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
a02a4ba9629e cmake: make lib and bin install folders user configurable (closes #40)
Steve Borho <steve@borho.org>
parents: 6540
diff changeset
565 ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
566
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
567 if(ENABLE_HDR10_PLUS)
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
568 install(TARGETS hdr10plus-static
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
569 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
570 ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
571 endif()
12490
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
572
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
573 if(SVTHEVC_FOUND)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
574 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbApi.h" DESTINATION include)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
575 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbErrorCodes.h" DESTINATION include)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
576 install(FILES "${SVT_HEVC_INCLUDE_DIR}/EbTime.h" DESTINATION include)
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
577 install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR})
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
578 endif()
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
579
4428
1097e547c441 cmake: add install targets, machine generate x265.def and x265_config.h
Steve Borho <steve@borho.org>
parents: 4378
diff changeset
580 install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
12360
df5bd3be9b11 Fixes cmake error "cannot find x265.pdb" when installing files for static debug build provided enable_cli is off.
Radhakrishnan <radhakrishnan@multicorewareinc.com>
parents: 12338
diff changeset
581 if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
11942
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
582 if(MSVC_IDE)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
583 install(FILES "${PROJECT_BINARY_DIR}/Debug/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
584 install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
585 install(FILES "${PROJECT_BINARY_DIR}/Debug/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
586 install(FILES "${PROJECT_BINARY_DIR}/RelWithDebInfo/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
587 else()
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
588 install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
589 install(FILES "${PROJECT_BINARY_DIR}/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
590 install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug OPTIONAL NAMELINK_ONLY)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
591 install(FILES "${PROJECT_BINARY_DIR}/libx265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS RelWithDebInfo OPTIONAL NAMELINK_ONLY)
36281bd6f98f Install symbol files in MinGW
Mahesh Pittala <mahesh@multicorewareinc.com>
parents: 11925
diff changeset
592 endif()
11925
1f5586d03d85 Fix install symbol files
Mythreyi P
parents: 11924
diff changeset
593 endif()
6105
0fcc87d05d10 cmake: workaround for MinGW windres
Steve Borho <steve@borho.org>
parents: 6104
diff changeset
594 if(CMAKE_RC_COMPILER)
6116
8fdcf1ba38f3 cmake: more general fix for CFLAGS breaking resource compiles
Steve Borho <steve@borho.org>
parents: 6108
diff changeset
595 # The resource compiler does not need CFLAGS or macro defines. It
8fdcf1ba38f3 cmake: more general fix for CFLAGS breaking resource compiles
Steve Borho <steve@borho.org>
parents: 6108
diff changeset
596 # often breaks them
8fdcf1ba38f3 cmake: more general fix for CFLAGS breaking resource compiles
Steve Borho <steve@borho.org>
parents: 6108
diff changeset
597 string(REPLACE "<FLAGS>" "" CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILE_OBJECT}")
8fdcf1ba38f3 cmake: more general fix for CFLAGS breaking resource compiles
Steve Borho <steve@borho.org>
parents: 6108
diff changeset
598 string(REPLACE "<DEFINES>" "" CMAKE_RC_COMPILE_OBJECT "${CMAKE_RC_COMPILE_OBJECT}")
6107
e1088cae157c cmake: simplify version detection, use single set of variables
Steve Borho <steve@borho.org>
parents: 6105
diff changeset
599 # convert X265_LATEST_TAG (ex: 0.7) and X265_TAG_DISTANCE (ex: 103) to
6103
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
600 # @X265_VERSION_MAJOR@,@X265_VERSION_MINOR@,@X265_BRANCH_ID@,@X265_TAG_DISTANCE@
12469
1a598caef5d4 fix RC version string error in MinGW
Radhakrishnan <radhakrishnan@multicorewareinc.com>
parents: 12458
diff changeset
601 string(REGEX MATCHALL "([0-9]+)" VERSION_LIST "${X265_LATEST_TAG}")
6103
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
602 list(GET VERSION_LIST 0 X265_VERSION_MAJOR)
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
603 list(GET VERSION_LIST 1 X265_VERSION_MINOR)
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
604 set(X265_BRANCH_ID 0) # TODO: 0 - stable, 1 - default or other
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
605 set(X265_RC_FILE "${CMAKE_CURRENT_BINARY_DIR}/x265.rc")
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
606 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/x265.rc.in" "${X265_RC_FILE}" @ONLY)
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
607 endif()
54189fefdc51 cmake: add resource file for Windows version info on DLL and EXE
Steve Borho <steve@borho.org>
parents: 6088
diff changeset
608
6806
d72770a77ff8 cmake: add a clean-generated Makefile rule
Steve Borho <steve@borho.org>
parents: 6760
diff changeset
609 if(NOT (MSVC_IDE OR XCODE))
d72770a77ff8 cmake: add a clean-generated Makefile rule
Steve Borho <steve@borho.org>
parents: 6760
diff changeset
610 add_custom_target(clean-generated COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/clean-generated.cmake)
d72770a77ff8 cmake: add a clean-generated Makefile rule
Steve Borho <steve@borho.org>
parents: 6760
diff changeset
611 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
612 option(ENABLE_SHARED "Build shared library" ON)
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
613 if(ENABLE_SHARED)
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
614 if(ENABLE_HDR10_PLUS)
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
615 add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS}
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
616 ${X265_RC_FILE} $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10>)
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
617 add_library(hdr10plus-shared SHARED $<TARGET_OBJECTS:dynamicHDR10>)
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
618
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
619 if(MSVC)
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
620 set_target_properties(hdr10plus-shared PROPERTIES OUTPUT_NAME libhdr10plus)
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
621 else()
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
622 set_target_properties(hdr10plus-shared PROPERTIES OUTPUT_NAME hdr10plus)
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
623 endif()
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
624 else()
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
625 add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${ASM_OBJS}
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
626 ${X265_RC_FILE} $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common>)
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
627 endif()
11094
b6d0c1ce70f5 cmake: correct order of linking, fixes #202
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 11090
diff changeset
628 if(EXTRA_LIB)
b6d0c1ce70f5 cmake: correct order of linking, fixes #202
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 11090
diff changeset
629 target_link_libraries(x265-shared ${EXTRA_LIB})
b6d0c1ce70f5 cmake: correct order of linking, fixes #202
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 11090
diff changeset
630 endif()
12491
a41325fc854f Integrate SVT-HEVC Encoder with X265, Fixing Linux Segmentation fault issue
Dinesh<dinesh@multicorewareinc.com>
parents: 12490
diff changeset
631 target_link_libraries(x265-shared ${PLATFORM_LIBS})
12490
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
632 if(SVTHEVC_FOUND)
12491
a41325fc854f Integrate SVT-HEVC Encoder with X265, Fixing Linux Segmentation fault issue
Dinesh<dinesh@multicorewareinc.com>
parents: 12490
diff changeset
633 target_link_libraries(x265-shared ${SVT_HEVC_LIBRARY})
12490
878541319ea1 Integrate SVT-HEVC encoder to x265
Radhakrishnan
parents: 12469
diff changeset
634 endif(SVTHEVC_FOUND)
6104
21832083908f cmake: change name of MSVC built shared library to avoid filename conflicts
Steve Borho <steve@borho.org>
parents: 6103
diff changeset
635 if(MSVC)
21832083908f cmake: change name of MSVC built shared library to avoid filename conflicts
Steve Borho <steve@borho.org>
parents: 6103
diff changeset
636 set_target_properties(x265-shared PROPERTIES OUTPUT_NAME libx265)
21832083908f cmake: change name of MSVC built shared library to avoid filename conflicts
Steve Borho <steve@borho.org>
parents: 6103
diff changeset
637 else()
21832083908f cmake: change name of MSVC built shared library to avoid filename conflicts
Steve Borho <steve@borho.org>
parents: 6103
diff changeset
638 set_target_properties(x265-shared PROPERTIES OUTPUT_NAME x265)
21832083908f cmake: change name of MSVC built shared library to avoid filename conflicts
Steve Borho <steve@borho.org>
parents: 6103
diff changeset
639 endif()
7499
26458b8dcba4 cmake: tabs to spaces
Steve Borho <steve@borho.org>
parents: 7498
diff changeset
640 if(UNIX)
26458b8dcba4 cmake: tabs to spaces
Steve Borho <steve@borho.org>
parents: 7498
diff changeset
641 set_target_properties(x265-shared PROPERTIES VERSION ${X265_BUILD})
7976
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
642 if(APPLE)
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
643 set_target_properties(x265-shared PROPERTIES MACOSX_RPATH 1)
11136
e43742d5687f cmake: rudimentary support for cygwin
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 11120
diff changeset
644 elseif(CYGWIN)
e43742d5687f cmake: rudimentary support for cygwin
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 11120
diff changeset
645 # Cygwin is not officially supported or tested. MinGW with msys is recommended.
7976
01ba626b850d cmake: enable MACOSX_RPATH on Mac shared libraries
Steve Borho <steve@borho.org>
parents: 7930
diff changeset
646 else()
10779
83bc6fac1fb5 cmake: keep all linker options in list, fixes multilib link
Steve Borho <steve@borho.org>
parents: 10776
diff changeset
647 list(APPEND LINKER_OPTIONS "-Wl,-Bsymbolic,-znoexecstack")
7498
80c1d35e5517 cmake: only create SONAME shared lib on POSIX systems (closes #62)
Steve Borho <steve@borho.org>
parents: 7488
diff changeset
648 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
649 endif()
7343
51b3ff5e88e2 cmake: set SONAME even if no revision number or tag is found (closes #58)
Steve Borho <steve@borho.org>
parents: 7321
diff changeset
650 set_target_properties(x265-shared PROPERTIES SOVERSION ${X265_BUILD})
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
651 if(X265_LATEST_TAG)
7499
26458b8dcba4 cmake: tabs to spaces
Steve Borho <steve@borho.org>
parents: 7498
diff changeset
652 if(WINDOWS)
26458b8dcba4 cmake: tabs to spaces
Steve Borho <steve@borho.org>
parents: 7498
diff changeset
653 set_target_properties(x265-shared PROPERTIES VERSION ${X265_LATEST_TAG})
26458b8dcba4 cmake: tabs to spaces
Steve Borho <steve@borho.org>
parents: 7498
diff changeset
654 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
655 # shared library is not installed if a tag is not found
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
656 install(TARGETS x265-shared
6542
a02a4ba9629e cmake: make lib and bin install folders user configurable (closes #40)
Steve Borho <steve@borho.org>
parents: 6540
diff changeset
657 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
7488
eb983d29c11a cmake: fix dll installation directory on Windows
Michel Zou <xantares09@hotmail.com>
parents: 7349
diff changeset
658 ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
eb983d29c11a cmake: fix dll installation directory on Windows
Michel Zou <xantares09@hotmail.com>
parents: 7349
diff changeset
659 RUNTIME DESTINATION ${BIN_INSTALL_DIR})
5759
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
660 endif()
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
661 if(ENABLE_HDR10_PLUS)
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
662 install(TARGETS hdr10plus-shared
11821
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
663 LIBRARY DESTINATION ${LIB_INSTALL_DIR}
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
664 ARCHIVE DESTINATION ${LIB_INSTALL_DIR})
e3219abfb209 dhdr: add library, deprecate support for gcc versions below 4.8
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11792
diff changeset
665 endif()
9654
e5a82ae75480 cmake: fix -fsanitize=address use with ENABLE_SHARED=ON
Steve Borho <steve@borho.org>
parents: 9650
diff changeset
666 if(LINKER_OPTIONS)
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
667 # set_target_properties can't do list expansion
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
668 string(REPLACE ";" " " LINKER_OPTION_STR "${LINKER_OPTIONS}")
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
669 set_target_properties(x265-shared PROPERTIES LINK_FLAGS "${LINKER_OPTION_STR}")
9654
e5a82ae75480 cmake: fix -fsanitize=address use with ENABLE_SHARED=ON
Steve Borho <steve@borho.org>
parents: 9650
diff changeset
670 endif()
5759
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
671 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
672
5759
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
673 if(X265_LATEST_TAG)
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
674 # convert lists of link libraries into -lstdc++ -lm etc..
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
675 foreach(LIB ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
6751
d11c90310c8a cmake: do not prefix absolute library paths with -l in pc file
Steve Borho <steve@borho.org>
parents: 6713
diff changeset
676 if(IS_ABSOLUTE ${LIB} AND EXISTS ${LIB})
d11c90310c8a cmake: do not prefix absolute library paths with -l in pc file
Steve Borho <steve@borho.org>
parents: 6713
diff changeset
677 list(APPEND PLIBLIST "${LIB}")
d11c90310c8a cmake: do not prefix absolute library paths with -l in pc file
Steve Borho <steve@borho.org>
parents: 6713
diff changeset
678 else()
d11c90310c8a cmake: do not prefix absolute library paths with -l in pc file
Steve Borho <steve@borho.org>
parents: 6713
diff changeset
679 list(APPEND PLIBLIST "-l${LIB}")
d11c90310c8a cmake: do not prefix absolute library paths with -l in pc file
Steve Borho <steve@borho.org>
parents: 6713
diff changeset
680 endif()
5759
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
681 endforeach()
6124
f46c3f816fe7 cmake: on MSVC, CMAKE_CXX_IMPLICIT_LINK_LIBRARIES and PLATFORM_LIBS may be empty
Steve Borho <steve@borho.org>
parents: 6123
diff changeset
682 if(PLIBLIST)
f46c3f816fe7 cmake: on MSVC, CMAKE_CXX_IMPLICIT_LINK_LIBRARIES and PLATFORM_LIBS may be empty
Steve Borho <steve@borho.org>
parents: 6123
diff changeset
683 # blacklist of libraries that should not be in Libs.private
11975
a20a6e0fb4f8 CMake: blacklist mingw implicit link libraries
Ricardo Constantino <wiiaboo@gmail.com>
parents: 11965
diff changeset
684 list(REMOVE_ITEM PLIBLIST "-lc" "-lpthread" "-lmingwex" "-lmingwthrd"
a20a6e0fb4f8 CMake: blacklist mingw implicit link libraries
Ricardo Constantino <wiiaboo@gmail.com>
parents: 11965
diff changeset
685 "-lmingw32" "-lmoldname" "-lmsvcrt" "-ladvapi32" "-lshell32"
a20a6e0fb4f8 CMake: blacklist mingw implicit link libraries
Ricardo Constantino <wiiaboo@gmail.com>
parents: 11965
diff changeset
686 "-luser32" "-lkernel32")
6124
f46c3f816fe7 cmake: on MSVC, CMAKE_CXX_IMPLICIT_LINK_LIBRARIES and PLATFORM_LIBS may be empty
Steve Borho <steve@borho.org>
parents: 6123
diff changeset
687 string(REPLACE ";" " " PRIVATE_LIBS "${PLIBLIST}")
f46c3f816fe7 cmake: on MSVC, CMAKE_CXX_IMPLICIT_LINK_LIBRARIES and PLATFORM_LIBS may be empty
Steve Borho <steve@borho.org>
parents: 6123
diff changeset
688 else()
f46c3f816fe7 cmake: on MSVC, CMAKE_CXX_IMPLICIT_LINK_LIBRARIES and PLATFORM_LIBS may be empty
Steve Borho <steve@borho.org>
parents: 6123
diff changeset
689 set(PRIVATE_LIBS "")
f46c3f816fe7 cmake: on MSVC, CMAKE_CXX_IMPLICIT_LINK_LIBRARIES and PLATFORM_LIBS may be empty
Steve Borho <steve@borho.org>
parents: 6123
diff changeset
690 endif(PLIBLIST)
6123
757b127f8ede cmake: add a blacklist of libs to keep from x265.pc Libs.private
Steve Borho <steve@borho.org>
parents: 6116
diff changeset
691
5759
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
692 # Produce a pkg-config file
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
693 configure_file("x265.pc.in" "x265.pc" @ONLY)
1c37c4401ea4 cmake: .pc file is useful as well when using static libs
Rafaël Carré <funman@videolan.org>
parents: 5690
diff changeset
694 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/x265.pc"
9199
66f85a0519e2 cmake: fix pkgconfig install destination
Yann.OA <yann.s@olanguena.com>
parents: 9194
diff changeset
695 DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
696 endif()
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
697
11924
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
698 configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
699 "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
700 IMMEDIATE @ONLY)
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
701 add_custom_target(uninstall
ae6af09fa63f Fix Build fails for MacOS
Mythreyi P
parents: 11919
diff changeset
702 "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
4431
c18a09b9d2d3 cmake: add uninstall rule for non-Windows platforms
Steve Borho <steve@borho.org>
parents: 4430
diff changeset
703
1870
cda100c6417f x265-cli: remove old CLI program and config files
Steve Borho <steve@borho.org>
parents: 1840
diff changeset
704 # Main CLI application
10719
9b26dc9ec39d cmake: allow the CLI option to be cached
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 10707
diff changeset
705 set(ENABLE_CLI ON CACHE BOOL "Build standalone CLI application")
1870
cda100c6417f x265-cli: remove old CLI program and config files
Steve Borho <steve@borho.org>
parents: 1840
diff changeset
706 if(ENABLE_CLI)
10162
0b52b0251807 cmake: use explicit cpp file lists for input/ and output/
Steve Borho <steve@borho.org>
parents: 10161
diff changeset
707 file(GLOB InputFiles input/input.cpp input/yuv.cpp input/y4m.cpp input/*.h)
10164
3749af0b4277 cli: add an output preview feature, activated by --recon-y4m-exec
Peixuan Zhang <zhangpeixuancn@gmail.com>
parents: 10162
diff changeset
708 file(GLOB OutputFiles output/output.cpp output/reconplay.cpp output/*.h
10162
0b52b0251807 cmake: use explicit cpp file lists for input/ and output/
Steve Borho <steve@borho.org>
parents: 10161
diff changeset
709 output/yuv.cpp output/y4m.cpp # recon
0b52b0251807 cmake: use explicit cpp file lists for input/ and output/
Steve Borho <steve@borho.org>
parents: 10161
diff changeset
710 output/raw.cpp) # muxers
3972
60dec1deb894 cmake: merge InputFiles and OutputFiles projects into cli project (simplicity)
Steve Borho <steve@borho.org>
parents: 3967
diff changeset
711 source_group(input FILES ${InputFiles})
60dec1deb894 cmake: merge InputFiles and OutputFiles projects into cli project (simplicity)
Steve Borho <steve@borho.org>
parents: 3967
diff changeset
712 source_group(output FILES ${OutputFiles})
4667
84aea900ea0d cmake: segregate the getopt files into their own compat/ folder
Steve Borho <steve@borho.org>
parents: 4665
diff changeset
713
4658
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
714 check_include_files(getopt.h HAVE_GETOPT_H)
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
715 if(NOT HAVE_GETOPT_H)
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
716 if(MSVC)
4667
84aea900ea0d cmake: segregate the getopt files into their own compat/ folder
Steve Borho <steve@borho.org>
parents: 4665
diff changeset
717 set_source_files_properties(compat/getopt/getopt.c PROPERTIES COMPILE_FLAGS "/wd4100 /wd4131 -DHAVE_STRING_H=1")
4658
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
718 endif(MSVC)
4667
84aea900ea0d cmake: segregate the getopt files into their own compat/ folder
Steve Borho <steve@borho.org>
parents: 4665
diff changeset
719 include_directories(compat/getopt)
84aea900ea0d cmake: segregate the getopt files into their own compat/ folder
Steve Borho <steve@borho.org>
parents: 4665
diff changeset
720 set(GETOPT compat/getopt/getopt.c compat/getopt/getopt.h)
4658
1ab80557656a cmake: use system native stdint.h and getopt if they are found
Steve Borho <steve@borho.org>
parents: 4629
diff changeset
721 endif(NOT HAVE_GETOPT_H)
10776
023775873fae cmake: add exports def file for all Windows compilers, not just MSVC
Steve Borho <steve@borho.org>
parents: 10773
diff changeset
722 if(WIN32)
10771
535c1ea02bd9 cmake: export our public C API from our Windows CLI executable
Steve Borho <steve@borho.org>
parents: 10747
diff changeset
723 set(ExportDefs "${PROJECT_BINARY_DIR}/x265.def")
10776
023775873fae cmake: add exports def file for all Windows compilers, not just MSVC
Steve Borho <steve@borho.org>
parents: 10773
diff changeset
724 endif(WIN32)
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
725 if(XCODE)
6540
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
726 # Xcode seems unable to link the CLI with libs, so link as one targget
11822
ce9cacc5e9ee nits: rename dynamic HDR10, rectify warning message
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11821
diff changeset
727 if(ENABLE_HDR10_PLUS)
10805
11911e0e5949 cmake: remove empty file set
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 10800
diff changeset
728 add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}
11792
bf93bf6183a7 Add csv feature into libx265
Divya Manivannan <divya@multicorewareinc.com>
parents: 11789
diff changeset
729 x265.cpp x265.h x265cli.h
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
730 $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> $<TARGET_OBJECTS:dynamicHDR10> ${ASM_OBJS})
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
731 else()
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
732 add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT}
11792
bf93bf6183a7 Add csv feature into libx265
Divya Manivannan <divya@multicorewareinc.com>
parents: 11789
diff changeset
733 x265.cpp x265.h x265cli.h
11937
9eabffb26dd6 x86: Change assembler from YASM to NASM
Vignesh Vijayakumar<vignesh@multicorewareinc.com>
parents: 11925
diff changeset
734 $<TARGET_OBJECTS:encoder> $<TARGET_OBJECTS:common> ${ASM_OBJS})
11742
e2eb86dce7f4 dhdr10-info: add tone-mapping metadata as SEI message with cli option
Bhavna Hariharan <bhavna@multicorewareinc.com>
parents: 11735
diff changeset
735 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
736 else()
10805
11911e0e5949 cmake: remove empty file set
Deepthi Nandakumar <deepthi@multicorewareinc.com>
parents: 10800
diff changeset
737 add_executable(cli ../COPYING ${InputFiles} ${OutputFiles} ${GETOPT} ${X265_RC_FILE}
11792
bf93bf6183a7 Add csv feature into libx265
Divya Manivannan <divya@multicorewareinc.com>
parents: 11789
diff changeset
738 ${ExportDefs} x265.cpp x265.h x265cli.h)
6555
459c96998a62 cmake: tabs to spaces
Steve Borho <steve@borho.org>
parents: 6554
diff changeset
739 if(WIN32 OR NOT ENABLE_SHARED OR INTEL_CXX)
6540
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
740 # The CLI cannot link to the shared library on Windows, it
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
741 # requires internal APIs not exported from the DLL
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
742 target_link_libraries(cli x265-static ${PLATFORM_LIBS})
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
743 else()
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
744 target_link_libraries(cli x265-shared ${PLATFORM_LIBS})
f91b930aea7e cmake: link cli app to shared library on POSIX systems (closes #37)
Steve Borho <steve@borho.org>
parents: 6391
diff changeset
745 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
746 endif()
4294
713c2133c77c cmake: use cmake 2.8 OBJECT target type to manage static and share libs
Steve Borho <steve@borho.org>
parents: 4271
diff changeset
747 set_target_properties(cli PROPERTIES OUTPUT_NAME x265)
9647
cb0127e26694 cmake: generalize adding additional linker options
Steve Borho <steve@borho.org>
parents: 9646
diff changeset
748 if(LINKER_OPTIONS)
9955
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
749 # set_target_properties can't do list expansion
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
750 string(REPLACE ";" " " LINKER_OPTION_STR "${LINKER_OPTIONS}")
6fcc9076c5ed cmake: add support for statically linking with C runtime with MinGW
Steve Borho <steve@borho.org>
parents: 9941
diff changeset
751 set_target_properties(cli PROPERTIES LINK_FLAGS "${LINKER_OPTION_STR}")
9601
c19c94af303f cmake: more general support for clang/gcc -fsanitize options
Steve Borho <steve@borho.org>
parents: 9600
diff changeset
752 endif()
4428
1097e547c441 cmake: add install targets, machine generate x265.def and x265_config.h
Steve Borho <steve@borho.org>
parents: 4378
diff changeset
753
6542
a02a4ba9629e cmake: make lib and bin install folders user configurable (closes #40)
Steve Borho <steve@borho.org>
parents: 6540
diff changeset
754 install(TARGETS cli DESTINATION ${BIN_INSTALL_DIR})
1595
ff8e92d7c095 Backed out changeset: 6a5d35fd39fb
praveentiwari
parents: 1594
diff changeset
755 endif(ENABLE_CLI)
4270
d79cbcdcb538 cmake: simplify test build structure
Steve Borho <steve@borho.org>
parents: 4249
diff changeset
756
5570
e1fbbf947b60 cmake: simplify use of ENABLE_ASSEMBLY build define
Steve Borho <steve@borho.org>
parents: 5552
diff changeset
757 if(ENABLE_ASSEMBLY AND NOT XCODE)
e1fbbf947b60 cmake: simplify use of ENABLE_ASSEMBLY build define
Steve Borho <steve@borho.org>
parents: 5552
diff changeset
758 option(ENABLE_TESTS "Enable Unit Tests" OFF)
e1fbbf947b60 cmake: simplify use of ENABLE_ASSEMBLY build define
Steve Borho <steve@borho.org>
parents: 5552
diff changeset
759 if(ENABLE_TESTS)
e1fbbf947b60 cmake: simplify use of ENABLE_ASSEMBLY build define
Steve Borho <steve@borho.org>
parents: 5552
diff changeset
760 add_subdirectory(test)
e1fbbf947b60 cmake: simplify use of ENABLE_ASSEMBLY build define
Steve Borho <steve@borho.org>
parents: 5552
diff changeset
761 endif()
5552
3e6be1e11720 cmake: add ENABLE_SHARED cmake option, default to ON
Steve Borho <steve@borho.org>
parents: 5550
diff changeset
762 endif()
11352
9f58bb5c03c4 cmake: Export PLATFORM_LIBS for other integrators to re-use
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11312
diff changeset
763
11388
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
764 get_directory_property(hasParent PARENT_DIRECTORY)
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
765 if(hasParent)
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
766 if(PLATFORM_LIBS)
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
767 LIST(REMOVE_DUPLICATES PLATFORM_LIBS)
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
768 set(PLATFORM_LIBS ${PLATFORM_LIBS} PARENT_SCOPE)
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
769 endif(PLATFORM_LIBS)
1a49692cf7ef cmake: Export PLATFORM_LIBS only if x265 has a parent scope
Pradeep Ramachandran <pradeep@multicorewareinc.com>
parents: 11381
diff changeset
770 endif(hasParent)