forked from flukso/flm02
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
71 lines (60 loc) · 2.71 KB
/
CMakeLists.txt
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
# -*- mode: cmake; -*-
project(flm02)
cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
if(POLICY CMP0011)
cmake_policy(SET CMP0011 NEW)
endif(POLICY CMP0011)
if (NOT EXISTS "${CMAKE_SOURCE_DIR}/avr/b/rfm12/README.txt")
message(SEND_ERROR "RFM12 source seem to be missing. Make sure you ran
'git submodule init && git submodule update'
in your source directory")
endif()
file(STRINGS openwrt/package/msg-flukso/Makefile VERSION
REGEX "PKG_VERSION:=.*")
#VERSION=$(grep PKG_VERSION:= package/msg-flukso/Makefile | sed 's/.*:=[0-9]\.//')
message("=== Version: ${VERSION} ===")
string(REGEX REPLACE "PKG_VERSION:=([0-9]+).([0-9]+).([0-9]+)" "\\1" FLM02_MAJOR_VERSION ${VERSION})
string(REGEX REPLACE "PKG_VERSION:=([0-9]+).([0-9]+).([0-9]+)" "\\2" FLM02_MINOR_VERSION ${VERSION})
string(REGEX REPLACE "PKG_VERSION:=([0-9]+).([0-9]+).([0-9]+)" "\\3" FLM02_SUB_VERSION ${VERSION})
set(VERSION_SEP "-")
set(FLM02_SHORT_VERSION "${FLM02_MAJOR_VERSION}${VERSION_SEP}${FLM02_MINOR_VERSION}")
set(FLM02_VERSION "${FLM02_SHORT_VERSION}${VERSION_SEP}${FLM02_SUB_VERSION}")
set(FLM02_RPM_VERSION "${FLM02_MAJOR_VERSION}.${FLM02_MINOR_VERSION}.${FLM02_SUB_VERSION}")
set(VERSION_DATE "2011-12-15")
message("=== Version: ${FLM02_RPM_VERSION} ===")
###########################################################
# Where are the additional libraries installed? Note: provide includes
# path here, subsequent checks will resolve everything else
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules")
set(FLM_BUILD_DIR "flm02.${FLM02_MINOR_VERSION}.${FLM02_SUB_VERSION}/" CACHE FILEPATH "flm build directory")
set(FLM_FULL_BUILD_DIR "${CMAKE_BINARY_DIR}/${FLM_BUILD_DIR}" CACHE FILEPATH "flm build directory")
include(OpenWRTBuild)
openwrt_env(${FLM_BUILD_DIR})
#execute_process(
# COMMAND ${CMAKE_SOURCE_DIR}/openwrt/install_kk.sh ${CMAKE_BINARY_DIR}
# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/openwrt
#)
if (NOT ${CMAKE_BUILD_TYPE} MATCHES "Release")
message("Is not release. Modify opkg.conf")
set(_file_opkg_conf "${FLM_BUILD_DIR}/package/opkg/files/opkg.conf")
file(READ ${_file_opkg_conf} opkg_conf)
string(REGEX REPLACE "(.*)[\$]S/packages(.*)" "\\1$S/devel/packages\\2"
opkg_conf_new ${opkg_conf})
file(WRITE ${_file_opkg_conf} ${opkg_conf_new})
#message("==>${opkg_conf_new}<==")
endif (NOT ${CMAKE_BUILD_TYPE} MATCHES "Release")
add_custom_target(image ALL
BUILD_LOG=1 make
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${FLM_BUILD_DIR}/"
COMMENT ""
DEPENDS openwrt_update
)
add_custom_target(clean
BUILD_LOG=1 make clean
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/${FLM_BUILD_DIR}/"
COMMENT ""
)
### print some output for the user
message("")
message(" ***** Configuration parameters *****")
message(" prefix: ${CMAKE_INSTALL_PREFIX}")