Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Installing my own library to my Linux system with Qt Creator
Forum Updated to NodeBB v4.3 + New Features

Installing my own library to my Linux system with Qt Creator

Scheduled Pinned Locked Moved Installation and Deployment
4 Posts 2 Posters 4.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    valandil211
    wrote on last edited by
    #1

    Hi everyone!

    I'm currently developing a C++ library using Qt Creator. I'm using the Libraries -> C++ Library mode in Creator.

    When I compile the project, I can see the .a library file in the build directory. A @make install@ in this directory copies the library to the appropriate system folder; /usr/local/lib in my case. Now, if I got this right, I'm also supposed to copy the header files to /usr/include/, or any other folder that my compiler is aware of.

    Is there a way to say to Qt Creator that when I compile/install the library, I want to actually install the library system-wide?

    I hope my question is clear, and if it's not, please tell me how I can clarify.

    Thanks,

    Joey Dumont

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

      Maybe this is useful for you

      https://code.google.com/p/qextserialport/source/detail?r=fb0e263c63b281730a895f40045b3fc3f3e81611

      1 Reply Last reply
      0
      • V Offline
        V Offline
        valandil211
        wrote on last edited by
        #3

        Thanks for the answer.

        I looked at the armadillo library to see how it did what I wanted to do, and I found a way to do it with qmake. I simply added the following lines to my .pro file:

        @QMAKE_STRIP = echo

        inc1.path = /usr/local/include
        inc1.files = dynamica

        inc2.path = /usr/local/include/dynamica_bits
        inc2.files = *.h

        INSTALLS += inc1 inc2@

        where dynamica is the name of my library.

        Thanks!

        Joey Dumont

        1 Reply Last reply
        0
        • V Offline
          V Offline
          valandil211
          wrote on last edited by
          #4

          Hello again!

          The library has progressed some more and, consequently, new issues have arisen. Because of the growing number of files, I decided to use .pri files to organize the project (the entire source is available "here":http://code.google.com/p/libdynamica/source/browse/ ).

          Now, when I install the library, I copy over the headers to /usr/local/include. How does one usually deal with this?

          As you can see from my .pro file

          @
          #---------------------------------------------------#

          Project created by QtCreator 2012-06-14T11:33:08

          #---------------------------------------------------#

          --------------------------------------------------#

          Main project configuration

          --------------------------------------------------#

          QT -= core gui

          TARGET = dynamica
          TEMPLATE = lib
          CONFIG += staticlib create_prl

          --------------------------------------------------#

          Compilation parameters

          --------------------------------------------------#

          We need -std=c++11 to use initializer lists in Armadillo.

          We require g++ >= 4.7.

          !! WARNING: PLATFORM-DEPENDANT CODE !!

          GCCVERSION = $$system(g++ --version | grep -oe "[0-9].[0-9]")

          defineReplace(testVersion){
          if $$GCCVERSION < 4.7 {
          error(You are not using the a supported g++ version.)
          }
          }
          QMAKE_CXXFLAGS += -std=c++11

          --------------------------------------------------#

          C++ Headers and Sources

          --------------------------------------------------#

          include(ode.pri)
          include(roots.pri)
          include(utilities.pri)
          include(chaos.pri)
          include(special_functions.pri)

          OTHER_FILES +=
          dynamica
          Doxyfile \

          --------------------------------------------------#

          Libraries

          --------------------------------------------------#

          unix:!symbian|win32: LIBS += -larmadillo -lgfortran

          --------------------------------------------------#

          Installation Configuration

          --------------------------------------------------#

          QMAKE_STRIP = echo

          inc1.path = /usr/local/include
          inc1.files = dynamica

          inc2.path = /usr/local/include/dynamica_bits
          inc2.files +=
          chaos/.h
          ode/
          .h
          roots/.h
          special_functions/
          .h
          utilities/*.h\

          INSTALLS += inc1 inc2

          unix:!symbian {
          maemo5 {
          target.path = /opt/usr/lib
          } else {
          target.path = /usr/local/lib
          }
          INSTALLS += target
          }

          HEADERS +=
          docs.h
          @

          I copy all headers to the same folder, effectively flattening the folder structure during installation. However, in my development directories, the header #include each other using the flat folder structure (which seems like an odd way to do it) although in the development directories, the folder structure is complex.

          Sorry for the long question. I'll try to boil it down to two simple questions.

          When installing a header library, do you can flatten out the original directory structure or do you keep the same directory structure?

          I'd vote for the second one, albeit the question now becomes: how does one configure qmake to preserve directory structure? Sure, I could add a INSTALLS for each directory, but that seems like an inelegant solution.

          Thanks!

          Joey Dumont

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved