ousnius / nifly

C++ NIF library for the Gamebryo/NetImmerse File Format
GNU General Public License v3.0
52 stars 23 forks source link

static library size is too big. #11

Closed TommInfinite closed 3 years ago

TommInfinite commented 3 years ago

Hello! When I'm building nifly DLL as a static library, it's size is 18 mb(in Release mode). Is this normal or am I doing something wrong? I previously used cmake-gui to build the .sln project. This is my first time building dependencies on other libraries so I'd appreciate help with this.

ousnius commented 3 years ago

@TommInfinite The release .lib file I got was actually over 50 MB before I added the /Zc:inline compiler flag for MSVC, which I just did with https://github.com/ousnius/nifly/commit/e55035bd997211f30a0c5443a182043c3b8ac0c2

I think the 18 MB size is normal for now, it won't be that large when linking it into your final executable or library because the unused parts of the lib will be removed. Still it's worth investigating, as 18 MB is still not on the smaller side.

TommInfinite commented 3 years ago

So in the end I: 1)Used CMake to build "nifly.lib". 2)Added it to my Project folder and added the folder to "Additional Library Directories" in "Properties" 3) Added "nifly.lib" to "Additional dependencies" to "Input" So when I try to write code, Visual Studio is behaving like library doesn't exists. (Identifier "NifFile" is undefined and etc.) Have I missed a something?

ousnius commented 3 years ago

So in the end I: 1)Used CMake to build "nifly.lib". 2)Added it to my Project folder and added the folder to "Additional Library Directories" in "Properties" 3) Added "nifly.lib" to "Additional dependencies" to "Input" So when I try to write code, Visual Studio is behaving like library doesn't exists. (Identifier "NifFile" is undefined and etc.) Have I missed a something?

You need to include the headers as well.

TommInfinite commented 3 years ago

I tried to and failed as well.

Not #include "NifFile.hpp" nor "#include "include\NifFile.hpp"" work.

ousnius commented 3 years ago

You might have to find a tutorial on how to link and include libraries with C++ online, nifly is nothing special here. Closing this as it has nothing directly to do with nifly any longer.