mirror of https://github.com/PCSX2/pcsx2.git
cmake: add Intel's ICC compiler support
Full of compilations errors and warnings
This commit is contained in:
parent
a9f9c1406c
commit
64e8e02f54
14
build.sh
14
build.sh
|
@ -20,6 +20,7 @@ flags=(-DCMAKE_BUILD_PO=FALSE)
|
||||||
|
|
||||||
cleanBuild=0
|
cleanBuild=0
|
||||||
useClang=0
|
useClang=0
|
||||||
|
useIcc=0
|
||||||
# 0 => no, 1 => yes, 2 => force yes
|
# 0 => no, 1 => yes, 2 => force yes
|
||||||
useCross=2
|
useCross=2
|
||||||
CoverityBuild=0
|
CoverityBuild=0
|
||||||
|
@ -52,6 +53,7 @@ for ARG in "$@"; do
|
||||||
--clean ) cleanBuild=1 ;;
|
--clean ) cleanBuild=1 ;;
|
||||||
--clang-tidy ) flags+=(-DCMAKE_EXPORT_COMPILE_COMMANDS=ON); clangTidy=1 ;;
|
--clang-tidy ) flags+=(-DCMAKE_EXPORT_COMPILE_COMMANDS=ON); clangTidy=1 ;;
|
||||||
--clang ) useClang=1 ;;
|
--clang ) useClang=1 ;;
|
||||||
|
--intel ) useIcc=1 ;;
|
||||||
--cppcheck ) cppcheck=1 ;;
|
--cppcheck ) cppcheck=1 ;;
|
||||||
--dev|--devel ) flags+=(-DCMAKE_BUILD_TYPE=Devel) build="$root/build_dev";;
|
--dev|--devel ) flags+=(-DCMAKE_BUILD_TYPE=Devel) build="$root/build_dev";;
|
||||||
--dbg|--debug ) flags+=(-DCMAKE_BUILD_TYPE=Debug) build="$root/build_dbg";;
|
--dbg|--debug ) flags+=(-DCMAKE_BUILD_TYPE=Debug) build="$root/build_dbg";;
|
||||||
|
@ -94,6 +96,7 @@ for ARG in "$@"; do
|
||||||
echo "--gtk3 : replace GTK2 by GTK3"
|
echo "--gtk3 : replace GTK2 by GTK3"
|
||||||
echo "--no-cross-multilib: Build a native PCSX2"
|
echo "--no-cross-multilib: Build a native PCSX2"
|
||||||
echo "--clang : Build with Clang/llvm"
|
echo "--clang : Build with Clang/llvm"
|
||||||
|
echo "--intel : Build with ICC (Intel compiler)"
|
||||||
echo
|
echo
|
||||||
echo "** Quality & Assurance (Please install the external tool) **"
|
echo "** Quality & Assurance (Please install the external tool) **"
|
||||||
echo "--asan : Enable Address sanitizer"
|
echo "--asan : Enable Address sanitizer"
|
||||||
|
@ -145,7 +148,16 @@ if [[ "$useClang" -eq 1 ]]; then
|
||||||
CC="clang -m32" CXX="clang++ -m32" cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log"
|
CC="clang -m32" CXX="clang++ -m32" cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log"
|
if [[ "$useIcc" -eq 1 ]]; then
|
||||||
|
if [[ "$useCross" -eq 0 ]]; then
|
||||||
|
CC="icc" CXX="icpc" cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log"
|
||||||
|
else
|
||||||
|
CC="icc -m32" CXX="icpc -m32" cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Default compiler AKA GCC
|
||||||
|
cmake "${flags[@]}" "$root" 2>&1 | tee -a "$log"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,14 @@ option(USE_ASAN "Enable address sanitizer")
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||||
set(USE_CLANG TRUE)
|
set(USE_CLANG TRUE)
|
||||||
message(STATUS "Building with Clang/LLVM.")
|
message(STATUS "Building with Clang/LLVM.")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
|
||||||
|
set(USE_ICC TRUE)
|
||||||
|
message(STATUS "Building with Intel's ICC.")
|
||||||
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
set(USE_GCC TRUE)
|
||||||
|
message(STATUS "Building with GNU GCC")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unknow compiler: ${CMAKE_CXX_COMPILER_ID}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
@ -291,15 +299,25 @@ set(HARDENING_FLAG "-D_FORTIFY_SOURCE=2 -Wformat -Wformat-security")
|
||||||
# -Wno-unused-function: warn for function not used in release build
|
# -Wno-unused-function: warn for function not used in release build
|
||||||
# -Wno-unused-variable: just annoying to manage different level of logging, a couple of extra var won't kill any serious compiler.
|
# -Wno-unused-variable: just annoying to manage different level of logging, a couple of extra var won't kill any serious compiler.
|
||||||
# -Wno-unused-value: lots of warning for this kind of statements "0 && ...". There are used to disable some parts of code in release/dev build.
|
# -Wno-unused-value: lots of warning for this kind of statements "0 && ...". There are used to disable some parts of code in release/dev build.
|
||||||
set(DEFAULT_WARNINGS "-Wall -Wno-attributes -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value ")
|
set(DEFAULT_WARNINGS "-Wall -Wno-attributes -Wno-missing-field-initializers -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable ")
|
||||||
|
if (NOT USE_ICC)
|
||||||
|
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-unused-value ")
|
||||||
|
endif()
|
||||||
|
|
||||||
# -Wstrict-aliasing=n: to fix one day aliasing issue. n=1/2/3
|
# -Wstrict-aliasing=n: to fix one day aliasing issue. n=1/2/3
|
||||||
set(AGGRESSIVE_WARNING "-Wstrict-aliasing -Wstrict-overflow=2 ")
|
if (USE_ICC)
|
||||||
|
set(AGGRESSIVE_WARNING "-Wstrict-aliasing ")
|
||||||
|
else()
|
||||||
|
set(AGGRESSIVE_WARNING "-Wstrict-aliasing -Wstrict-overflow=2 ")
|
||||||
|
endif()
|
||||||
|
|
||||||
if (USE_CLANG)
|
if (USE_CLANG)
|
||||||
# -Wno-deprecated-register: glib issue...
|
# -Wno-deprecated-register: glib issue...
|
||||||
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register -Wno-c++14-extensions")
|
set(DEFAULT_WARNINGS "${DEFAULT_WARNINGS} -Wno-deprecated-register -Wno-c++14-extensions")
|
||||||
set(DBG "-g -fno-omit-frame-pointer")
|
set(DBG "-g -fno-omit-frame-pointer")
|
||||||
else()
|
elseif (USE_ICC)
|
||||||
|
set(DBG "-g -fno-omit-frame-pointer")
|
||||||
|
elseif (USE_GCC)
|
||||||
set(DBG "-ggdb3 -fno-omit-frame-pointer")
|
set(DBG "-ggdb3 -fno-omit-frame-pointer")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -334,10 +352,10 @@ endif()
|
||||||
|
|
||||||
if(NOT DEFINED OPTIMIZATION_FLAG)
|
if(NOT DEFINED OPTIMIZATION_FLAG)
|
||||||
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
if (USE_CLANG)
|
if (USE_GCC)
|
||||||
set(OPTIMIZATION_FLAG -O0)
|
|
||||||
else()
|
|
||||||
set(OPTIMIZATION_FLAG -Og)
|
set(OPTIMIZATION_FLAG -Og)
|
||||||
|
else()
|
||||||
|
set(OPTIMIZATION_FLAG -O0)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(OPTIMIZATION_FLAG -O2)
|
set(OPTIMIZATION_FLAG -O2)
|
||||||
|
|
Loading…
Reference in New Issue