Question

After I successfully implemented my first JVMTI agent and the building completes with the g++ compiler I want to go over integrate the building process into my Qt project.

However I am facing some build process configuration issues:

The parameters I would run with the g++ compiler looks like this:

g++ -fPIC -shared agent.cpp -o libagent.so -I /usr/lib/jvm/java-6-openjdk/include -I /usr/lib/jvm/java-6-openjdk/include/linux

This works very well. Now to qmake:

I am aware of the parameter CXXFLAGS to add further parameters to the C++ compiler used by qmake, but how can I convert this parametrized compiler call into qmake?

Was it helpful?

Solution

With the help of Qt Undocumented qmake I figured out a custom configuration in qmake. However, it is not flawless, it produces now a libagent.so and a agent.o which is not needed.

SOURCES_AGENT = agent.cpp
agent.name = agent
agent.input = SOURCES_AGENT
agent.dependency_type = TYPE_C
agent.variable_out = OBJECTS
agent.output = libagent.so
agent.commands = $${QMAKE_CXX} $(CXXFLAGS) -fPIC -shared  -o libagent.so $(INCPATH) ${QMAKE_FILE_IN}
QMAKE_EXTRA_COMPILERS += agent

OTHER TIPS

I don't know the specific answer but...

As JVMTI agents are "usually" headless are you using qmake because your project has a head that you are developing in kdevelop/qtcreator? Is the head using the attach API?

If not and it is purely headless then would not a different editor/cmake be better? qmake is now a preproc for cmake, for the MOC stuff, no?

I must admit I'm a bit fuzzy on q/cmake although I'm hoping to move to cmake for my work.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top