Dear Jörg, dear Windows aficionados, dear all.
On Mon, Nov 28, 2016 at 5:12 PM, <joerg....> wrote:
>
> I tried to get myself into CMake. I tried Matthias' tips about unistd. I
> also found two ports of dirent:
>
https://github.com/tronkko/dirent
>
http://www.two-sdg.demon.co.uk/curbralan/code/dirent/dirent.html
>
> However, when building configuration.cpp, which needs posixpathtools.h, I'm
> getting errors like:
> error C3861: 'chdir': identifier not found
> error C3861: 'lstat': identifier not found
> error C3861: 'fchdir': identifier not found
I don't really know anything about this, but probably you should
append underscores?
https://msdn.microsoft.com/en-us/library/ms235420.aspx
The page claims that "_chdir()" is more ISO C++ conformant than
"chdir()", which doesn't really make any sense at all, but whatever.
I guess this still won't work for "_lstat()", which doesn't seem to exist.
This probably isn't the easiest way to do this. See below.
> So I guess, the unistd.h ports are not 100% compatible. Any other ideas?
>>
>> > unistd
>>
>> This is used in a few places ... did you try including io.h as
>> suggested in the following links?
>>
http://stackoverflow.com/q/6365058
>>
http://stackoverflow.com/q/341817
>>
>> > dirent
>>
>> This is only used in src/posixpathtools.h, which would have to be
>> ported to Windows at some point.
>
> Does that mean, it's impossible to build and run the SSR on Windows without
> a working posixpathtools.h?
Well, yes.
It would of course not be called anything with "POSIX" in it's name,
but basically posixpathtools.h has to be ported to something like
windowspathtools.h.
Or some multi-platform library can be used instead.
I would prefer not to use Boost Filesystem, because Boost is a pain to
handle in the build system and we are actually just getting rid of it:
https://github.com/SoundScapeRenderer/ssr/pull/59
I think the easiest way is just to port it using native Windows API calls.
It's actually not necessary to port the low-level POSIX calls chdir()
etc., you only need to port the high-level functions that are actually
used in the SSR code. AFAICT, these are:
make_path_relative_to_file()
make_path_relative_to_current_dir()
get_file_extension()
get_escaped_filename()
We should then probably get rid of the namespace "posixpathtools" and
replace it by something more general like "pathtools". And the
functions which are only used internally should probably be moved to a
sub-namespace (named "pathtools::internal" or something. This would be
a sign that those are not supposed to be used outside.
I just saw that the Intersense tracker code uses some
platform-dependent functions:
https://github.com/SoundScapeRenderer/ssr/blob/master/src/trackerintersense.cpp
This will have to be replaced by the "get current working directory"
and "change directory" functions from the future "pathtools".
And we probably need some kind of "get a writable temporary directory"
function ...
We can then also create a new header file "pathtools.h" which just
includes the appropriate platform-specific header based on compiler
switches.
Does that make sense at all?
cheers,
Matthias