Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows for compilation on Linux #101

Merged
merged 13 commits into from May 1, 2017

Conversation

psi29a
Copy link
Member

@psi29a psi29a commented Jan 12, 2017

This is a cross-platform fix that should allow for building on Linux (tested), Windows (untested) and MacOS (untested).

  • use fmin/fmax as they are provided for us in C++11, removed min/max
  • removed windows.h
  • added additional typedefs and defines
  • use a gpl version of dxgiformat
  • also replaced tabs with spaces because tabs are evil ;)

To compile on Debian and Ubuntu, I use:

/usr/lib/x86_64-linux-gnu/qt5/bin/qmake -makefile NifSkope.pro

… defines in addition to pulling in a gpl version of dxgiformat, also replaced tabs with spaces because tabs are evil ;)

bring in dxgiformat
@psi29a
Copy link
Member Author

psi29a commented Jan 12, 2017

Once this is merged, I would like to do more work:

  • add Travis-CI and Appveyor for some CI on Windows, Linux and MacOS
  • create an ITP for Debian (and by extension Ubuntu) so that we can get this packaged for downstream use.
  • additional building documentation

@hexabits
Copy link
Member

also replaced tabs with spaces because tabs are evil ;)

I don't see where this was actually being done, but the NifSkope codebase is tabs-only, except block comments and for multi-line function parameter alignment, so it's a practice you'll need to adopt.

I unfortunately never got around to finishing this: https://github.com/niftools/nifskope/wiki/Coding-Style-Guide ... But it would include that new documents must use tabs and you must otherwise match the existing uses of spaces or tabs in existing documents. And the existing documents are all tabs.

@MiroslavR
Copy link

I don't see where this was actually being done

In NifSkope.pro.

@hexabits
Copy link
Member

I am concerned about the use of fmin/fmax in a non-floating point context. None of the values being compared are actually floats and just because C++11 allows using integer types now doesn't mean that we should. I would feel better using std::min/std::max myself.

With that said using fmin/fmax might be faster by using intrinsics, and theoretically none of the integer inputs would exceed integer representation (+/- (2^24 + 1)) and thus wouldn't have precision issues.

@psi29a
Copy link
Member Author

psi29a commented Feb 1, 2017

@jonwd7 thanks for reviewing, I reverted the formatting (tab2space) on NifSkope.pro. I also swapped out cmath's fmin/fmax for algorithm's std::min/max.

Does this help? :D

I have some travis-ci goodness in the pipe-line that requires these fixes to continue. ;)

BTW: your WIP code style guidelines mentions this:

Give empty bodies their own newlines for each bracket. For constructor initializers, keep the parent class on the same line as the definition, and any other members on the next line, indented 4 spaces.

I assumed that this is literally 4 spaces, not 1 tab. It would imply that any code written also be in spaces, not in tabs. I was using QtCreator's defaults on cleaning up before saving. I've disabled this for now.

We can do a reformatting in the future if this is wished. :)

try to compile now

turn on sudo and remove qt4
formatting

try without debian-sid
try getting qt5 from ppa

try to get qt latest git
try to trim time down and add clang
try setting path for qt5 on osx build

;
go recursive

build the damn thing

try niftools#3

try to get a dir listing

give me more output

try vcxproj instead of sln

try build dir

try defaults

fix bad yaml

try building now
almost there

try to get a nifskope dir

case sensative

try niftools#2

try niftools#3

get it right

try build_name

try hardcoded
@psi29a
Copy link
Member Author

psi29a commented Feb 2, 2017

Just added appveyor and travis-ci goodness so that we now build on: Linux, MacOS and Windows (32/64/release/debug).

@hexabits
Copy link
Member

hexabits commented Feb 3, 2017

Also, I'll leave it completely up to you to decide what to do with the files in install/linux-install and also makeconfig.sh in build. If whatever you are doing can work regardless of Linux distro, then we no longer need to keep those files. They were only there for posterity until a replacement was found.

Also, do the .yml files have to be in the project root? I assume for the two added so far the answer is yes, but I'm just bringing it up anyway. I think any additional files needed for any platform should go under build or install whenever possible.

Lastly, I saw that you've moved fsengine to all platforms. Historically I'm not sure of the reasons for making it Windows-only (maybe back in Qt4 when it used a virtual filesystem), but I'm guessing that the .pro file isn't the only place where this assumption is made. I wouldn't spend too much time getting it to work, as the entirety of the BSA loading code just needs to be completely replaced. It's an utter mess. Anyway, afaik there are several macro guards to keep certain functionality to Windows only at least for texture loading from archive, but I don't think that I did any such guards with my Archive Browser (mesh archives).

@psi29a
Copy link
Member Author

psi29a commented Feb 3, 2017

Thanks @jonwd7 ,

I'll be honest, I'm biased toward Debian/Ubuntu/and derivatives because that is what I work with day-in/day-out. That being said, what I'm doing isn't linux-distro dependent. The only thing we need to concern ourselves with is making a generic build that will work on the majority of linux-based systems regardless of distribution.

Distro specific packages, such as debs or rpms should be the problem of package maintainers downstream. I just happen to be a downstream developer for Debian (and via them Ubuntu), but I keep that totally separated from the work I do upstream. We'll get more millage out of having downstream handle their own packaging. :)

Is there no one maintaining the install/linux-install side of things? If not, then we can probably remove that in favor of a generic build/package nifskope.x.x.x.tar.gz solution.

In general, I'm against having binaries in source-control, like those found in install/win-install. It would be great if we could purge those (git history re-write) to trim down the size of the repo to keep it purely text. We can leverage appveyor to create packages for us and when we go to tag a release, we can just copy over the packages to our release. If we need to create exe/msi installer packages for nifskope, we can do that as well, though not in this PR. ;)

As for 'yet more files in root', I totally agree. Sadly our hands are tied here as travis and appveyor expect those files to be there. [1][2] I try very hard to keep those files as small, simple and easy to read as possible. However, if those files get too 'large' we can split out the scripts to a new CI directory or re-use the build directory and put CI under there. We're not there, yet. Our builds are thankfully very simple and our requirements are also small in comparison to larger projects I work on like OpenMW. ;)

fsengine was windows only because it included dds.h which included windows.h and dxgiformat.h who are by default only found on windows platforms. I found an license compatible solution for dxgiformat.h and added a bit to dds.h so fsengine should work without problems. I've tested the resulting build with lots of NIFs including ones 30MiB in size with lots of moving parts/animations/particles and textures. Everything seem to work like it does running a windows build under wine. If any issues come up, just assign the ticket to me and I'll have a look. I've not looked at the macro guards yet though, I'll give a look over but any results won't be in this PR.

I don't plan on doing any more work on this PR, I think it does its job in proving that we can build on the big 3 platforms. Any future work will land in other PRs, but they will likely require this one to go through first. :)

[1] https://docs.travis-ci.com/user/customizing-the-build/
[2] https://www.appveyor.com/docs/build-configuration/

@neomonkeus
Copy link
Member

Are we happy to merge then.

@psi29a
Copy link
Member Author

psi29a commented Apr 9, 2017

Ping? :)

@hexabits
Copy link
Member

hexabits commented May 1, 2017

Sorry @psi29a :)

OK I finally stashed my local repo stuff and pulled PR 101.

Rebuilt in debug/release for msvc and in release for gcc. I decided testing for any kind of speed regression for fmin/fmax->std::min/max is simply not worth it as the former wasn't technically correct to begin with. That whole section will probably have to be redone in order to add BC7 support anyway.

@psi29a One last question about 15df8e4 so that I know for the future. Is this a required change because of explicit lack of SSH support from Travis/Appveyor or is it just easier to use HTTPS with these tools? Whatever the reason I want to have it ingrained so I stick to https syntax in the future.

Also @neomonkeus the "All checks have passed" details... Is this a repo setting I can't see? Just wondering why the Appveyor link goes to neomonkeus/nifskope and Travis says niftools/nifskope. I'll eventually need to know what to put in the README.MD for the build status badges.

@hexabits hexabits merged commit 7261b0a into niftools:develop May 1, 2017
@psi29a
Copy link
Member Author

psi29a commented May 2, 2017

Well, for one the .gitmodules file wasn't consistent and that tickled my OCD a bit but the real problem is that I couldn't pull from those URLs so I made it consistent across all three with ones that did work.

In theory, it should work for you and me and others regardless. ;)

@neomonkeus
Copy link
Member

neomonkeus commented May 2, 2017

@jonwd7 Good spot. I enabled it on my account instead of the niftools one. Corrected now.

@neomonkeus
Copy link
Member

Ah, the problem is that even though AppVoyer knows about user/orgs. It is the user who is part of the org which will be referenced. Alternative is to create an account, but we don't have a corresponding one for github, as this is an org. Would have to convert everything to an user account which doesn't seem worth it.

@psi29a
Copy link
Member Author

psi29a commented May 2, 2017

@neomonkeus we had this discussion already that AppVayer is retarded about user/orgs. Remember that whole game of letting me get access to your account? That is why I pused for a Niftools account instead of using your account.

@darkbasic
Copy link

@psi29a when did you check last time if it's still working?
Doesn't work for me and I'm unsure if it's because of my architecture (ppc64le) or because the Linux build broke in the meantime: #167

@psi29a psi29a deleted the 2.0.0-dev6-linux-fix branch September 18, 2019 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants