3

I have a project generated via the simple layout. My layout.bii:

cmake: bii/cmake
lib: bii/lib
build: bii/build

deps: bii/deps
auto-root-block: True

When I perform the following...

bii cpp:configure -G "Visual Studio 12"
bii cpp:build

... It modifies layout.bii to add this line at the end root-block: user/testsdl2.

This seems to be in conflict with the auto-root-block flag and may be related to my issue.

My question: The file generated is user_testsdl2_main.exe. How do I specify something like "testsdl2.exe"?

wtjones
  • 4,090
  • 4
  • 34
  • 41

1 Answers1

4

The auto-root-block: True behavior works as follows:

  • If there is inside the project root a biicode.conf corresponding to the main project block, with a [parent] section, then, the block name will be taken from it.
  • If there is no biicode.conf with parent, then the block name will be automatically defined from the current user and the project folder name. Changing either of them, should rename the block.

Renaming the project folder is simple, changing the current user name is done with:

$ bii user myusername

If you want a specific block-name, write either the [parent] or disable the auto-root-block and write manually the root-block.

Changing the executable output name is simple with CMake. Add to your CMakeLists.txt:

ADD_BIICODE_TARGETS()
SET_TARGET_PROPERTIES(${BII_main_TARGET} PROPERTIES OUTPUT_NAME testsdl2)

Where the actual tartet name will depend on the path of the file containing the main() function, if it is inside src/myfile.cpp, then the EXEcutable target name will be ${BII_src_myfile_TARGET}

Another tip, from 2.6.3, you can skip the cpp:, and write just bii build, bii configure

drodri
  • 5,157
  • 15
  • 21
  • Sorry, I guess I don't understand. Why would I change my username to set the name of the exe? Regarding [parent], I'm not sure what to put. "."? "testsdl2"? I get an error as it wants user/block I also tried your suggestion regarding CMakeLists.txt but it did not make a difference. – wtjones Mar 15 '15 at 23:54
  • Code is organized in blocks. Each block is called "username/block". A file called "main2.cpp" with a main() function inside will generate and executable called "username_block_main2". This is to avoid name clashes when building multipe executables. If you are running without registering (anonymous), then the user is called "user". To let biicode know about the registered user you wan to use, you can use the "bii user wtjones" command, then leave your [parent] blank, it will be named automatically when publishing the first time as "wtjones/testsdl2". You can also write it "wtjones/testsdl2: -1" – drodri Mar 16 '15 at 00:20
  • I was able to resolve this using your CMakeLists.txt suggestion, but the variable was not in the form `${BII_user_project_TARGET}`, but rather based on the directory/source structure. For mine, it looks like this: `SET_TARGET_PROPERTIES(${BII_src_main_TARGET} PROPERTIES OUTPUT_NAME testsdl2)`. I [dumped the cmake variables](http://stackoverflow.com/a/9328525/107161) to find it. – wtjones Mar 22 '15 at 15:11
  • You are right, thanks for the suggestion, I have edited the answer, adding also a small explanation about the target name. – drodri Mar 22 '15 at 23:06