reorganise c++ options in build scripts for linux

This commit is contained in:
Taner Sener 2022-08-29 21:55:20 +01:00
parent f3cf10658c
commit 004ae7187f
2 changed files with 14 additions and 17 deletions

View File

@ -407,7 +407,7 @@ static CallbackData *callbackDataRemove() {
* @param sessionId session id
*/
static void registerSessionId(long sessionId) {
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 1);
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], (short)1);
}
/**
@ -416,7 +416,7 @@ static void registerSessionId(long sessionId) {
* @param sessionId session id
*/
static void removeSession(long sessionId) {
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 0);
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], (short)0);
}
#ifdef __cplusplus
@ -429,7 +429,7 @@ extern "C" {
* @param sessionId session id
*/
void cancelSession(long sessionId) {
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], 2);
std::atomic_store(&sessionMap[sessionId % SESSION_MAP_SIZE], (short)2);
}
/**
@ -770,7 +770,7 @@ void* ffmpegKitInitialize() {
sessionHistorySize = 10;
for(int i = 0; i<SESSION_MAP_SIZE; i++) {
std::atomic_init(&sessionMap[i], 0);
std::atomic_init(&sessionMap[i], (short)0);
std::atomic_init(&sessionInTransitMessageCountMap[i], 0);
}

View File

@ -300,40 +300,37 @@ get_cxxflags() {
fi
local BUILD_DATE="-DFFMPEG_KIT_BUILD_DATE=$(date +%Y%m%d 2>>"${BASEDIR}"/build.log)"
local COMMON_FLAGS="${OPTIMIZATION_FLAGS} ${BUILD_DATE} $(get_arch_specific_cflags)"
local COMMON_FLAGS="-stdlib=libstdc++ -std=c++11 ${OPTIMIZATION_FLAGS} ${BUILD_DATE} $(get_arch_specific_cflags)"
case $1 in
ffmpeg)
if [[ -z ${FFMPEG_KIT_DEBUG} ]]; then
echo "${LINK_TIME_OPTIMIZATION_FLAGS} -std=c++11 -O2 -ffunction-sections -fdata-sections"
echo "${LINK_TIME_OPTIMIZATION_FLAGS} -stdlib=libstdc++ -std=c++11 -O2 -ffunction-sections -fdata-sections"
else
echo "${FFMPEG_KIT_DEBUG} -std=c++11"
echo "${FFMPEG_KIT_DEBUG} -stdlib=libstdc++ -std=c++11"
fi
;;
ffmpeg-kit)
echo "-std=c++11 ${COMMON_FLAGS}"
echo "${COMMON_FLAGS}"
;;
srt | zimg)
echo "${COMMON_FLAGS} -std=c++11 -fcxx-exceptions -fPIC"
echo "${COMMON_FLAGS} -fcxx-exceptions -fPIC"
;;
*)
echo "-std=c++11 -fno-exceptions -fno-rtti ${COMMON_FLAGS}"
echo "${COMMON_FLAGS} -fno-exceptions -fno-rtti"
;;
esac
}
get_common_linked_libraries() {
local COMMON_LIBRARY_PATHS=""
local COMMON_LIBRARIES=""
case $1 in
ffmpeg)
echo "-lc -lm -ldl ${COMMON_LIBRARY_PATHS}"
;;
srt)
echo "-lc -lm -ldl -lstdc++ ${COMMON_LIBRARY_PATHS}"
chromaprint | ffmpeg-kit | kvazaar | srt | zimg)
echo "-stdlib=libstdc++ -lstdc++ -lc -lm ${COMMON_LIBRARIES}"
;;
*)
echo "-lc -lm -ldl ${COMMON_LIBRARY_PATHS}"
echo "-lc -lm -ldl ${COMMON_LIBRARIES}"
;;
esac
}