Skip to content

Commit

Permalink
CMakelist cleanup, might buildfix things on Linux Clang
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Mar 16, 2017
1 parent f4a0c45 commit 468d01e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
28 changes: 18 additions & 10 deletions CMakeLists.txt
Expand Up @@ -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)
Expand All @@ -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")
Expand Down Expand Up @@ -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")
Expand All @@ -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()
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions b.sh
Expand Up @@ -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
;;
Expand Down

0 comments on commit 468d01e

Please sign in to comment.