rossvideo / Catena

BSD 3-Clause "New" or "Revised" License
6 stars 2 forks source link

need a -lite version of the SDK #177

Closed mejohnnaylor closed 3 months ago

mejohnnaylor commented 4 months ago

this is a bigger than a single issue, but a good start would be to update the cmake files to pass in the options that are currently inline in the proto files as command-line options. This would allow us to build 3 different targets of .pb.h output files: 1) java 2) c++ sdk as we do today 3) c++ lite sdk - to be developed, but getting the cmake right is a starting point and a good, self-contained PR.

johndanenRV commented 4 months ago

After some research I have found that protobuf does not have a built-in way to do this. There is two work-around ways of doing this:

  1. you can use a CMake script to duplicate the protobuf src files into the build folder then append the options to the duplicated files before running the protoc compiler.
  2. You can use #ifdef around the option then run the C precompiler on the protobuf src files before running the protoc compiler.
mejohnnaylor commented 4 months ago

Wouldn’t this help?

@ Read options and filenames from file. If a relative file path is specified, the file will be searched in the working directory. The --proto_path option will not affect how this argument file is searched. Content of the file will be expanded in the position of @ as in the argument list. Note that shell expansion is not applied to the content of the file (i.e., you cannot use quotes, wildcards, escapes, commands, etc.). Each line corresponds to a single argument, even if it contains spaces.

Run protoc -h to get this help message

John

From: johndanenRV @.> Date: Monday, June 3, 2024 at 10:29 AM To: rossvideo/Catena @.> Cc: John Naylor @.>, Author @.> Subject: [EXTERNAL] Re: [rossvideo/Catena] need a -lite version of the SDK (Issue #177)

After some research I have found that protobuf does not have a built-in way to do this. There is two work-around ways of doing this:

  1. you can use a CMake script to duplicate the protobuf src files into the build folder than append the options to the duplicated files.
  2. You can use #ifdef around the option then run the C precompiler on the protobuf src files before running the protoc compiler.

— Reply to this email directly, view it on GitHubhttps://github.com/rossvideo/Catena/issues/177#issuecomment-2145513319, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6R5EEK27NOPRZWOGXO4NXDZFSDTTAVCNFSM6AAAAABITMMZDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGUYTGMZRHE. You are receiving this because you authored the thread.Message ID: @.***>


This e-mail and any attachments may contain information that is confidential to Ross Video.

If you are not the intended recipient, please notify me immediately by replying to this message. Please also delete all copies. Thank you.

mejohnnaylor commented 4 months ago

Running the c preprocessor sounds like it might work based.

Macros could be defined on the cpp commandline with the -D option, and used in the file something like this:

cpp -D OPTIMIZE_FOR=SPEED infile outfile

option optimize_for = OPTIMIZE_FOR;

From: johndanenRV @.> Date: Monday, June 3, 2024 at 10:29 AM To: rossvideo/Catena @.> Cc: John Naylor @.>, Author @.> Subject: [EXTERNAL] Re: [rossvideo/Catena] need a -lite version of the SDK (Issue #177)

After some research I have found that protobuf does not have a built-in way to do this. There is two work-around ways of doing this:

  1. you can use a CMake script to duplicate the protobuf src files into the build folder than append the options to the duplicated files.
  2. You can use #ifdef around the option then run the C precompiler on the protobuf src files before running the protoc compiler.

— Reply to this email directly, view it on GitHubhttps://github.com/rossvideo/Catena/issues/177#issuecomment-2145513319, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6R5EEK27NOPRZWOGXO4NXDZFSDTTAVCNFSM6AAAAABITMMZDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGUYTGMZRHE. You are receiving this because you authored the thread.Message ID: @.***>


This e-mail and any attachments may contain information that is confidential to Ross Video.

If you are not the intended recipient, please notify me immediately by replying to this message. Please also delete all copies. Thank you.

johndanenRV commented 4 months ago

The @\<filename> argument is just for specifying a file containing command line arguments for the protoc compiler. This won't help us since the options can't be set by the command line. There might be a protobuf plugin that adds this, but I think the C preprocessor will be the easier option.

Wouldn’t this help? @ Read options and filenames from file. If a relative file path is specified, the file will be searched in the working directory. The --proto_path option will not affect how this argument file is searched. Content of the file will be expanded in the position of @ as in the argument list. Note that shell expansion is not applied to the content of the file (i.e., you cannot use quotes, wildcards, escapes, commands, etc.). Each line corresponds to a single argument, even if it contains spaces. Run protoc -h to get this help message John From: johndanenRV @.> Date: Monday, June 3, 2024 at 10:29 AM To: rossvideo/Catena @.> Cc: John Naylor @.>, Author @.> Subject: [EXTERNAL] Re: [rossvideo/Catena] need a -lite version of the SDK (Issue #177) After some research I have found that protobuf does not have a built-in way to do this. There is two work-around ways of doing this: 1. you can use a CMake script to duplicate the protobuf src files into the build folder than append the options to the duplicated files. 2. You can use #ifdef around the option then run the C precompiler on the protobuf src files before running the protoc compiler. — Reply to this email directly, view it on GitHub<#177 (comment)>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6R5EEK27NOPRZWOGXO4NXDZFSDTTAVCNFSM6AAAAABITMMZDOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBVGUYTGMZRHE. You are receiving this because you authored the thread.Message ID: @.***> ---------------------------------------------- This e-mail and any attachments may contain information that is confidential to Ross Video. If you are not the intended recipient, please notify me immediately by replying to this message. Please also delete all copies. Thank you.