1################################################################################
2##
3## The University of Illinois/NCSA
4## Open Source License (NCSA)
5##
6## Copyright (c) 2014-2016, Advanced Micro Devices, Inc. All rights reserved.
7##
8## Developed by:
9##
10##                 AMD Research and AMD HSA Software Development
11##
12##                 Advanced Micro Devices, Inc.
13##
14##                 www.amd.com
15##
16## Permission is hereby granted, free of charge, to any person obtaining a copy
17## of this software and associated documentation files (the "Software"), to
18## deal with the Software without restriction, including without limitation
19## the rights to use, copy, modify, merge, publish, distribute, sublicense,
20## and#or sell copies of the Software, and to permit persons to whom the
21## Software is furnished to do so, subject to the following conditions:
22##
23##  - Redistributions of source code must retain the above copyright notice,
24##    this list of conditions and the following disclaimers.
25##  - Redistributions in binary form must reproduce the above copyright
26##    notice, this list of conditions and the following disclaimers in
27##    the documentation and#or other materials provided with the distribution.
28##  - Neither the names of Advanced Micro Devices, Inc,
29##    nor the names of its contributors may be used to endorse or promote
30##    products derived from this Software without specific prior written
31##    permission.
32##
33## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36## THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
37## OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
38## ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
39## DEALINGS WITH THE SOFTWARE.
40##
41################################################################################
42
43#
44# HSA Build compiler definitions common between components.
45#
46
47set(IS64BIT 0)
48set(ONLY64STR "32")
49if(CMAKE_SIZEOF_VOID_P EQUAL 8)
50  set(IS64BIT 1)
51  set(ONLY64STR "64")
52endif()
53
54if(UNIX)
55  set(PS ":")
56  set(CMAKE_CXX_FLAGS "-Wall -std=c++11 ${EXTRA_CFLAGS}")
57  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpic")
58  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--unresolved-symbols=ignore-in-shared-libs")
59  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
60  if ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" )
61    set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64  -msse -msse2" )
62  elseif ( CMAKE_SYSTEM_PROCESSOR STREQUAL "x86" )
63    set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32" )
64  endif ()
65  if ( "${CMAKE_BUILD_TYPE}" STREQUAL Debug )
66    set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb" )
67  endif ()
68  add_definitions(-D __STDC_LIMIT_MACROS)
69  add_definitions(-D __STDC_CONSTANT_MACROS)
70  add_definitions(-D __STDC_FORMAT_MACROS)
71  add_definitions (-DLITTLEENDIAN_CPU=1)
72else()
73  set (PS "\;")
74endif()
75
76if(MSVC)
77  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
78  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
79endif()
80