CMakelist cleanup, might buildfix things on Linux Clang

This commit is contained in:
Henrik Rydgard 2017-03-16 10:16:29 +01:00
parent f4a0c4504f
commit 468d01eeff
2 changed files with 22 additions and 10 deletions

View File

@ -3,8 +3,10 @@ cmake_minimum_required(VERSION 3.6)
project(PPSSPP)
#This is supposed to work but doesn't!
#set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (NOT ANDROID)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif()
enable_language(ASM)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
@ -18,6 +20,11 @@ else()
add_definitions(-DNO_VULKAN)
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CLANG ON)
message("Clang enabled")
endif()
# Detect CPU from CMAKE configuration. Toolchains should set this up
if(CMAKE_SYSTEM_PROCESSOR)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
@ -171,12 +178,12 @@ endif()
if(ARM64)
message("Generating for ARMv8, ${CMAKE_BUILD_TYPE}")
endif()
message("hello")
if(NOT MSVC)
if (NOT ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -Wno-switch -Wno-uninitialized")
if (ANDROID)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif()
if (CLANG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-switch -Wno-uninitialized")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -D_DEBUG")
@ -200,11 +207,11 @@ if(NOT MSVC)
# Don't compile with strict aliasing, we're not 100% aliasing-safe
add_definitions(-fno-strict-aliasing)
if (CMAKE_C_COMPILER_ID STREQUAL "Intel")
if (${CMAKE_C_COMPILER_ID} STREQUAL "Intel")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -parallel -fopenmp")
endif()
if((X86 OR X86_64) AND NOT MIPS) # What's with the AND NOT MIPS?
if(X86 OR X86_64)
# enable sse2 code generation
add_definitions(-msse2)
endif()
@ -216,7 +223,8 @@ if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -stdlib=libc++ -U__STRICT_ANSI__")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
elseif(NOT ANDROID)
if (NOT CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
# TODO: See if we can get rid of no-psabi
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Intel" AND NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
add_definitions(-Wno-psabi)
endif()
add_definitions(-D_XOPEN_SOURCE=700)

4
b.sh
View File

@ -39,6 +39,10 @@ do
--no-package) echo "Packaging disabled"
PACKAGE=0
;;
--clang) echo "Clang enabled"
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
;;
--*) echo "Bad option: $1"
exit 1
;;