Optimize samples build process and build 64 bit binaries by default (#90)
* Optimize samples build process * Samples: build 64 bit version by default
This commit is contained in:
@ -17,36 +17,32 @@ message ("lvgl_native_ui_app...")
|
||||
project (lvgl_native_ui_app)
|
||||
|
||||
#################################################################
|
||||
#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -g)
|
||||
|
||||
set(lv_name lvgl)
|
||||
set(lv_drivers_name lv_drivers)
|
||||
set(LVGL_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${lv_name})
|
||||
set(LVGL_DRIVER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${lv_drivers_name})
|
||||
# Currently build as 64-bit by default. Set to "NO" to build 32-bit binaries.
|
||||
set (BUILD_AS_64BIT_SUPPORT "YES")
|
||||
|
||||
if ((NOT EXISTS ${LVGL_SOURCE_DIR}) OR (NOT EXISTS ${LVGL_DRIVER_DIR}))
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt.in ${CMAKE_CURRENT_BINARY_DIR}/download_lvgl/CMakeLists.txt)
|
||||
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
if (${BUILD_AS_64BIT_SUPPORT} STREQUAL "YES")
|
||||
# Add -fPIC flag if build as 64-bit
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
||||
set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_C_FLAGS} -fPIC")
|
||||
else ()
|
||||
add_definitions (-m32)
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/download_lvgl )
|
||||
if(result)
|
||||
message(FATAL_ERROR "CMake step for lvgl failed: ${result}")
|
||||
endif()
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} --build .
|
||||
RESULT_VARIABLE result
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/download_lvgl )
|
||||
if(result)
|
||||
message(FATAL_ERROR "Build step for lvgl failed: ${result}")
|
||||
endif()
|
||||
endif()
|
||||
set(THIRDPARTY_DIR ../../../core/iwasm/lib/3rdparty)
|
||||
set(LVGL_SOURCE_DIR ${THIRDPARTY_DIR}/lvgl)
|
||||
set(LVGL_DRIVER_DIR ${THIRDPARTY_DIR}/lv_drivers)
|
||||
|
||||
#################################
|
||||
set(CMAKE_C_STANDARD 11)#C11
|
||||
set(CMAKE_CXX_STANDARD 17)#C17
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||||
INCLUDE_DIRECTORIES(${THIRDPARTY_DIR})
|
||||
|
||||
add_definitions (-DLV_CONF_INCLUDE_SIMPLE)
|
||||
|
||||
file(GLOB_RECURSE INCLUDES "${LVGL_DRIVER_DIR}/*.h" "${LVGL_SOURCE_DIR}/*.h" "./*.h" )
|
||||
file(GLOB_RECURSE SOURCES "${LVGL_DRIVER_DIR}/*.c" "${LVGL_SOURCE_DIR}/*.c" )
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.2)
|
||||
|
||||
project(lvgl_download NONE)
|
||||
|
||||
include(ExternalProject)
|
||||
ExternalProject_Add(${lv_name}
|
||||
GIT_REPOSITORY https://github.com/littlevgl/lvgl.git
|
||||
GIT_TAG "v6.0"
|
||||
BINARY_DIR ""
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${lv_name}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
|
||||
ExternalProject_Add(${lv_drivers_name}
|
||||
GIT_REPOSITORY https://github.com/littlevgl/lv_drivers.git
|
||||
GIT_TAG ""
|
||||
BINARY_DIR ""
|
||||
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${lv_drivers_name}"
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
TEST_COMMAND ""
|
||||
)
|
||||
Reference in New Issue
Block a user