diff --git a/CMakeLists.txt b/CMakeLists.txt index eac2ccf..bdf71a9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) \ No newline at end of file diff --git a/build/Makefile b/build/Makefile index d0bacf3..f6e94dd 100644 --- a/build/Makefile +++ b/build/Makefile @@ -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" diff --git a/files/Makefile b/files/Makefile new file mode 100644 index 0000000..b061044 --- /dev/null +++ b/files/Makefile @@ -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)) \ No newline at end of file