[prev in list] [next in list] [prev in thread] [next in thread]
List: libftdi
Subject: Re: static linking against libftdi?
From: Chris Morgan <chmorgan () gmail ! com>
Date: 2014-01-31 22:35:15
Message-ID: CAAPegz20znPuQBN_EMqQJHburdPMNNNF93SZeAwUPPSB00ougA () mail ! gmail ! com
[Download RAW message or body]
Alright, attached is a proof of concept patch, untested, for comments
on the approach.
Chris
On Tue, Jan 28, 2014 at 10:57 AM, Chris Morgan <chmorgan@gmail.com> wrote:
> On Tue, Jan 28, 2014 at 8:53 AM, Chris Morgan <chmorgan@gmail.com> wrote:
> > On Tue, Jan 28, 2014 at 4:53 AM,
> > <bon@elektron.ikp.physik.tu-darmstadt.de> wrote:
> > > > > > > > "Chris" == Chris Morgan <chmorgan@gmail.com> writes:
> > >
> > > Chris> How do I use that script? Do I just include it like:
> > >
> > > In xc3sprog/CMakeLists.txt I have
> > > ...
> > > set(USE_STATIC_FTDI ON)
> > > ...
> > > find_package(libftdi)
> > > include_directories(${LIBFTDI_INCLUDE_DIR})
> > > ...
> > > add_executable(detectchain detectchain.cpp cables.h devices.h)
> > > target_link_libraries(detectchain xc3sproglib ${LIBFTDI_LIBRARIES} \
> > > ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS})
> > > add_executable(xc3sprog xc3sprog.cpp javr.cpp srecfile.cpp progalgavr.cpp
> > > devices.h)
> > > target_link_libraries(xc3sprog xc3sproglib ${LIBFTDI_LIBRARIES} \
> > > ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS} )
> > > add_executable(readdna readdna.cpp devices.h)
> > > target_link_libraries(readdna xc3sproglib ${LIBFTDI_LIBRARIES} \
> > > ${LIBFTD2XX_LIBRARIES} ${CONDITIONAL_LIBS} )
> >
> >
> > I tried this but for whatever reason the Findlibftdi.cmake can't find
> > my libftdi files. I suspect this is because I'm actually installing
> > libftdi to a user directory and the pkg-config and other entries
> > aren't in the correct place. For whatever reason the example cmake
> > usage in the libftdi source is working for me, the:
> >
> > find_package (LibFTDI1 NO_MODULE REQUIRED)
> > include (${LIBFTDI_USE_FILE})
> >
> >
> >
> > Still seems like a better approach to support this in the existing
> > libftdi cmake scripts, unless I'm missing something as to why this
> > shouldn't be done.
> >
> > I was looking at what it might take to add this support to libftdi
> > proper. In LibFTDI1Config.cmake there are set()s for LIBFTDI_LIBRARY
> > and LIBFTDI_LIBRARIES. What if we introduce two new ones,
> >
> > LIBFTDI_STATIC_LIBRARY and LIBFTDI_STATIC_LIBRARIES that refer to
> > libftdi1.a instead of libftdi1.so? I tested this locally and it
> > appears to be working properly.
> >
> > Thoughts?
> >
> > Chris
>
>
> And by thoughts, I want to see if what I'm saying makes sense before
> sending patches, but didn't want to go down that road if there is a
> better idea or approach.
>
> Chris
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@developer.intra2net.com
["0001-Add-LIBFTDI_STATIC_LIBRARY-and-LIBFTDI_STATIC_LIBRAR.patch" (text/x-patch)]
From 7af906ab4e71697f99300574ef1c741262d36417 Mon Sep 17 00:00:00 2001
From: Chris Morgan <cmorgan@cybexintl.com>
Date: Thu, 30 Jan 2014 17:22:44 -0500
Subject: [PATCH] Add LIBFTDI_STATIC_LIBRARY and LIBFTDI_STATIC_LIBRARIES to
make it easier to link statically against libftdi
---
CMakeLists.txt | 3 +++
cmake/LibFTDI1Config.cmake.in | 2 ++
2 files changed, 5 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bdd211d..49e23bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -186,6 +186,9 @@ set ( LIBFTDI_INCLUDE_DIRS ${LIBFTDI_INCLUDE_DIR} )
set ( LIBFTDI_LIBRARY ftdi1 )
set ( LIBFTDI_LIBRARIES ${LIBFTDI_LIBRARY} )
list ( APPEND LIBFTDI_LIBRARIES ${LIBUSB_LIBRARIES} )
+set ( LIBFTDI_STATIC_LIBRARY ftdi1.a )
+set ( LIBFTDI_STATIC_LIBRARIES ${LIBFTDI_LIBRARY} )
+list ( APPEND LIBFTDI_STATIC_LIBRARIES ${LIBUSB_LIBRARIES} )
if (FTDI_BUILD_CPP)
set ( LIBFTDIPP_LIBRARY ftdi1pp )
set ( LIBFTDIPP_LIBRARIES ${LIBFTDIPP_LIBRARY} )
diff --git a/cmake/LibFTDI1Config.cmake.in b/cmake/LibFTDI1Config.cmake.in
index 904a9b7..ecc615e 100644
--- a/cmake/LibFTDI1Config.cmake.in
+++ b/cmake/LibFTDI1Config.cmake.in
@@ -37,6 +37,8 @@ set ( LIBFTDI_INCLUDE_DIR "@LIBFTDI_INCLUDE_DIR@" )
set ( LIBFTDI_INCLUDE_DIRS "@LIBFTDI_INCLUDE_DIRS@" )
set ( LIBFTDI_LIBRARY "@LIBFTDI_LIBRARY@" )
set ( LIBFTDI_LIBRARIES "@LIBFTDI_LIBRARIES@" )
+set ( LIBFTDI_STATIC_LIBRARY "@LIBFTDI_STATIC_LIBRARY@" )
+set ( LIBFTDI_STATIC_LIBRARIES "@LIBFTDI_STATIC_LIBRARIES@" )
set ( LIBFTDIPP_LIBRARY "@LIBFTDIPP_LIBRARY@" )
set ( LIBFTDIPP_LIBRARIES "@LIBFTDIPP_LIBRARIES@" )
set ( LIBFTDI_LIBRARY_DIRS "@LIBFTDI_LIBRARY_DIRS@" )
--
1.8.3.1
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic