platform.inc 3.1 KB
Newer Older
S
[TD-58]  
slguan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)

#
# If it is a Windows operating system
#   1.Use command line tool of VS2013 or higher version
#     mkdir build; cd build;
#     cmake -G "NMake Makefiles" ..
#     nmake install
#   2.Use the VS development interface tool
#     mkdir build; cd build;
#     cmake -A x64 ..
#     open the file named TDengine.sln
#

# Set macro definitions according to os platform
S
Shengliang Guan 已提交
17
SET(TD_LINUX FALSE)
S
[TD-58]  
slguan 已提交
18 19 20 21 22 23 24 25
SET(TD_LINUX_64 FALSE)
SET(TD_LINUX_32 FALSE)
SET(TD_ARM FALSE)
SET(TD_ARM_64 FALSE)
SET(TD_ARM_32 FALSE)
SET(TD_MIPS FALSE)
SET(TD_MIPS_64 FALSE)
SET(TD_MIPS_32 FALSE)
S
Shengliang Guan 已提交
26
SET(TD_WINDOWS FALSE)
S
[TD-58]  
slguan 已提交
27
SET(TD_WINDOWS_64 FALSE)
S
Shengliang Guan 已提交
28 29 30
SET(TD_WINDOWS_32 FALSE)
SET(TD_DARWIN_64 FALSE)
SET(TD_APLHINE FALSE)
S
[TD-58]  
slguan 已提交
31 32 33 34 35 36 37

# if generate ARM version:
#   cmake -DCPUTYPE=aarch32 .. or cmake -DCPUTYPE=aarch64
IF (${CPUTYPE} MATCHES "aarch32")
  SET(TD_ARM TRUE)
  SET(TD_ARM_32 TRUE)
  SET(TD_PAGMODE_LITE TRUE)
S
Shengliang Guan 已提交
38
  MESSAGE(STATUS "input cpuType: aarch32")
S
[TD-58]  
slguan 已提交
39 40 41
ELSEIF (${CPUTYPE} MATCHES "aarch64")
  SET(TD_ARM TRUE)
  SET(TD_ARM_64 TRUE)
S
Shengliang Guan 已提交
42
  MESSAGE(STATUS "input cpuType: aarch64")
S
[TD-58]  
slguan 已提交
43 44 45
ELSEIF (${CPUTYPE} MATCHES "mips64")
  SET(TD_MIPS TRUE)
  SET(TD_MIPS_64 TRUE)
S
Shengliang Guan 已提交
46
  MESSAGE(STATUS "input cpuType: mips64")
S
[TD-58]  
slguan 已提交
47
ELSEIF (${CPUTYPE} MATCHES "x64")
S
Shengliang Guan 已提交
48
  MESSAGE(STATUS "input cpuType: x64")
S
[TD-58]  
slguan 已提交
49
ELSEIF (${CPUTYPE} MATCHES "x86")
S
Shengliang Guan 已提交
50
  MESSAGE(STATUS "input cpuType: x86")
S
[TD-58]  
slguan 已提交
51
ELSE ()
S
Shengliang Guan 已提交
52
  MESSAGE(STATUS "input cpuType unknown " ${CPUTYPE})
S
[TD-58]  
slguan 已提交
53 54 55 56 57 58 59 60 61 62
ENDIF ()

#
# Get OS information and store in variable TD_OS_INFO.
#
execute_process(COMMAND chmod 777 ${TD_COMMUNITY_DIR}/packaging/tools/get_os.sh)
execute_process(COMMAND ${TD_COMMUNITY_DIR}/packaging/tools/get_os.sh "" OUTPUT_VARIABLE TD_OS_INFO)
MESSAGE(STATUS "The current os is " ${TD_OS_INFO})

IF (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
S
Shengliang Guan 已提交
63
  SET(TD_LINUX TRUE)
S
[TD-58]  
slguan 已提交
64 65 66 67
  IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
    SET(TD_LINUX_64 TRUE)
    MESSAGE(STATUS "The current platform is Linux 64-bit")
  ELSEIF (${CMAKE_SIZEOF_VOID_P} MATCHES 4)
S
Shengliang Guan 已提交
68
    SET(TD_LINUX_32 TRUE)
S
[TD-58]  
slguan 已提交
69 70 71 72 73 74 75 76 77 78
    IF (TD_ARM)
      MESSAGE(STATUS "The current platform is Linux 32-bit")
    ELSE ()
      MESSAGE(FATAL_ERROR "The current platform is Linux 32-bit, but no ARM not supported yet")
      EXIT ()
    ENDIF ()
  ELSE ()
    MESSAGE(FATAL_ERROR "The current platform is Linux neither 32-bit nor 64-bit, not supported yet")
    EXIT ()
  ENDIF ()
S
Shengliang Guan 已提交
79 80 81 82 83

  IF (${TD_OS_INFO} MATCHES "Alpine")
    SET(TD_APLHINE TRUE)
    MESSAGE(STATUS "The current OS is Alpine, append extra flags")
  ENDIF()
S
[TD-58]  
slguan 已提交
84 85 86 87 88 89 90 91 92
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
    SET(TD_DARWIN_64 TRUE)
    MESSAGE(STATUS "The current platform is Darwin 64-bit")
  ELSE ()
    MESSAGE(FATAL_ERROR "The current platform is Darwin 32-bit, not supported yet")
    EXIT ()
  ENDIF ()
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
S
Shengliang Guan 已提交
93
  SET(TD_WINDOWS TRUE)
S
[TD-58]  
slguan 已提交
94 95 96 97
  IF (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
    SET(TD_WINDOWS_64 TRUE)
    MESSAGE(STATUS "The current platform is Windows 64-bit")
  ELSE ()
S
Shengliang Guan 已提交
98
    SET(TD_WINDOWS_32 TRUE)
S
[TD-58]  
slguan 已提交
99 100 101 102 103 104 105
    MESSAGE(FATAL_ERROR "The current platform is Windows 32-bit, not supported yet")
    EXIT ()
  ENDIF ()
ELSE()
  MESSAGE(FATAL_ERROR "The current platform is not Linux/Darwin/Windows, stop compile")
  EXIT ()
ENDIF ()