-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMakeLists.txt: Add shared library build and debian packaging
Signed-off-by: Andrew Andrianov <andrew@ncrmnt.org>
- Loading branch information
Showing
19 changed files
with
239 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
libstlink (1.2.1) unstable; urgency=low | ||
|
||
* Initial Debian-Packaged Release. | ||
|
||
-- Andrew 'Necromant' Andrianov <andrew@ncrmnt.org> Sat, 09 Jul 2016 23:16:07 +0300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
Source: libstlink | ||
Priority: optional | ||
Maintainer: Andrew 'Necromant' Andrianov <andrew@ncrmnt.org> | ||
Build-Depends: debhelper (>= 9), cmake, libusb-1.0-0-dev, libgtk-3-dev | ||
Standards-Version: 3.9.5 | ||
Section: libs | ||
Homepage: <insert the upstream URL, if relevant> | ||
Vcs-Git: https://github.com/texane/stlink.git | ||
Vcs-Browser: https://github.com/texane/stlink | ||
|
||
Package: libstlink-dev | ||
Section: libdevel | ||
Architecture: any | ||
Depends: libstlink (= ${binary:Version}), ${misc:Depends} | ||
Description: OpenSource ST-Link tools replacement. Development headers. | ||
This package contains development headers for libstlink. | ||
|
||
Package: libstlink | ||
Architecture: any | ||
Depends: ${shlibs:Depends}, ${misc:Depends} | ||
Description: OpenSource ST-Link tools replacement. Shared library. | ||
This package libstlink shared library. | ||
|
||
Package: stlink-tools | ||
Section: libdevel | ||
Architecture: any | ||
Depends: libstlink (= ${binary:Version}), ${misc:Depends} | ||
Description: OpenSource ST-Link tools replacement. Commandline Utilities. | ||
|
||
Package: stlink-gui | ||
Section: libdevel | ||
Architecture: any | ||
Depends: libstlink (= ${binary:Version}), ${misc:Depends} | ||
Description: OpenSource ST-Link tools replacement. GUI Tool. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
usr/lib | ||
usr/include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
usr/include/* | ||
usr/lib/*/lib*.a | ||
usr/lib/*/pkgconfig/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
usr/lib |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
usr/lib/*/lib*.so* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/make -f | ||
# See debhelper(7) (uncomment to enable) | ||
# output every command that modifies files on the build system. | ||
#DH_VERBOSE = 1 | ||
|
||
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/* | ||
DPKG_EXPORT_BUILDFLAGS = 1 | ||
include /usr/share/dpkg/default.mk | ||
|
||
# see FEATURE AREAS in dpkg-buildflags(1) | ||
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all | ||
|
||
# see ENVIRONMENT in dpkg-buildflags(1) | ||
# package maintainers to append CFLAGS | ||
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic | ||
# package maintainers to append LDFLAGS | ||
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed | ||
|
||
|
||
# main packaging script based on dh7 syntax | ||
%: | ||
dh $@ | ||
|
||
# debmake generated override targets | ||
# This is example for Cmake (See http://bugs.debian.org/641051 ) | ||
override_dh_auto_configure: | ||
dh_auto_configure -- \ | ||
-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (native) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/usr/bin | ||
/usr/share/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/usr/bin/stlink-gui* | ||
/usr/share/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/usr/bin | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/usr/bin/st-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Warning: This example assumes that you are building on a host | ||
# with pkg-config available (e.g. linux). The logic required to | ||
# build under windows/mingw and/or mac was intentionally omitted | ||
# to keep this CMakeLists as small as possible | ||
|
||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(st-hello) | ||
set(PROJECT_VERSION 0.1) | ||
set(SRCS main.c) | ||
|
||
find_package(PkgConfig) | ||
pkg_check_modules(STLINK REQUIRED stlink) | ||
|
||
set(CMAKE_C_FLAGS " ${STLINK_CFLAGS_OTHER} -Wall -Werror") | ||
|
||
include_directories( | ||
${STLINK_INCLUDE_DIRS} | ||
) | ||
|
||
add_executable(${PROJECT_NAME} ${SRCS}) | ||
|
||
target_link_libraries(${PROJECT_NAME} | ||
${STLINK_LIBRARIES} | ||
) | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
DESTINATION bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This is a simple standalone application example that uses libstlink. | ||
You can use this as a boilerplate for your own app development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stlink.h> | ||
|
||
static stlink_t *stlink_open_first(void) | ||
{ | ||
stlink_t* sl = NULL; | ||
sl = stlink_v1_open(0, 1); | ||
if (sl == NULL) | ||
sl = stlink_open_usb(0, 1, NULL); | ||
|
||
return sl; | ||
} | ||
|
||
|
||
int main() | ||
{ | ||
stlink_t* sl = NULL; | ||
sl = stlink_open_first(); | ||
|
||
if (sl == NULL) { | ||
fprintf(stderr, "Failed to open stlink device ;(\n"); | ||
exit(1); | ||
} | ||
|
||
fprintf(stderr, "STlink device opened, that's cool!\n"); | ||
stlink_close(sl); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
deb_host_multiarch=${CMAKE_LIBRARY_PATH} | ||
Name: ${PROJECT_NAME} | ||
Description: ${PROJECT_DESCRIPTION} | ||
Version: ${PROJECT_VERSION} | ||
Requires: ${PKG_CONFIG_REQUIRES} | ||
prefix=${CMAKE_INSTALL_PREFIX} | ||
includedir=${PKG_CONFIG_INCLUDEDIR} | ||
libdir=${PKG_CONFIG_LIBDIR} | ||
Libs: ${PKG_CONFIG_LIBS} | ||
Cflags: ${PKG_CONFIG_CFLAGS} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
# Run this hacky script in project root directory to start | ||
# clang static analysis. Adjust ccc-analyzer path if nesesary | ||
CCC_ANALYZER=/usr/share/clang/scan-build-3.5/ccc-analyzer | ||
mkdir -p build-clang-analyze/reports | ||
cd build-clang-analyze | ||
cmake -DCMAKE_C_COMPILER=${CCC_ANALYZER} $* .. | ||
scan-build -o ./reports --keep-empty make |