CMake fix

This commit is contained in:
2021-08-28 15:22:34 +02:00
parent 8a1bc534e5
commit 6179fdee75
3 changed files with 126 additions and 0 deletions

View File

@@ -14,3 +14,6 @@ find_package(Boost COMPONENTS ${BOOST_LIBS} REQUIRED)
target_link_libraries(usbserial-dw ${Boost_LIBRARIES})
find_package(Threads REQUIRED)
target_link_libraries(usbserial-dw ${CMAKE_THREAD_LIBS_INIT})
## Install
install(TARGETS usbserial-dw DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@@ -56,6 +56,52 @@ CMAKE_BINARY_DIR = /home/jaro/serialport-downloader/build
#=============================================================================
# Targets provided globally by CMake.
# Special rule for the target install/strip
install/strip: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip
# Special rule for the target install/strip
install/strip/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing the project stripped..."
/usr/bin/cmake -DCMAKE_INSTALL_DO_STRIP=1 -P cmake_install.cmake
.PHONY : install/strip/fast
# Special rule for the target install/local
install/local: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local
# Special rule for the target install/local
install/local/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Installing only the local directory..."
/usr/bin/cmake -DCMAKE_INSTALL_LOCAL_ONLY=1 -P cmake_install.cmake
.PHONY : install/local/fast
# Special rule for the target install
install: preinstall
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install
# Special rule for the target install
install/fast: preinstall/fast
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Install the project..."
/usr/bin/cmake -P cmake_install.cmake
.PHONY : install/fast
# Special rule for the target list_install_components
list_install_components:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Available install components are: \"Unspecified\""
.PHONY : list_install_components
# Special rule for the target list_install_components
list_install_components/fast: list_install_components
.PHONY : list_install_components/fast
# Special rule for the target rebuild_cache
rebuild_cache:
@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
@@ -237,6 +283,10 @@ help:
@echo "... all (the default if no target is provided)"
@echo "... clean"
@echo "... depend"
@echo "... install/strip"
@echo "... install/local"
@echo "... install"
@echo "... list_install_components"
@echo "... rebuild_cache"
@echo "... edit_cache"
@echo "... usbserial-dw"

73
files/Makefile Normal file
View File

@@ -0,0 +1,73 @@
#
# Copyright (C) 2018-2021 skjaro
#
# This is free software, licensed under the GNU General Public License v3.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=usbserial-dw
PKG_VERSION:=0.1.0
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://git.bh.ttx.sk/jaro/usbserial-dw.git
PKG_MIRROR_HASH:=
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_SOURCE_VERSION)
CMAKE_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_LICENSE:=GPL-3.0
PKG_MAINTAINER:=SkJaro
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
TARGET_CXXFLAGS += -Wall -Wextra
TARGET_CXXFLAGS += $(FPIC)
# LTO
TARGET_CXXFLAGS += -flto
TARGET_LDFLAGS += -flto
# CXX standard
TARGET_CXXFLAGS += -std=c++11
TARGET_CXXFLAGS := $(filter-out -O%,$(TARGET_CXXFLAGS)) -O3
TARGET_CXXFLAGS += -ffunction-sections -fdata-sections
TARGET_LDFLAGS += -Wl,--gc-sections
CMAKE_OPTIONS += \
-DENABLE_MYSQL=OFF \
-DBoost_DEBUG=ON \
-DBoost_NO_BOOST_CMAKE=ON
define Package/usbserial-dw
SECTION:=net
CATEGORY:=Network
TITLE:=Little program for downloading camera and temprature from usbserial
URL:=https://git.bh.ttx.sk/jaro/usbserial-dw.git
DEPENDS:=+libpthread +libstdcpp \
+boost +boost-system +boost-program_options +boost-date_time +boost-log
endef
define Package/usbserial-dw/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/usbserial-dw $(1)/usr/bin/usbserial-dw
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./files/usbserial-dw.config $(1)/etc/config/
endef
define Package/usbserial-dw/conffiles
/etc/config/usbserial-dw
endef
$(eval $(call BuildPackage,usbserial-dw))