-
Notifications
You must be signed in to change notification settings - Fork 6
/
config.cmake
79 lines (68 loc) · 4.13 KB
/
config.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
SET(CMAKE_SYSTEM_NAME Linux)
#message("SDK-473/config.cmake start")
#message ("CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}")
#message ("CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")
#message ("CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}")
#message ("CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}")
#message ("PB_SDK_CFG=$ENV{PB_SDK_CFG}")
set (sdk_cfg $ENV{PB_SDK_CFG})
if (sdk_cfg)
exec_program ("dirname ${sdk_cfg}" OUTPUT_VARIABLE PB_TOOLCHAIN_PATH)
message("sdk_cfg=${sdk_cfg} PB_TOOLCHAIN_PATH=${PB_TOOLCHAIN_PATH}")
else()
message(ERROR "PB_SDK_CFG must be defined")
endif()
#set(PB_TOOLCHAIN_PATH "/srv/build/EP.515-experimental/SDK-481/")
set(TOOLCHAIN_PATH ${PB_TOOLCHAIN_PATH})
if (TARGET_TYPE STREQUAL "Arm")
set (TARGET_TYPE "ARM")
endif()
if (TARGET_TYPE STREQUAL "arm")
set (TARGET_TYPE "ARM")
endif()
IF (TARGET_TYPE STREQUAL "ARM")
set(PB_TOOLCHAIN_PREFIX "arm-obreey-linux-gnueabi")
set(TOOLCHAIN_PREFIX ${PB_TOOLCHAIN_PREFIX})
SET (CMAKE_INSTALL_PREFIX "${TOOLCHAIN_PATH}/${TOOLCHAIN_PREFIX}/sysroot/usr/local" CACHE PATH "Install path prefix" FORCE)
INCLUDE_DIRECTORIES (${CMAKE_INSTALL_PREFIX}/include ${TOOLCHAIN_PATH}/${TOOLCHAIN_PREFIX}/sysroot/usr/include)
LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${TOOLCHAIN_PATH}/${TOOLCHAIN_PREFIX}/sysroot/usr/lib)
SET (CMAKE_C_COMPILER ${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc)
message ("_CMAKE_C_COMPILER=${CMAKE_C_COMPILER}")
SET (CMAKE_CXX_COMPILER ${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-g++)
SET (CMAKE_ASM_COMPILER ${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-gcc)
SET (PB_STRIP ${PB_TOOLCHAIN_PATH}/bin/${PB_TOOLCHAIN_PREFIX}-strip)
SET (CMAKE_ARR ${TOOLCHAIN_PATH}/bin/${TOOLCHAIN_PREFIX}-arr)
SET (CMAKE_STRIP ${PB_STRIP})
SET (PB_QT_XPLATFORM "linux-arm-obreey-linux-gnueabi-g++")
SET (GENERAL_FLAGS "-mcpu=cortex-a8 -march=armv7-a -mfpu=neon -mfloat-abi=softfp")
SET (CMAKE_C_FLAGS "${GENERAL_FLAGS}" CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS "${GENERAL_FLAGS}" CACHE STRING "" FORCE)
SET (CMAKE_C_FLAGS_RELEASE "${GENERAL_FLAGS} -DNDEBUG -s -fsigned-char -fomit-frame-pointer -fPIC -Wall -O2 -Wno-format-y2k " CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS_RELEASE "${GENERAL_FLAGS} -DNDEBUG -s -fsigned-char -fomit-frame-pointer -fPIC -Wall -O2 -Wno-format-y2k " CACHE STRING "" FORCE)
SET (CMAKE_C_FLAGS_DEBUG "${GENERAL_FLAGS} -DDEBUG -W -Wall -Wextra -O0 -g3 -rdynamic -fdiagnostics-show-option -fstack-protector-all -fsigned-char -fomit-frame-pointer " CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS_DEBUG "${GENERAL_FLAGS} -DDEBUG -W -Wall -Wextra -O0 -g3 -rdynamic -fdiagnostics-show-option -fstack-protector-all -fsigned-char -fomit-frame-pointer" CACHE STRING "" FORCE)
message (STATUS CMAKE_C_COMPILER = ${CMAKE_C_COMPILER})
EXEC_PROGRAM("${CMAKE_C_COMPILER} -v 2>&1|grep Target:" OUTPUT_VARIABLE target)
message (STATUS ${target})
ELSE()
set(PB_TOOLCHAIN_PREFIX "")
set(TOOLCHAIN_PREFIX ${PB_TOOLCHAIN_PREFIX})
SET (CMAKE_INSTALL_PREFIX "${TOOLCHAIN_PATH}/local" CACHE PATH "Install path prefix" FORCE)
# проверить наличие необходимых пакетов
FIND_PACKAGE (Freetype REQUIRED)
INCLUDE_DIRECTORIES (${CMAKE_INSTALL_PREFIX}/include ${TOOLCHAIN_PATH}/include ${FREETYPE_INCLUDE_DIRS})
LINK_DIRECTORIES(${CMAKE_INSTALL_PREFIX}/lib ${TOOLCHAIN_PATH}/lib)
SET (GENERAL_FLAGS "-Wall -Wextra -rdynamic -fsigned-char -fomit-frame-pointer")
IF (TARGET_TYPE STREQUAL "Windows")
SET (GENERAL_FLAGS "${GENERAL_FLAGS} -DIVSAAP")
ELSE()
SET (GENERAL_FLAGS "${GENERAL_FLAGS} -DEMULATOR")
ENDIF(TARGET_TYPE STREQUAL "Windows")
SET (CMAKE_C_FLAGS "${GENERAL_FLAGS}" CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS "${GENERAL_FLAGS}" CACHE STRING "" FORCE)
SET (CMAKE_C_FLAGS_DEBUG "-DDEBUG -W ${GENERAL_FLAGS} -O0 -g3 -fdiagnostics-show-option -fstack-protector-all " CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS_DEBUG "-DDEBUG -W ${GENERAL_FLAGS} -O0 -g3 -fdiagnostics-show-option -fstack-protector-all" CACHE STRING "" FORCE)
SET (CMAKE_C_FLAGS_RELEASE "-DNDEBUG -s ${GENERAL_FLAGS} -O2 " CACHE STRING "" FORCE)
SET (CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG -s ${GENERAL_FLAGS} -O2 " CACHE STRING "" FORCE)
ENDIF()
#message("SDK-473/config.cmake end")