Skip to content

Commit

Permalink
Updated build settings
Browse files Browse the repository at this point in the history
- Removed unneeded commands in travis.sh
- Removed -Wno-dev flag in Release target
- cmake: Grouped udev and modprobe.d config
- rpm package now relocatable (CPackRPM)
  • Loading branch information
Nightwalker-87 committed May 18, 2020
1 parent 97d3173 commit 1b3200d
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 20 deletions.
6 changes: 3 additions & 3 deletions .travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ elif [ "$TRAVIS_OS_NAME" == "linux" ]; then
mkdir -p build/Debug && cd build/Debug
echo "-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install"
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install $DIR
make && make package && cd -
make && cd -

echo "--> Building Release..."
mkdir -p build/Release && cd build/Release
Expand All @@ -48,7 +48,7 @@ elif [ "$TRAVIS_OS_NAME" == "osx" ]; then
mkdir -p build/Debug && cd build/Debug
echo "-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install"
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install $DIR
make && make package && cd -
make && cd -

echo "--> Building Release..."
mkdir -p build/Release && cd build/Release
Expand All @@ -61,7 +61,7 @@ else # local test-build
mkdir -p build/Debug && cd build/Debug
echo "-DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install"
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$PWD/install ../../
make && make package && cd -
make && cd -

echo "--> Building Release..."
mkdir -p build/Release && cd build/Release
Expand Down
36 changes: 21 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@ project(stlink C)
set(PROJECT_DESCRIPTION "Open source version of the STMicroelectronics ST-LINK Tools")
include(GNUInstallDirs) # Define GNU standard installation directories

set(STLINK_UDEV_RULES_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/udev/rules.d" CACHE PATH "udev rules directory")
option(STLINK_INSTALL_UDEV_RULES "Install udev rules files" ON)

set(STLINK_MODPROBED_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/modprobe.d" CACHE PATH "modprobe.d directory")
option(STLINK_INSTALL_MODPROBE_CONF "Install modprobe conf files" ON)

option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF)

## Determine project version
include(${CMAKE_MODULE_PATH}/get_version.cmake)

Expand Down Expand Up @@ -271,20 +263,32 @@ else ()
target_link_libraries(st-util ${STLINK_LIB_SHARED} ${SSP_LIB})
endif ()

install(TARGETS st-flash DESTINATION bin)
install(TARGETS st-info DESTINATION bin)
install(TARGETS st-util DESTINATION bin)


###
# udev and modprobe.d configuration
###

if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
## modprobe.d rules
set(STLINK_MODPROBED_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/modprobe.d" CACHE PATH "modprobe.d directory")
option(STLINK_INSTALL_MODPROBE_CONF "Install modprobe conf files" ON)
if (STLINK_INSTALL_MODPROBE_CONF)
install(FILES etc/modprobe.d/stlink_v1.conf DESTINATION ${STLINK_MODPROBED_DIR}/)
install(FILES ${CMAKE_SOURCE_DIR}/etc/modprobe.d/stlink_v1.conf DESTINATION ${STLINK_MODPROBED_DIR}/)
endif ()

## udev rules
set(STLINK_UDEV_RULES_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/udev/rules.d" CACHE PATH "udev rules directory")
option(STLINK_INSTALL_UDEV_RULES "Install udev rules files" ON)
if (STLINK_INSTALL_UDEV_RULES)
file(GLOB RULES_FILES etc/udev/rules.d/*.rules)
file(GLOB RULES_FILES ${CMAKE_SOURCE_DIR}/etc/udev/rules.d/*.rules)
install(FILES ${RULES_FILES} DESTINATION ${STLINK_UDEV_RULES_DIR}/)
endif ()
endif ()

install(TARGETS st-flash DESTINATION bin)
install(TARGETS st-info DESTINATION bin)
install(TARGETS st-util DESTINATION bin)


###
# Additional build tasks
Expand All @@ -297,9 +301,11 @@ add_subdirectory(include) # contains subordinate CMakeLists for version config a

add_subdirectory(src/stlink-gui) # contains subordinate CMakeLists to build GUI
add_subdirectory(tests) # contains subordinate CMakeLists to build test executables
add_subdirectory(doc/man) # contains subordinate CMakeLists to generate manpages
add_subdirectory(cmake/packaging) # contains subordinate CMakeLists to build packages

option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF)
add_subdirectory(doc/man) # contains subordinate CMakeLists to generate manpages


###
# Uninstall target
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ build/Debug:

build/Release:
@mkdir -p $@
@cd $@ && cmake -DCMAKE_BUILD_TYPE=Release $(CMAKEFLAGS) -Wno-dev ../../
@cd $@ && cmake -DCMAKE_BUILD_TYPE=Release $(CMAKEFLAGS) ../../

clean:
@echo "[CLEAN]"
Expand Down
2 changes: 1 addition & 1 deletion doc/man/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ foreach (manpage ${MANPAGES})
endif ()

if (f AND NOT WIN32)
install(FILES ${f} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
install(FILES ${f} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
unset(f)
endif ()
endforeach ()

0 comments on commit 1b3200d

Please sign in to comment.