Author Topic: C::B Newb - Trying to use C::B for NaCl Development  (Read 8406 times)

Offline Kyall

  • Single posting newcomer
  • *
  • Posts: 5
C::B Newb - Trying to use C::B for NaCl Development
« on: April 17, 2012, 05:25:36 am »
NaCl is google's sdk for running c++ (with opengl ES 2 support if wanted) in chrome, I've been trying to find an IDE I can use to do this as google doesn't supply one, however google has it's own gnu C and libs etc for building for security reasons the code has to be compiled using these.  I couldn't see where to add a custom compiler to c::b so I've come seeking some help and here's basically what I want to do to get this working, if it's possible, and any one can help me, I'd be thankful.

On c::b build:
1)  Save the project (the cbp, maybe this is saved automagically when I hit build by default in c::b?)
2)  From c::b, as a prebuild step, run an application I've built that generates a Makefile from the cbp of the code blocks project, that generates the make file for all the build targets ( NaCl, Android, or whatever target is genned for the makefile with the proper compiler and that )  - doing this because NaCl build is a bit complicated
3)  Run make on the custom generated make file

Obviously I can use cbp as the IDE, when I generate the make file from the cbp, where I would save the project then run the make file generator and build thing manually.  But I'd feel better if I can set up a build process using the IDE that kicks this off.  

The big thing about this, is that when I've got a project with all of that working, I'll create a template file that I can create NaCl projects on from it.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #1 on: April 17, 2012, 07:33:30 am »
Why would you want to generate a makefile from the C::B project?
Why don't you set the compiler options inside the C::B project?

If you want to modify a compiler go to Settings -> Compiler -> you compiler -> Other settings ->Advanced options.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Kyall

  • Single posting newcomer
  • *
  • Posts: 5
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #2 on: April 17, 2012, 07:37:57 am »
Why would you want to generate a makefile from the C::B project?
Why don't you set the compiler options inside the C::B project?

If you want to modify a compiler go to Settings -> Compiler -> you compiler -> Other settings ->Advanced options.

Sorry didn't realize there was a Copy button for global compiler settings,

So Settings -> Compiler & Debugger -> Toolchain Executables  And I'll modify those to fit what I need

Thanks for the help, much appreciated.

Offline Kyall

  • Single posting newcomer
  • *
  • Posts: 5
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #3 on: April 17, 2012, 08:28:19 am »
I've got that set up and working, but now I'd still like to add something to run an application that goes over the cbp file so that I can generate the nmf file that nacl needs ( it's the nmf file that you embed into the webpage, and it's basically a JSON manifest of the url location of the 32 bit or 64 bit executable )

Also with the advanced option:
$linker $libdirs -o $exe_output $link_objects $link_resobjects $link_options $libs

I want to change each item of  $link_objects to have a prefix/postfix on it so that I can call this twice for 32 and 64 bit. 

$link_objects_x86_64 sort of thing, but that doesn't work... is there an array op for these options?

Because native client generally compiles by compiling both, I can just compile the one platform at a time, if there is a build all platforms I haven't found it yet.
« Last Edit: April 17, 2012, 08:49:46 am by Kyall »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #4 on: April 17, 2012, 10:02:25 am »
You can use post builds steps for this and there you can also use squirrel scripts.

For the second question I'm not sure I've understood it.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #5 on: April 17, 2012, 10:51:50 am »
You probably want to make 2 build targets, because changing the filename from 32 to 64 obviously won't do much for the binary executable. Just give the output files different names (and of course build flags and libs!) in both targets and you're good. It's the simplest thing, too.

p.s.: Did it never occur to anyone that something like NaCl is an entirely scary idea? Though of course it didn't even occur to the Google guys to research the name before stealing it from another project predating theirs by 2 years...

"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Kyall

  • Single posting newcomer
  • *
  • Posts: 5
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #6 on: April 17, 2012, 01:09:01 pm »
Though of course it didn't even occur to the Google guys to research the name before stealing it from another project predating theirs by 2 years...

Is the NaCl a derivative of that project?  Or did they just get to the copyright first?

I ended up doing the 2 build target thing, since it'll be a project template it isn't too rough to have that since it's not like I'll have to config it every time.  Will be looking into this more tomorrow, thanks for all the help guys, really made things easier for me.

As for the second question that was to try and avoid the 2 build targets, but after reading some doc and looking and that I figured the only way is the 2 build targets, the only way without changing source code or what have you.  Debugging's going to be a prick though since there isn't an NaCl emulator, you just have to run it in the browser.  Hope chrome comes out with a debug emulator that can be used to run nacl projects soon, the compiler options that c::b has look extremely useful, if only nacl wasn't missing a couple of the exes.  (debug and resource thing)

Offline Kyall

  • Single posting newcomer
  • *
  • Posts: 5
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #7 on: April 18, 2012, 07:42:20 am »
Got a problem, every time I boot code::blocks the settings I set up for the compiler are gone, does anyone know what settings file or whatever it is that windows isn't letting write permissions on that is causing this problem is located, because I haven't found it in the install directory or my local data....

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #8 on: April 18, 2012, 08:34:18 am »
%APP_DATA%/Codeblocks/default.conf
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #9 on: April 18, 2012, 10:52:15 am »
Though of course it didn't even occur to the Google guys to research the name before stealing it from another project predating theirs by 2 years...
Is the NaCl a derivative of that project?  Or did they just get to the copyright first?
No derivative. NaCL is a networking and crypto library started at the TU Eindhoven in 2008 with the first release in 2009 and to date maintained at DJB's site, wrapping curve25519, salsa20, poly1305 and such into a high-level framework.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline dgsprb

  • Single posting newcomer
  • *
  • Posts: 2
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #10 on: March 18, 2013, 06:27:20 pm »
I'm new to Code::Blocks and I'm also interested in NaCl development. Wouldn't it be nice if there was a project template for new NaCl projects within the new project wizard?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #11 on: March 18, 2013, 07:43:20 pm »
Probably, but someone doing nacl development should write the script and submit if for inclusion. Do you volunteer?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline dgsprb

  • Single posting newcomer
  • *
  • Posts: 2
Re: C::B Newb - Trying to use C::B for NaCl Development
« Reply #12 on: March 21, 2013, 11:22:57 pm »
Would love to, but unfortunatelly I don't have the skill in neither technology.  :-[