From 88b7b60132aa62864b55f06865bb7c0b6ae09c1e Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Sun, 28 Dec 2014 07:11:55 +0000
Subject: Check if threading library needs to be linked separately


diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index c019c2e..7386c73 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -79,7 +79,8 @@ else()
 endif()
 
 if(UNIX)
-    list(APPEND PLATFORM_LIBS pthread)
+	find_package(Threads)
+    list(APPEND PLATFORM_LIBS ${CMAKE_THREAD_LIBS_INIT})
     find_library(LIBRT rt)
     if(LIBRT)
         list(APPEND PLATFORM_LIBS rt)
-- 
2.23.0


From 7e65fd92030b80aa75c769de100f7f0734f9ebf5 Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Sun, 28 Dec 2014 07:13:56 +0000
Subject: Add an option to adjust headers installation path


diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index 7386c73..c67236d 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -355,6 +355,7 @@ endif()
 # Build options
 set(LIB_INSTALL_DIR lib CACHE STRING "Install location of libraries")
 set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
+set(INCLUDE_INSTALL_DIR include CACHE STRING "Install location of headers")
 set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
 set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
 if(EXTRA_LINK_FLAGS)
-- 
2.23.0


From bea6a228a5542d3446962c8a3f77553cc65ee1ce Mon Sep 17 00:00:00 2001
From: Timothy Gu <timothygu99@gmail.com>
Date: Sun, 28 Dec 2014 07:14:34 +0000
Subject: Add Haiku version of adjusting thread priority


diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt
index c67236d..a8a32da 100644
--- a/source/CMakeLists.txt
+++ b/source/CMakeLists.txt
@@ -579,7 +579,8 @@ if(SVTHEVC_FOUND)
     install(FILES "${SVT_HEVC_LIBRARY}" DESTINATION ${BIN_INSTALL_DIR})
 endif()
 
-install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
+install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h"
+    DESTINATION "${INCLUDE_INSTALL_DIR}")
 if((WIN32 AND ENABLE_CLI) OR (WIN32 AND ENABLE_SHARED))
     if(MSVC_IDE)
         install(FILES "${PROJECT_BINARY_DIR}/Debug/x265.pdb" DESTINATION ${BIN_INSTALL_DIR} CONFIGURATIONS Debug)
-- 
2.23.0


From b27bd0f8bc15b7fef2a2968d2bf956b75623bfb4 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 25 Oct 2019 21:18:33 +0200
Subject: avoid using nice.


diff --git a/source/common/threadpool.cpp b/source/common/threadpool.cpp
index f359d80..174d004 100644
--- a/source/common/threadpool.cpp
+++ b/source/common/threadpool.cpp
@@ -118,7 +118,9 @@ void WorkerThread::threadMain()
 #if _WIN32
     SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
 #else
+#ifndef __HAIKU__
     __attribute__((unused)) int val = nice(10);
+#endif
 #endif
 
     m_pool.setCurrentThreadAffinity();
-- 
2.23.0

