[hpx-users] strange for-loop in hpx::util::find_prefixes() ?
Hi, while looking into making hpx install into lib64/, I came across hpx::util::find_prefixes(), which contains a loop I don't understand: That's the code: std::string prefixes = find_prefix(library); typedef boost::tokenizer > tokenizer; boost::char_separator sep(HPX_INI_PATH_DELIMITER); tokenizer tokens(prefixes, sep); std::string result; for(tokenizer::iterator it = tokens.begin(); it != tokens.end(); ++it) { ... find_prefix(), according to the code and to the documentation, returns "the installation path of the specified module", i.e. 1 path. Why is there the need to tokenize that using a PATH_DELIMITER (":" here) and then iterate over all tokens ? It looks to me like there is always exactly one path ? Related, later on in that loop, the subdirs "/bin" and "/lib" are hardcoded. Could that be changed to use the result from dll.get_directory() directly instead of trying to reconstruct it ? Alex ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
On 2017 M03 22, Wed 22:11:16 CET Alexander Neundorf wrote: > Hi, > > while looking into making hpx install into lib64/, I came across > hpx::util::find_prefixes(), which contains a loop I don't understand: > > That's the code: >std::string prefixes = find_prefix(library); > typedef boost::tokenizer > tokenizer; > boost::char_separator sep(HPX_INI_PATH_DELIMITER); > tokenizer tokens(prefixes, sep); > std::string result; > for(tokenizer::iterator it = tokens.begin(); it != tokens.end(); > ++it) { > ... > > > find_prefix(), according to the code and to the documentation, returns "the > installation path of the specified module", i.e. 1 path. > Why is there the need to tokenize that using a PATH_DELIMITER (":" here) and > then iterate over all tokens ? It looks to me like there is always exactly > one path ? IOW, can I remove the loop, maybe add a function util::find_library_dir(), and return in find_prefixes() the directory based on hpx_prefix and the directory based on the library dir ? Alex ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
Alex, Sorry for the delay, just as a heads-up: I'll get back to you later today. Regards Hartmut --- http://boost-spirit.com http://stellar.cct.lsu.edu > -Original Message- > From: hpx-users-boun...@stellar.cct.lsu.edu [mailto:hpx-users- > boun...@stellar.cct.lsu.edu] On Behalf Of Alexander Neundorf > Sent: Friday, March 24, 2017 4:19 PM > To: hpx-users@stellar.cct.lsu.edu > Subject: Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ? > > On 2017 M03 22, Wed 22:11:16 CET Alexander Neundorf wrote: > > Hi, > > > > while looking into making hpx install into lib64/, I came across > > hpx::util::find_prefixes(), which contains a loop I don't understand: > > > > That's the code: > >std::string prefixes = find_prefix(library); > > typedef boost::tokenizer > > tokenizer; > > boost::char_separator sep(HPX_INI_PATH_DELIMITER); > > tokenizer tokens(prefixes, sep); > > std::string result; > > for(tokenizer::iterator it = tokens.begin(); it != tokens.end(); > > ++it) { > > ... > > > > > > find_prefix(), according to the code and to the documentation, returns > "the > > installation path of the specified module", i.e. 1 path. > > Why is there the need to tokenize that using a PATH_DELIMITER (":" here) > and > > then iterate over all tokens ? It looks to me like there is always > exactly > > one path ? > > IOW, can I remove the loop, maybe add a function util::find_library_dir(), > and > return in find_prefixes() the directory based on hpx_prefix and the > directory > based on the library dir ? > > Alex > > ___ > hpx-users mailing list > hpx-users@stellar.cct.lsu.edu > https://mail.cct.lsu.edu/mailman/listinfo/hpx-users ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
On 2017 M03 24, Fri 16:53:03 CEST Hartmut Kaiser wrote: > Alex, > > Sorry for the delay, just as a heads-up: I'll get back to you later today. I know it's not fancy, but could you havea look ? Thanks Alex ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
> On 2017 M03 24, Fri 16:53:03 CEST Hartmut Kaiser wrote: > > Alex, > > > > Sorry for the delay, just as a heads-up: I'll get back to you later > today. > > I know it's not fancy, but could you havea look ? Alex, I sincerely apologize for the delay. Too many things are going on at the same time. > find_prefix(), according to the code and to the documentation, returns "the > installation path of the specified module", i.e. 1 path. > Why is there the need to tokenize that using a PATH_DELIMITER (":" here) and > then iterate over all tokens ? It looks to me like there is always exactly one > path ? While find_prefix() may in principle return a list of directories. The original idea was to encode there the build directory and the installation directory of the core library. Frankly, I don't remember why the code evolved to always return just one directory. So it might be ok to assume it's always one. Please add an HPX_ASSERT enforcing that if you change the code. > Related, later on in that loop, the subdirs "/bin" and "/lib" are hardcoded. > Could that be changed to use the result from dll.get_directory() directly > instead of trying to reconstruct it ? dll.get_directory() is not supported on all platforms (Android and Mic spring to mind). But for those platforms where it's supported we could derive one of the directory prefixes from the name of the library (/lib). The /bin directory would have to stay hardcoded, however. One more remark. Historically we ended up having different directory and file layouts on Windows compared to the other platforms. Windows: //bin/: all executables and all dlls /bin/hpx: all plugins (dlls) which are dynamically loaded /lib: all libraries (libs) for the dlls /lib/hpx: all libraries (libs) for plugin dlls All other platforms /bin/: all executables /lib: all libraries (.so) /lib/hpx: all plugins libraries (.so) for If you change the hardcoded names to something else, you'd need to adjust the cmake scripts accordingly. Regards Hartmut --- http://boost-spirit.com http://stellar.cct.lsu.edu ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
Hi, thanks for the detailled answer, but I still have a few questions. On 2017 M03 30, Thu 17:14:46 CEST Hartmut Kaiser wrote: > > On 2017 M03 24, Fri 16:53:03 CEST Hartmut Kaiser wrote: > > > Alex, > > > > > > Sorry for the delay, just as a heads-up: I'll get back to you later > > today. > > I know it's not fancy, but could you havea look ? > > Alex, I sincerely apologize for the delay. Too many things are going on at > the same time. > > > find_prefix(), according to the code and to the documentation, returns > "the installation path of the specified module", i.e. 1 path. > > Why is there the need to tokenize that using a PATH_DELIMITER (":" here) > > and > > then iterate over all tokens ? It looks to me like there is always exactly > > one path ? > > While find_prefix() may in principle return a list of directories. The > original idea was to encode there the build directory and the installation > directory of the core library. Hmm, I'm not sure I understand. find_prefix() should return the prefix where the library is installed, right ? What do you mean with encode "the build dir AND the installation dir" ? Shouldn't the install dir be enough ? A related question, why is HPX_PREFIX adjustable by hpx-using projects (e.g. in hpx::init(): util::set_hpx_prefix(HPX_PREFIX); Thanks Alex ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
> thanks for the detailled answer, but I still have a few questions. > > On 2017 M03 30, Thu 17:14:46 CEST Hartmut Kaiser wrote: > > > On 2017 M03 24, Fri 16:53:03 CEST Hartmut Kaiser wrote: > > > > Alex, > > > > > > > > Sorry for the delay, just as a heads-up: I'll get back to you later > > > today. > > > I know it's not fancy, but could you havea look ? > > > > Alex, I sincerely apologize for the delay. Too many things are going on > at > > the same time. > > > > > find_prefix(), according to the code and to the documentation, returns > > "the installation path of the specified module", i.e. 1 path. > > > Why is there the need to tokenize that using a PATH_DELIMITER (":" > here) > > > and > > > then iterate over all tokens ? It looks to me like there is always > exactly > > > one path ? > > > > While find_prefix() may in principle return a list of directories. The > > original idea was to encode there the build directory and the > installation > > directory of the core library. > > Hmm, I'm not sure I understand. > find_prefix() should return the prefix where the library is installed, > right ? > What do you mean with encode "the build dir AND the installation dir" ? > Shouldn't the install dir be enough ? HPX runs without being installed as well (i.e. from the build directories). > A related question, why is HPX_PREFIX adjustable by hpx-using projects > (e.g. > in hpx::init(): util::set_hpx_prefix(HPX_PREFIX); HPX_PREFIX is a preprocessor macro pointing to the installation directory (CMAKE_INSTALL_PREFIX). This is a fallback for the platforms where we can't determine at runtime the directory the executable was launched from. Regards Hartmut --- http://boost-spirit.com http://stellar.cct.lsu.edu ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users
Re: [hpx-users] strange for-loop in hpx::util::find_prefixes() ?
> What do you mean with encode "the build dir AND the installation dir" ? Shouldn't the install dir be enough ? > I wasn't following this thread so I have no idea what you're referring to, but most of use never do a make install - since we're developing hpx itself and changing things frequently, we do a build and then set other project that need HPX to point to the build dir of HPX. This means we generate HPX-config.cmake files etc in the build dir - as well as - in the install dir and use the build location as a kind of install loc. off topic: I have a setup with Superproject DIR -- hpx subdir -- proj A subir -- proj B subdir etc and about 10 projects all compiled as one bigger project, with some cmake superproject scripts to control it so that when projB calls find_package(projA) it gets found in the right build location - etc etc hth JB ___ hpx-users mailing list hpx-users@stellar.cct.lsu.edu https://mail.cct.lsu.edu/mailman/listinfo/hpx-users