summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2015-08-28 21:55:22 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2015-09-09 00:35:11 +0200
commiteb26a1941edd76b11066fe3e013bdf060308a25b (patch)
treeae150cf0bdbd36557243972b2f4810b9d39ee6d0 /CMakeLists.txt
parentMerge pull request #1125 from yuriks/uilayout-config (diff)
downloadyuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.tar
yuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.tar.gz
yuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.tar.bz2
yuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.tar.lz
yuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.tar.xz
yuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.tar.zst
yuzu-eb26a1941edd76b11066fe3e013bdf060308a25b.zip
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt36
1 files changed, 31 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebffc0d85..967e7ff24 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,6 +2,23 @@
# dependent libraries.
cmake_minimum_required(VERSION 2.8.11)
+include(CheckSymbolExists)
+function(detect_architecture symbol arch)
+ if (NOT DEFINED ARCHITECTURE)
+ set(CMAKE_REQUIRED_QUIET 1)
+ check_symbol_exists("${symbol}" "" ARCHITECTURE_${arch})
+ unset(CMAKE_REQUIRED_QUIET)
+
+ # The output variable needs to be unique across invocations otherwise
+ # CMake's crazy scope rules will keep it defined
+ if (ARCHITECTURE_${arch})
+ set(ARCHITECTURE "${arch}" PARENT_SCOPE)
+ set(ARCHITECTURE_${arch} 1 PARENT_SCOPE)
+ add_definitions(-DARCHITECTURE_${arch}=1)
+ endif()
+ endif()
+endfunction()
+
project(citra)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
@@ -10,12 +27,21 @@ if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/pre-commit)
DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks)
endif()
-# Platform-agnostic definition to check if we are on x86_64
-if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "[xX]86_64" OR
- ${CMAKE_SYSTEM_PROCESSOR} MATCHES "[aA][mM][dD]64")
- set(ARCHITECTURE_x86_64 1)
- add_definitions(-DARCHITECTURE_x86_64=1)
+if (MSVC)
+ detect_architecture("_M_AMD64" x86_64)
+ detect_architecture("_M_IX86" x86)
+ detect_architecture("_M_ARM" ARM)
+else()
+ detect_architecture("__x86_64__" x86_64)
+ detect_architecture("__i386__" x86)
+ detect_architecture("__arm__" ARM)
+endif()
+if (NOT DEFINED ARCHITECTURE)
+ set(ARCHITECTURE "GENERIC")
+ set(ARCHITECTURE_GENERIC 1)
+ add_definitions(-DARCHITECTURE_GENERIC=1)
endif()
+message(STATUS "Target architecture: ${ARCHITECTURE}")
if (NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-attributes -pthread")