improved cmake file output dirs and package install dirs
This commit is contained in:
parent
6a3f1dc7a5
commit
eadbfe90fd
@ -5,7 +5,11 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
set(CMAKE_BUILD_TYPE Release) # manually set build type (Release / Debug)
|
||||
set(libmethod STATIC) #SHARED / STATIC
|
||||
set(WinBuild true)
|
||||
set(WinBuild false)
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
#set up toolchain
|
||||
|
||||
@ -82,11 +86,34 @@ target_link_libraries(iprefresher api logger ${CURL_LIBRARIES})
|
||||
|
||||
# INSTALL to SYSTEM #
|
||||
install(TARGETS iprefresher DESTINATION bin)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iprefresher.service DESTINATION lib/systemd/system)
|
||||
|
||||
pkg_check_modules(SYSTEMD "systemd")
|
||||
if (SYSTEMD_FOUND AND "${SYSTEMD_SERVICES_INSTALL_DIR}" STREQUAL "")
|
||||
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE}
|
||||
--variable=systemdsystemunitdir systemd
|
||||
OUTPUT_VARIABLE SYSTEMD_SERVICES_INSTALL_DIR)
|
||||
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SERVICES_INSTALL_DIR
|
||||
"${SYSTEMD_SERVICES_INSTALL_DIR}")
|
||||
elseif (NOT SYSTEMD_FOUND AND SYSTEMD_SERVICES_INSTALL_DIR)
|
||||
message (FATAL_ERROR "Variable SYSTEMD_SERVICES_INSTALL_DIR is\
|
||||
defined, but we can't find systemd using pkg-config")
|
||||
endif()
|
||||
|
||||
if (SYSTEMD_FOUND)
|
||||
set(WITH_SYSTEMD "ON")
|
||||
message(STATUS "systemd services install dir: ${SYSTEMD_SERVICES_INSTALL_DIR}")
|
||||
else()
|
||||
set(WITH_SYSTEMD "OFF")
|
||||
endif (SYSTEMD_FOUND)
|
||||
|
||||
#set(CMAKE_INSTALL_PREFIX /)
|
||||
message(STATUS ${CMAKE_BINARY_DIR})
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/iprefresher.service DESTINATION ${SYSTEMD_SERVICES_INSTALL_DIR})
|
||||
|
||||
|
||||
IF (UNIX)
|
||||
SET(CPACK_DEB_COMPONENT_INSTALL 1)
|
||||
SET(CPACK_OUTPUT_FILE_PREFIX packages)
|
||||
|
||||
FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild)
|
||||
FIND_PROGRAM(DEB_EXECUTABLE dpkg)
|
||||
|
65
README.md
65
README.md
@ -8,78 +8,21 @@ Download source files
|
||||
|
||||
cd into downloaded files and Generate makefiles:
|
||||
|
||||
`cmake .`
|
||||
`cmake -S . -B build`
|
||||
|
||||
compile project
|
||||
|
||||
`make`
|
||||
|
||||
install it to the system
|
||||
[root] install it to the system
|
||||
|
||||
`make install`
|
||||
|
||||
### Build a Debian package
|
||||
Download source files
|
||||
[root] or create Linux packages
|
||||
|
||||
`git clone https://github.com/Lukas-Heiligenbrunner/DynuIPRefresher.git`
|
||||
`make package`
|
||||
|
||||
rename Project folder to lower case:
|
||||
|
||||
`mv DynuIPRefresher iprefresher-1.0`
|
||||
|
||||
`cd iprefresher-1.0`
|
||||
|
||||
remove .idea folder because it´s useless in this case:
|
||||
|
||||
`rm -Rf .idea`
|
||||
|
||||
pack source in a tar.gz archive
|
||||
|
||||
`tar -zcvf iprefresher-1.0.tar.gz *`
|
||||
|
||||
create debian/ folder and create example config files
|
||||
|
||||
`dh_make -f iprefresher-1.0.tar.gz`
|
||||
|
||||
recently packed archive is useless now, delete it
|
||||
|
||||
`rm iprefresher-1.0.tar.gz`
|
||||
|
||||
move to debian/ folder:
|
||||
|
||||
`cd debian`
|
||||
|
||||
remove useless files:
|
||||
|
||||
`rm *.ex *.EX README.Debian README.source `
|
||||
|
||||
edit control file
|
||||
|
||||
`rm control`
|
||||
|
||||
`nano control`
|
||||
|
||||
```
|
||||
Source: iprefresher
|
||||
Section: net
|
||||
Priority: optional
|
||||
Maintainer: Lukas Heiligenbrunner <lukas@unknown>
|
||||
Build-Depends: debhelper (>= 10)
|
||||
Standards-Version: 4.1.2
|
||||
|
||||
Package: iprefresher
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: a dynu.net ip refresher written in c++
|
||||
a dynu.net ip refresher written in c++
|
||||
```
|
||||
return to main folder
|
||||
|
||||
`cd ..`
|
||||
|
||||
buld .deb package
|
||||
|
||||
`dpkg-buildpackage -us -uc `
|
||||
|
||||
### Windows cross build
|
||||
TODO!
|
||||
|
Loading…
Reference in New Issue
Block a user