Re: [nbdev] Related to create project in netbeans without using ui

Vladimir Kvashin <[email protected]> Fri, 12 Aug 2016 02:12:22 +0300
Newsgroups gmane.comp.java.netbeans.cnd.user,gmane.comp.java.netbeans.devel
Message-ID <[email protected]>
Hi,

The right alias to ask C/C++ related questions is 
users-Nxb6G7t0PNHV1xZipG0+DeG/[email protected] I'm forwarding your question there.

I'm afraid it isn't possible with NetBeans as such; but it is possible 
with a free NetBeans based product - Oracle Developer Studio.

The download page for Oracle Developer Studio is
http://www.oracle.com/technetwork/server-storage/developerstudio/downloads/index-jsp-141149.html

It contains a script exactly for this purpose. The script is
solarisstudio12.5/lib/ide_project/bin/ide_project

It creates an IDE project either by binary or by build log.

If you want to create projects from build log, the is:

/opt/developerstudio12.5/lib/ide_project/bin/ide_project 
--netbeans-project=<path-to-save-IDE-project-to> --project-create 
build-log=<path_to-build-log> --sources=used | all <path-to-sources>

where <path-to-sources> is the topmost directory that contains your sources;
--sources=used <path-to-sources> or --sources=all <path-to-sources> 
affects representation of source tree in the IDE.

If you specify --sources=used, then IDE source tree will contain only 
source files IDE thinks were used when building your product.

If you specify --sources=all, then the entire directory tree will be 
shown in the IDE; source files IDE thinks were not used when building 
you product will be grayed.

If you want to create a project from binary, the option is
     --project-create binary=<path to binary file>

Additional useful options are
   --help                     show help
   --jdkhome <path>           path to Java(TM) 6 SDK or JRE
--additional-libraries=<colon-separated-libraries-list> additional 
libraries (.so files) to include (sources they were built from) into the 
project


Now let me shed some light on the difference between creation an IDE 
project from binary vs build log. Creating from binary extracts 
information from debugging indo (dwarf). What's the information in dwarf 
depends on compilers and options.

Solaris Studio - in case you specified -g option - puts the entire 
command line, with all its options, into dwarf. And that's exactly what 
IDE needs. So if you build with Solaris Studio with -g option, then 
creating from binary is perfect for the IDE.

Unfortunately GNU compilers do not put compilation options into dwarf 
information. If you compiled just with -g, then it's possible to extract 
just exact list of files that were built. Sure IDE will search the 
sources you specified to find files that are #included, so most likely 
it will be able to understand your -I options. But IDE has no way to 
determine your -D options in this case.

If you compile with GNU and specify more detailed debug information to 
be included - -g3 -gdwarf-2 options - then much more information will be 
put into dwarf debug info. In this case IDE will create well configured 
project as well. Although in this case IDE will need to use some 
intelligence to find out initial -I and -D options from dwarf info 
(which means it might understand something wrong).

When you build from build log, IDE scans the log for the text "Entering 
directory ddd", "Leaving directory ddd" and compilations commands (gcc, 
c++, cc, CC, etc). The former (entering/leaving) allows IDE to 
understand what's the current directory, the latter helps IDE 
understanding compilation options. Please note that parallel build can 
affect the order of these commands, so IDE won't be able to understand 
current directory. (Sure, IDE tries to do its best in any case, so you 
may try feeding IDE with parallel build log as well)

Hope this helps
Vladimir





On 08/09/2016 03:16 PM, swati thombe wrote:
> Hello,
>       Is there any way to create c/c++ project without using net-beans UI
> in the module. sorry for bad English. Thanks in advance.
>
>
>
>
>
>
>
>
> Thanks & Regards,
> swati thombe
>
>
>