From dd510cf89bff5c9994d7a21a5cac86df6c69a9cc Mon Sep 17 00:00:00 2001 From: Konrad Dybcio Date: Tue, 18 Mar 2025 13:48:13 +0100 Subject: [PATCH 1/2] treewide: Simple compilation fixes for VS compiler Signed-off-by: Konrad Dybcio --- inc/usb.h | 4 ++-- src/jtag_eud.cpp | 4 +++- src/usb.cpp | 1 - 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/inc/usb.h b/inc/usb.h index 0a05280..4f50c47 100644 --- a/inc/usb.h +++ b/inc/usb.h @@ -20,14 +20,14 @@ #include #include #include -#include +#include #if defined ( EUD_WIN_ENV ) #include #include #include #include -#include +#include #endif #ifdef __cplusplus diff --git a/src/jtag_eud.cpp b/src/jtag_eud.cpp index 2c5cf62..133f6e4 100644 --- a/src/jtag_eud.cpp +++ b/src/jtag_eud.cpp @@ -13,6 +13,8 @@ #include "eud.h" #include "jtag_eud.h" + +#include #include #include #include @@ -1102,7 +1104,7 @@ JtagEudDevice::BitsFreeTdi() uint32_t available_in = ((JTAG_IN_BUFFER_SIZE - usb_num_bytes_pending_in_) * 8) - (full_in + partial_in); #if defined ( EUD_WIN_ENV ) - return std::min(available_out, available_in); + return min(available_out, available_in); #elif defined (EUD_LNX_ENV) return std::min(available_out, available_in); #endif diff --git a/src/usb.cpp b/src/usb.cpp index dbc267f..ee1df00 100644 --- a/src/usb.cpp +++ b/src/usb.cpp @@ -15,7 +15,6 @@ #include #include #include -#include "libusb-1.0/libusb.h" #if defined ( EUD_WIN_ENV ) #include #endif From b642f4152720245cb4183a044b354d16d054e549 Mon Sep 17 00:00:00 2001 From: Konrad Dybcio Date: Sat, 15 Mar 2025 17:09:31 +0100 Subject: [PATCH 2/2] project: use Meson Autotools is a relic of the past, let it rot in peace. Signed-off-by: Konrad Dybcio --- Makefile.am | 38 -------------------------------- README.md | 22 ++++++++++++++----- configure.ac | 62 ---------------------------------------------------- meson.build | 41 ++++++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 105 deletions(-) delete mode 100644 Makefile.am delete mode 100644 configure.ac create mode 100644 meson.build diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 58bd757..0000000 --- a/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -AUTOMAKE_OPTIONS = subdir-objects - -if SUBPROJECT_BUILD -noinst_LTLIBRARIES = libeud.la -else -lib_LTLIBRARIES = libeud.la -if WINDOWS_ENV -if BUILD_DLL -libeud_la_LDFLAGS = -shared -no-undefined -lusb-1.0 -avoid-version -endif -endif -endif - - -library_includedir = inc - -libeud_la_SOURCES = \ - src/eud_error_defines.cpp \ - src/usb.cpp \ - src/device_manager.cpp \ - src/general_api_processing.cpp \ - src/rw_childprocess.cpp \ - src/eud.cpp \ - src/eud_api.cpp \ - src/jtag_eud.cpp \ - src/jtag_api.cpp \ - src/jtag_test.cpp \ - src/com_eud.cpp \ - src/com_api.cpp \ - src/ctl_eud.cpp \ - src/ctl_api.cpp \ - src/trc_eud.cpp \ - src/trc_api.cpp \ - src/swd_eud.cpp \ - src/swd_api.cpp - -libeud_la_CPPFLAGS = -Wall -Wno-narrowing -I $(library_includedir) - diff --git a/README.md b/README.md index 4ae8795..f13498e 100644 --- a/README.md +++ b/README.md @@ -25,11 +25,23 @@ making it an invaluable asset for engineers working on complex projects. 3. libwinpthread-1.dll - pthread library for POSIX thread support. 4. libstdc++-6.dll - GNU Standard C++ library providing standard C++ library functions. +On Windows you'll want to grab: +``` +choco install meson ninja pkgconfiglite +``` + +As well as a version of Visual Studio build tools, which are installed as part of the VS installer workflow. + ## Building EUD: - -1. autoreconf --verbose --force --install -2. ./configure --enable-dll (Ignore --enable-dll if building on linux) -3. make +``` +# Windows prerequisite +mkdir subprojects +meson wrap install libusb + +# On all platforms +meson build +ninja -C build +``` ## License: -EUD is licensed on the GPL-2.0 OR BSD 3-clause "New" or "Revised" License. Check out the [LICENSE](LICENSE.txt) for more details. \ No newline at end of file +EUD is licensed on the GPL-2.0 OR BSD 3-clause "New" or "Revised" License. Check out the [LICENSE](LICENSE.txt) for more details. diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 0416021..0000000 --- a/configure.ac +++ /dev/null @@ -1,62 +0,0 @@ -AC_INIT([libeud],[0.1],[eud-dev@quicinc.com],[libeud],[http://github.qualcomm.com/CorePnI/eud]) - -AC_CANONICAL_HOST - -# Check build environment -case "${host_os}" in - linux*) - linux_env=yes - ;; - cygwin*|mingw*) - windows_env=yes - ;; - *) - AC_MSG_ERROR(["OS $host_os is not supported"]) - ;; -esac - - -# libusb-1.0 dependency check -PKG_CHECK_MODULES([libusb], [libusb-1.0], - [HAVE_LIBUSB=yes], [HAVE_LIBUSB=no]) - -AS_IF([test "x$HAVE_LIBUSB" = "xyes"], - [libusb_msg="yes"], [libusb_msg="no (missing: libusb-1.0)"]) - - -# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess) -# in this dir (build-aux) -AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIRS([m4]) - -# Init automake, and specify this program use relaxed structures. -# i.e. this program doesn't follow the gnu coding standards, and doesn't have -# ChangeLog, COPYING, AUTHORS, INSTALL, README etc. files. -AM_INIT_AUTOMAKE([-Wall -Werror foreign]) - -# Check for C compiler -AM_PROG_AR -AC_PROG_CC -AC_PROG_CXX - -LT_INIT - -AC_ARG_ENABLE([dll], - AS_HELP_STRING([--enable-dll], [Build EUD driver dll for Windows]), - [build_dll=$enableval], [build_dll=no]) - -AM_CONDITIONAL([BUILD_DLL],[test "x$build_dll" = "xyes"]) - -AM_CONDITIONAL([LINUX_ENV], [test "x$linux_env" = "xyes"]) -AM_CONDITIONAL([WINDOWS_ENV],[test "x$windows_env" = "xyes"]) - -AM_CONDITIONAL([SUBPROJECT_BUILD], - [test "x$enable_subproject_build" = "xyes"]) - - -# Create Makefile -AC_CONFIG_FILES([Makefile]) - - -# Generate the output -AC_OUTPUT diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..5b28773 --- /dev/null +++ b/meson.build @@ -0,0 +1,41 @@ +project('eud', + 'cpp', + version: '0.1', + # default_options: ['warning_level=1', 'buildtype=release'] +) +libeud_srcs = [ + 'src/eud_error_defines.cpp', + 'src/usb.cpp', + 'src/device_manager.cpp', + 'src/general_api_processing.cpp', + 'src/rw_childprocess.cpp', + 'src/eud.cpp', + 'src/eud_api.cpp', + 'src/jtag_eud.cpp', + 'src/jtag_api.cpp', + 'src/jtag_test.cpp', + 'src/com_eud.cpp', + 'src/com_api.cpp', + 'src/ctl_eud.cpp', + 'src/ctl_api.cpp', + 'src/trc_eud.cpp', + 'src/trc_api.cpp', + 'src/swd_eud.cpp', + 'src/swd_api.cpp', +] + +if build_machine.system() == 'windows' + shared_library('eud', + libeud_srcs, + version: meson.project_version(), + dependencies: dependency('libusb-1.0'), + include_directories : include_directories('inc'), + ) +else + static_library('eud', + libeud_srcs, + dependencies: dependency('libusb-1.0'), + include_directories : include_directories('inc'), + cpp_args: '-Wno-narrowing', # TODO: drop me + ) +endif