simongeilfus / Cinder-Runtime

Runtime-Compiled C++ for Cinder
57 stars 43 forks source link

Added support for CINDER_PATH. #23

Closed num3ric closed 6 years ago

simongeilfus commented 6 years ago

Sweet, thanks for this! I didn't know about std::getenv which makes me think that it would really nice to have something along those lines to support other env variables. I had to change quite a few CUDA_PATH in my project settings a few days ago because of this.

// replace project macros ( ex: $(Configuration), $(Platform), ... )
for( const auto &macro :  config.getMacros() ) {
    replaceAll( output, macro.first, macro.second );
}
// replace user macros
for( const auto &macro : settings->getUserMacros() ) {
    replaceAll( output, macro.first, macro.second );
}
// replace env variables ( ex: $(CINDER_PATH), $(CUDA_PATH), ... )
for( const auto &env : findEnvVariables( input ) ) {
       if( auto var = std::getenv( env ) ) {
             replaceAll( output, env, var ); 
       }
}