Discussion:
[Opensg-users] OpenSG 2: CMake build system
Johannes Brunen
2015-10-06 12:04:07 UTC
Permalink
Hello Gerrit,



the OpenSG 2 build system does provide the 'OSG_GLOBAL_PREP' variable,
which allows me to call my own cmake configuration file. In that file
I'm allowed to define another variable 'OSG_ADD_GLOBAL_SRC' that is
evaluated for each of the OpenSG libraries. By that, I'm able to add a
special memory management source file to the OpenSG libraries. That is
working pretty fine. However, when I build any executable in OpenSG,
e.g. the test*.exe or the example executables, then I have to add my
memory management source file explicitly to the project. Both, the
library and the executable must include this file. This is a little
inconvenient and I would like to ask if it is possible to add the above
variable evaluation in all ADD_EXECUTABLE statements, i.e.
ADD_EXECUTABLE(... ${OSG_ADD_GLOBAL_SRC}).



I have tested this change in my local setup and it works fine.



The following files do contain the ADD_EXECUTABLE statement:

d:\_xxx\Comp\builder\support\opensg\Tools\unittest-cpp\CMakeLists.txt

d:\_xxx\Comp\builder\support\opensg\Source\Contrib\CSMPlugin\SimpleTest\
CMakeLists.Lib.OSGContribCSMSimplePlugin.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Tutorial\CMakeLists.standal
one.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Tutorial\CMakeLists.fromosg
.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Simple\CMakeLists.standalon
e.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Simple\CMakeLists.fromosg.t
xt

d:\_xxx\Comp\builder\support\opensg\Examples\CustomIntegration\NewContai
nerType\CubesAppUnified\CMakeLists.txt

d:\_xxx\Comp\builder\support\opensg\Examples\CustomIntegration\NewContai
nerType\CubesApp\CMakeLists.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Advanced\DeferredShading\CM
akeLists.standalone.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Advanced\DeferredShading\CM
akeLists.fromosg.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Advanced\Character\CMakeLis
ts.standalone.txt

d:\_xxx\Comp\builder\support\opensg\Examples\Advanced\Character\CMakeLis
ts.fromosg.txt

d:\_xxx\Comp\builder\support\opensg\CMake\OSGBuildFunctions.cmake



Best,

Johannes




------------------------------------------------------------------------------
Gerrit Voß
2015-10-06 17:38:55 UTC
Permalink
Hi,
Post by Johannes Brunen
Hello Gerrit,
the OpenSG 2 build system does provide the 'OSG_GLOBAL_PREP' variable,
which allows me to call my own cmake configuration file. In that file
I'm allowed to define another variable 'OSG_ADD_GLOBAL_SRC' that is
evaluated for each of the OpenSG libraries. By that, I'm able to add a
special memory management source file to the OpenSG libraries. That is
working pretty fine. However, when I build any executable in OpenSG,
e.g. the test*.exe or the example executables, then I have to add my
memory management source file explicitly to the project. Both, the
library and the executable must include this file. This is a little
inconvenient and I would like to ask if it is possible to add the above
variable evaluation in all ADD_EXECUTABLE statements, i.e.
ADD_EXECUTABLE(... ${OSG_ADD_GLOBAL_SRC}).
I have a look, currently all the file information is collected and
temporarily stored. I would probably add a OSG_ADD_GLOBAL_EXE_SRC to
have a distinction between libs and executables.

kind regards
gerrit





------------------------------------------------------------------------------
Johannes
2015-10-07 06:41:21 UTC
Permalink
Post by Gerrit Voß
I have a look, currently all the file information is collected and
temporarily stored. I would probably add a OSG_ADD_GLOBAL_EXE_SRC to
have a distinction between libs and executables.
I'm fine with that :-)

Best,
Johannes
Gerrit Voß
2015-10-07 17:53:42 UTC
Permalink
Hi,
Post by Johannes
Post by Gerrit Voß
I have a look, currently all the file information is collected and
temporarily stored. I would probably add a OSG_ADD_GLOBAL_EXE_SRC to
have a distinction between libs and executables.
I'm fine with that :-)
great ;), just commited the change, so now you can use
OSG_ADD_GLOBAL_EXE_SRC
to add extra source files to each executable.

I'll look at the background tomorrow.

kind regards
gerrit
Johannes
2015-10-22 12:41:30 UTC
Permalink
Hello Gerrit,

I have one additional small problem with the build system. I got an
unresolved external symbol error from a missing memmanager library in
target simplePluginApp. That target is somehow special and does not add
the OSG_GLOBAL_LIB dependencies. I have temporarily added the following
line of cmake code

TARGET_LINK_LIBRARIES(simplePluginApp ${${OSG_GLOBAL_LIB}})

into

Contrib/CSMPlugin/SimpleTest/CMakeLists.Lib.OSGContribCSMSimplePlugin.txt

which resolves this error. Probably there is a more elegant solution
that would be more in the line of the other executable targets?

Could you adapt OSGContribCSMSimplePlugin.txt accordingly?


Thanks,
Johannes



------------------------------------------------------------------------------
Johannes
2015-11-09 12:59:26 UTC
Permalink
Post by Johannes Brunen
Hello Gerrit,
I have one additional small problem with the build system. I got an
unresolved external symbol error from a missing memmanager library in
target simplePluginApp. That target is somehow special and does not add
the OSG_GLOBAL_LIB dependencies. I have temporarily added the following
line of cmake code
TARGET_LINK_LIBRARIES(simplePluginApp ${${OSG_GLOBAL_LIB}})
into
Contrib/CSMPlugin/SimpleTest/CMakeLists.Lib.OSGContribCSMSimplePlugin.txt
which resolves this error. Probably there is a more elegant solution
that would be more in the line of the other executable targets?
Could you adapt OSGContribCSMSimplePlugin.txt accordingly?
Thanks,
Johannes
------------------------------------------------------------------------------
ping :-)
Carsten Neumann
2015-11-17 15:44:56 UTC
Permalink
Hello all,
Post by Johannes
TARGET_LINK_LIBRARIES(simplePluginApp ${${OSG_GLOBAL_LIB}})
into
Contrib/CSMPlugin/SimpleTest/CMakeLists.Lib.OSGContribCSMSimplePlugin.txt
which resolves this error. Probably there is a more elegant solution
that would be more in the line of the other executable targets?
Given that this is indeed a special target that (intentionally) does not
link with any OpenSG libs and also avoids the rest of the build
machinery this is probably the simplest solution.
Gerrit: I'll push the attached patch in a few days if there are no
objections. Thanks!
done. Thanks again,

Cheers,
Carsten

------------------------------------------------------------------------------
Johannes
2016-04-19 08:01:23 UTC
Permalink
Hi Carsten,

I think that this issue is not merged correctly into the git master.
The CMakeLists.Lib.OSGContribCSMSimplePlugin.txt file now contains the
following line of code:

TARGET_LINK_LIBRARIES(simplePluginApp ${OSG_GLOBAL_LIB})

but it has to be

TARGET_LINK_LIBRARIES(simplePluginApp ${${OSG_GLOBAL_LIB}})

in order to work correctly.

Could you please change the file accordingly.

Sorry, that I do not have detected this earlier but I do not build this
target regularly.

Best,
Johannes
Hello Johannes, Gerrit,
Post by Johannes
I have one additional small problem with the build system. I got an
unresolved external symbol error from a missing memmanager library in
target simplePluginApp. That target is somehow special and does not add
the OSG_GLOBAL_LIB dependencies. I have temporarily added the following
line of cmake code
hmm, why is that not a problem for the tests? I guess the difference is
they link with at least one OpenSG library and pull in the memmanager
symbols that way?
Post by Johannes
TARGET_LINK_LIBRARIES(simplePluginApp ${${OSG_GLOBAL_LIB}})
into
Contrib/CSMPlugin/SimpleTest/CMakeLists.Lib.OSGContribCSMSimplePlugin.txt
which resolves this error. Probably there is a more elegant solution
that would be more in the line of the other executable targets?
Given that this is indeed a special target that (intentionally) does not
link with any OpenSG libs and also avoids the rest of the build
machinery this is probably the simplest solution.
Gerrit: I'll push the attached patch in a few days if there are no
objections. Thanks!
Cheers,
Carsten
------------------------------------------------------------------------------
_______________________________________________
Opensg-users mailing list
https://lists.sourceforge.net/lists/listinfo/opensg-users
Carsten Neumann
2016-04-20 14:37:34 UTC
Permalink
Hello Johannes,
Post by Johannes
I think that this issue is not merged correctly into the git master.
The CMakeLists.Lib.OSGContribCSMSimplePlugin.txt file now contains the
TARGET_LINK_LIBRARIES(simplePluginApp ${OSG_GLOBAL_LIB})
but it has to be
TARGET_LINK_LIBRARIES(simplePluginApp ${${OSG_GLOBAL_LIB}})
in order to work correctly.
Could you please change the file accordingly.
done, thanks!

Cheers,
Carsten

Loading...