mirror of https://github.com/PCSX2/pcsx2.git
Respect the CC and CXX environment variables when cross building.
This commit is contained in:
parent
e23e2ac327
commit
8440d263cd
10
build.sh
10
build.sh
|
@ -20,6 +20,8 @@ flags=(-DCMAKE_BUILD_PO=FALSE)
|
||||||
|
|
||||||
cleanBuild=0
|
cleanBuild=0
|
||||||
useClang=0
|
useClang=0
|
||||||
|
# 0 => no, 1 => yes, 2 => force yes
|
||||||
|
useCross=0
|
||||||
|
|
||||||
for ARG in "$@"; do
|
for ARG in "$@"; do
|
||||||
case "$ARG" in
|
case "$ARG" in
|
||||||
|
@ -38,7 +40,7 @@ for ARG in "$@"; do
|
||||||
--wx28 ) flags+=(-DWX28_API=TRUE) ;;
|
--wx28 ) flags+=(-DWX28_API=TRUE) ;;
|
||||||
--gtk3 ) flags+=(-DGTK3_API=TRUE) ;;
|
--gtk3 ) flags+=(-DGTK3_API=TRUE) ;;
|
||||||
--no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;;
|
--no-simd ) flags+=(-DDISABLE_ADVANCE_SIMD=TRUE) ;;
|
||||||
--cross-multilib ) flags+=(-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake) ;;
|
--cross-multilib ) flags+=(-DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake); useCross=1; ;;
|
||||||
-D* ) flags+=($ARG) ;;
|
-D* ) flags+=($ARG) ;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -92,7 +94,11 @@ mkdir -p $build
|
||||||
cd $build
|
cd $build
|
||||||
|
|
||||||
if [[ "$useClang" -eq 1 ]]; then
|
if [[ "$useClang" -eq 1 ]]; then
|
||||||
CC=clang CXX=clang++ cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
if [[ "$useCross" -eq 0 ]]; then
|
||||||
|
CC=clang CXX=clang++ cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
||||||
|
else
|
||||||
|
CC="clang -m32" CXX="clang++ -m32" cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
cmake "${flags[@]}" $root 2>&1 | tee -a $log
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -64,6 +64,7 @@ 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.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -3,8 +3,10 @@ set(CMAKE_SYSTEM_NAME Darwin)
|
||||||
set(CMAKE_SYSTEM_PROCESSOR i686)
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||||
|
|
||||||
# Leave it generic since it could be clang, gnu, etc.
|
# Leave it generic since it could be clang, gnu, etc.
|
||||||
set(CMAKE_C_COMPILER cc -m32)
|
if("$ENV{CC}" STREQUAL "" OR "$ENV{CXX}" STREQUAL "")
|
||||||
set(CMAKE_CXX_COMPILER c++ -m32)
|
set(CMAKE_C_COMPILER cc -m32)
|
||||||
|
set(CMAKE_CXX_COMPILER c++ -m32)
|
||||||
|
endif()
|
||||||
|
|
||||||
# If given a CMAKE_FIND_ROOT_PATH then
|
# If given a CMAKE_FIND_ROOT_PATH then
|
||||||
# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run)
|
# FIND_PROGRAM ignores CMAKE_FIND_ROOT_PATH (probably can't run)
|
||||||
|
|
|
@ -4,8 +4,10 @@ set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||||
|
|
||||||
# It could be i?86-*linux-gnu, x86_64-*linux-gnu, x86_64-*linux-gnux32, etc.
|
# It could be i?86-*linux-gnu, x86_64-*linux-gnu, x86_64-*linux-gnux32, etc.
|
||||||
# Leave it generic to only support amd64 or x32 to i386 with any compiler.
|
# Leave it generic to only support amd64 or x32 to i386 with any compiler.
|
||||||
set(CMAKE_C_COMPILER cc -m32)
|
if("$ENV{CC}" STREQUAL "" OR "$ENV{CXX}" STREQUAL "")
|
||||||
set(CMAKE_CXX_COMPILER c++ -m32)
|
set(CMAKE_C_COMPILER cc -m32)
|
||||||
|
set(CMAKE_CXX_COMPILER c++ -m32)
|
||||||
|
endif()
|
||||||
|
|
||||||
# cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch.
|
# cmake 2.8.5 correctly sets CMAKE_LIBRARY_ARCHITECTURE for Debian multiarch.
|
||||||
# Be really strict about what gets used.
|
# Be really strict about what gets used.
|
||||||
|
|
Loading…
Reference in New Issue