Partial project restructuring
- Updated travis CI build config - Refactoring of cmake build config - Alligned coding style for GUI - Whitespace cleanup for GUI - Moved source code for GUIpull/935/head
13
.travis.sh
|
@ -24,13 +24,12 @@ if [ "$TRAVIS_OS_NAME" == "linux" ]; then
|
|||
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$PWD/_install ../../
|
||||
make && make package && cd -
|
||||
|
||||
echo "--> Building Binary..."
|
||||
mkdir -p build/Binary && cd build/Binary
|
||||
cho "-DCMAKE_BUILD_TYPE=Binary -DCMAKE_INSTALL_PREFIX=$PWD/_install"
|
||||
cmake -DCMAKE_BUILD_TYPE=Binary -DCMAKE_TOOLCHAIN_FILE=./cmake/linux-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$PWD/_install ../../
|
||||
make && make package && cd -
|
||||
|
||||
else #("$TRAVIS_OS_NAME" == "osx")
|
||||
# echo "--> Building Binary..."
|
||||
# mkdir -p build/Binary && cd build/Binary
|
||||
# cho "-DCMAKE_BUILD_TYPE=Binary -DCMAKE_INSTALL_PREFIX=$PWD/_install"
|
||||
# cmake -DCMAKE_BUILD_TYPE=Binary -DCMAKE_TOOLCHAIN_FILE=./cmake/linux-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$PWD/_install ../../
|
||||
# make && make package && cd -
|
||||
else [ "$TRAVIS_OS_NAME" == "osx" ];
|
||||
brew install libusb
|
||||
|
||||
echo "--> Building Debug..."
|
||||
|
|
30
.travis.yml
|
@ -38,14 +38,14 @@ matrix:
|
|||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-bionic-6.0']
|
||||
packages: ['clang-6.0', 'libusb-1.0.0-dev']
|
||||
- os: linux
|
||||
arch: x64
|
||||
compiler: clang-6.0
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-bionic-6.0']
|
||||
packages: ['clang-6.0', 'libusb-1.0.0-dev']
|
||||
env: CFLAGS=-m32 LDFLAGS=-m32
|
||||
# - os: linux
|
||||
# arch: x64
|
||||
# compiler: clang-6.0
|
||||
# addons:
|
||||
# apt:
|
||||
# sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-bionic-6.0']
|
||||
# packages: ['clang-6.0', 'libusb-1.0.0-dev']
|
||||
# env: CFLAGS=-m32 LDFLAGS=-m32
|
||||
|
||||
### 32-bit builds ###
|
||||
- os: linux
|
||||
|
@ -55,13 +55,6 @@ matrix:
|
|||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['gcc-5', 'libusb-1.0.0-dev']
|
||||
- os: linux
|
||||
arch: x86
|
||||
compiler: gcc-6
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['gcc-6', 'libusb-1.0.0-dev']
|
||||
- os: linux
|
||||
arch: x86
|
||||
compiler: gcc-7
|
||||
|
@ -69,6 +62,13 @@ matrix:
|
|||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['gcc-7', 'libusb-1.0.0-dev']
|
||||
- os: linux
|
||||
arch: x86
|
||||
compiler: gcc-9
|
||||
addons:
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['gcc-9', 'libusb-1.0.0-dev']
|
||||
- os: linux
|
||||
arch: x86
|
||||
compiler: clang-3.7
|
||||
|
|
|
@ -1,16 +1,24 @@
|
|||
cmake_minimum_required(VERSION 3.4.2)
|
||||
set(CMAKE_USER_MAKE_RULES_OVERRIDE cmake/c_flag_overrides.cmake)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules")
|
||||
include(GNUInstallDirs)
|
||||
|
||||
project(stlink C)
|
||||
set(PROJECT_DESCRIPTION "Open source version of the STMicroelectronics ST-LINK Tools")
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(STLINK_UDEV_RULES_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/udev/rules.d" CACHE PATH "udev rules directory")
|
||||
set(STLINK_MODPROBED_DIR "${CMAKE_INSTALL_FULL_SYSCONFDIR}/modprobe.d" CACHE PATH "modprobe.d directory")
|
||||
set(STLINK_STATIC_LIB ON CACHE BOOL "Install static lib")
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
option(STLINK_INSTALL_UDEV_RULES "Install udev rules files" ON)
|
||||
option(STLINK_INSTALL_MODPROBE_CONF "Install modprobe conf files" ON)
|
||||
option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF)
|
||||
|
||||
# ====
|
||||
|
||||
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
if (IS_DIRECTORY ${LIB_INSTALL_DIR})
|
||||
set(LIB_INSTALL_DIR ${LIB_INSTALL_DIR} CACHE PATH "Main library directory")
|
||||
|
@ -28,17 +36,16 @@ else ()
|
|||
set(STLINK_INCLUDE_PATH "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}")
|
||||
endif ()
|
||||
|
||||
option(STLINK_GENERATE_MANPAGES "Generate manpages with pandoc" OFF)
|
||||
option(STLINK_INSTALL_UDEV_RULES "Install udev rules files" ON)
|
||||
option(STLINK_INSTALL_MODPROBE_CONF "Install modprobe conf files" ON)
|
||||
|
||||
# cmake (3.0+) on MacOS should use @rpath
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules")
|
||||
include(cmake/version.cmake)
|
||||
|
||||
if (NOT MSVC)
|
||||
include(cmake/c_flags.cmake)
|
||||
else ()
|
||||
message(STATUS "MSVC C Flags override to /MT")
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif ()
|
||||
|
||||
|
||||
|
@ -207,16 +214,13 @@ endif ()
|
|||
###
|
||||
|
||||
add_executable(st-flash src/tools/flash.c src/tools/flash_opts.c)
|
||||
add_executable(st-info src/tools/info.c)
|
||||
|
||||
if (WIN32 OR APPLE)
|
||||
target_link_libraries(st-flash ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
else ()
|
||||
target_link_libraries(st-flash ${STLINK_LIB_SHARED} ${SSP_LIB})
|
||||
endif ()
|
||||
|
||||
add_executable(st-info src/tools/info.c)
|
||||
if (WIN32 OR APPLE)
|
||||
target_link_libraries(st-info ${STLINK_LIB_STATIC} ${SSP_LIB})
|
||||
else ()
|
||||
target_link_libraries(st-flash ${STLINK_LIB_SHARED} ${SSP_LIB})
|
||||
target_link_libraries(st-info ${STLINK_LIB_SHARED} ${SSP_LIB})
|
||||
endif ()
|
||||
|
||||
|
@ -233,14 +237,14 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|||
endif ()
|
||||
|
||||
add_subdirectory(src/gdbserver)
|
||||
add_subdirectory(src/tools/gui)
|
||||
add_subdirectory(src/stlink-gui)
|
||||
|
||||
|
||||
###
|
||||
# Others
|
||||
###
|
||||
|
||||
add_subdirectory(usr/lib/pkgconfig)
|
||||
add_subdirectory(debian/pkgconfig)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(doc/man)
|
||||
add_subdirectory(tests)
|
||||
|
@ -248,6 +252,8 @@ add_subdirectory(tests)
|
|||
include(cmake/cpack_config.cmake)
|
||||
include(CPack)
|
||||
|
||||
# ====
|
||||
|
||||
|
||||
###
|
||||
# Uninstall target
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
if (MSVC)
|
||||
message(STATUS "MSVC C Flags override to /MT")
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
|
||||
endif ()
|
|
@ -3,32 +3,31 @@ if (NOT gtk_FOUND)
|
|||
return()
|
||||
endif ()
|
||||
|
||||
set(GUI_SOURCES stlink-gui.c stlink-gui.h)
|
||||
set(INSTALLED_UI_DIR share/stlink)
|
||||
set(GUI_SOURCES gui.c gui.h)
|
||||
set(INSTALLED_UI_DIR share/stlink) ### TODO: Check Path
|
||||
|
||||
include_directories(SYSTEM ${gtk_INCLUDE_DIRS})
|
||||
|
||||
# stlink-gui-local
|
||||
add_executable(stlink-gui-local ${GUI_SOURCES})
|
||||
set_target_properties(
|
||||
stlink-gui-local PROPERTIES
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_CURRENT_SOURCE_DIR}" ### TODO: Check Path
|
||||
)
|
||||
target_link_libraries(stlink-gui-local ${STLINK_LIB_STATIC} ${gtk_LDFLAGS} ${SSP_LIB})
|
||||
|
||||
|
||||
# stlink-gui
|
||||
add_executable(stlink-gui ${GUI_SOURCES})
|
||||
set_target_properties(
|
||||
stlink-gui PROPERTIES
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_PREFIX}/${INSTALLED_UI_DIR}"
|
||||
COMPILE_DEFINITIONS STLINK_UI_DIR="${CMAKE_INSTALL_PREFIX}/${INSTALLED_UI_DIR}" ### TODO: Check Path
|
||||
)
|
||||
target_link_libraries(stlink-gui ${STLINK_LIB_STATIC} ${gtk_LDFLAGS} ${SSP_LIB})
|
||||
|
||||
install(TARGETS stlink-gui RUNTIME DESTINATION bin)
|
||||
install(FILES stlink-gui.ui DESTINATION ${INSTALLED_UI_DIR})
|
||||
install(TARGETS stlink-gui RUNTIME DESTINATION bin) ### TODO: Check Path
|
||||
install(FILES gui.ui DESTINATION ${INSTALLED_UI_DIR}) ### TODO: Check Path
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||
# Install desktop entry
|
||||
install(FILES stlink-gui.desktop DESTINATION share/applications)
|
||||
# Install icon
|
||||
install(FILES art/stlink-gui.svg DESTINATION share/icons/hicolor/scalable/apps)
|
||||
install(FILES stlink-gui.desktop DESTINATION share/applications) # Install desktop entry
|
||||
install(FILES icons/stlink-gui.svg DESTINATION share/icons/hicolor/scalable/apps) # Install icon
|
||||
endif ()
|
|
@ -39,8 +39,7 @@ struct mem_t {
|
|||
guint32 base;
|
||||
};
|
||||
|
||||
struct _STlinkGUI
|
||||
{
|
||||
struct _STlinkGUI {
|
||||
GObject parent_instance;
|
||||
|
||||
/*< private >*/
|
||||
|
@ -82,8 +81,7 @@ struct _STlinkGUI
|
|||
stlink_t *sl;
|
||||
};
|
||||
|
||||
struct _STlinkGUIClass
|
||||
{
|
||||
struct _STlinkGUIClass {
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* class members */
|
|
@ -0,0 +1,40 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# create the XPM icon and all resolutions below hicolor as PNG
|
||||
|
||||
APPNAME="stlink-gui"
|
||||
ORIGIN="stlink-gui_icon.svg"
|
||||
OUTDIR="hicolor"
|
||||
|
||||
# possible size options are --export-dpi / --export-width / --export-height
|
||||
OPTS="-z --export-id-only"
|
||||
ID="scalable-icon"
|
||||
RESOLUTIONS="16 22 24 32 48 64 128 256"
|
||||
|
||||
if ! [ -d $OUTDIR ]; then
|
||||
echo "output directory missing. Create it..."
|
||||
mkdir $OUTDIR
|
||||
for RES in $RESOLUTIONS; do
|
||||
mkdir -p $OUTDIR/${RES}x${RES}/apps
|
||||
done
|
||||
fi
|
||||
|
||||
# create single app icon
|
||||
inkscape $OPTS --export-width=32 --export-id=$ID --export-png=$APPNAME.png $ORIGIN
|
||||
if [ $? != 0 ]; then
|
||||
exit 1;
|
||||
fi
|
||||
convert $APPNAME.png $APPNAME.xpm
|
||||
|
||||
# create all the resolutions
|
||||
ALL=""
|
||||
for RES in $RESOLUTIONS; do
|
||||
inkscape $OPTS --export-width=$RES --export-id=$ID --export-png=$OUTDIR/${RES}x${RES}/apps/$APPNAME.png $ORIGIN
|
||||
ALL="$ALL $OUTDIR/${RES}x${RES}/apps/$APPNAME.png"
|
||||
done
|
||||
|
||||
# this is for windows...
|
||||
#echo "build Windows icon from $ALL"
|
||||
#convert $ALL $APPNAME.ico
|
||||
|
||||
exit 0
|
Przed Szerokość: | Wysokość: | Rozmiar: 7.0 KiB Po Szerokość: | Wysokość: | Rozmiar: 7.0 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 781 B Po Szerokość: | Wysokość: | Rozmiar: 781 B |
Przed Szerokość: | Wysokość: | Rozmiar: 1.1 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.1 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 1.2 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.2 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 14 KiB Po Szerokość: | Wysokość: | Rozmiar: 14 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 1.7 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.7 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 2.6 KiB Po Szerokość: | Wysokość: | Rozmiar: 2.6 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 3.4 KiB Po Szerokość: | Wysokość: | Rozmiar: 3.4 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 1.7 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.7 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 4.7 KiB Po Szerokość: | Wysokość: | Rozmiar: 4.7 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 2.6 KiB Po Szerokość: | Wysokość: | Rozmiar: 2.6 KiB |
|
@ -1,38 +0,0 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# create the XPM icon and all resolutions below hicolor as PNG
|
||||
|
||||
APPNAME="stlink-gui"
|
||||
ORIGIN="stlink-gui_icon.svg"
|
||||
OUTDIR="hicolor"
|
||||
|
||||
## possible size options are --export-dpi / --export-width / --export-height
|
||||
OPTS="-z --export-id-only"
|
||||
ID="scalable-icon"
|
||||
RESOLUTIONS="16 22 24 32 48 64 128 256"
|
||||
|
||||
if ! [ -d $OUTDIR ]; then
|
||||
echo "output directory missing. Create it..."
|
||||
mkdir $OUTDIR
|
||||
for RES in $RESOLUTIONS; do
|
||||
mkdir -p $OUTDIR/${RES}x${RES}/apps
|
||||
done
|
||||
fi
|
||||
|
||||
# create single app icon
|
||||
inkscape $OPTS --export-width=32 --export-id=$ID --export-png=$APPNAME.png $ORIGIN
|
||||
if [ $? != 0 ]; then exit 1; fi
|
||||
convert $APPNAME.png $APPNAME.xpm
|
||||
|
||||
# create all the resolutions
|
||||
ALL=""
|
||||
for RES in $RESOLUTIONS; do
|
||||
inkscape $OPTS --export-width=$RES --export-id=$ID --export-png=$OUTDIR/${RES}x${RES}/apps/$APPNAME.png $ORIGIN
|
||||
ALL="$ALL $OUTDIR/${RES}x${RES}/apps/$APPNAME.png"
|
||||
done
|
||||
|
||||
# this is for windows...
|
||||
#echo "build Windows icon from $ALL"
|
||||
#convert $ALL $APPNAME.ico
|
||||
|
||||
exit 0
|