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

Tweaks and instructions for a workable windows build #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

AtheMathmo
Copy link

@AtheMathmo AtheMathmo commented Feb 9, 2022

Resolves #12

@sgsellan
Copy link
Owner

sgsellan commented Feb 9, 2022

@bathal1 , this is to make the python bindings compilable in windows. Would you mind checking that they are not broken in linux/Mac systems by adding this?

@sgsellan sgsellan requested a review from bathal1 February 9, 2022 16:54
@bathal1
Copy link
Collaborator

bathal1 commented Feb 11, 2022

The dllimport and dllexport flags are Windows-specific, and this PR currently breaks the build on Linux. Please modify your changes to only use these flags on windows using this macro:

#if defined(_MSC_VER)
#  define BOTSCH_EXPORT(__declspec(dllexport))
#else
#  define BOTSCH_EXPORT
#endif

@AtheMathmo
Copy link
Author

AtheMathmo commented Feb 11, 2022

I've added the macro and tested that the windows build goes through okay. In doing so, I've potentially shown my hand as not-really-a-c++-developer. Feel free to make changes directly or advise me on how to modify the source.

P.S. If you're familiar with windows build systems, any idea how to have cmake produce remesh as a static library instead of dynamic? Right now this needs to be changed manually.

Edit: What I mean is that visual studio seems to want remesh to be a static library; the remeshmesh project seeks a .lib instead of the .dll that is produced. Can you safely change remesh to a static library on the linux build? Or do we need to modify remeshmesh to seek the dynamic library instead?

@bathal1
Copy link
Collaborator

bathal1 commented Feb 11, 2022

Thanks. You can switch to a static library by changing the SHARED keyword in CMakeLists.txt:26 to STATIC. Why do you need to change this?

@AtheMathmo
Copy link
Author

As a dynamic library I get the following error when trying to build on windows

image

I'm not sure if it is environment specific or more general.

@mworchel
Copy link

mworchel commented Jun 11, 2022

Hi, I've encountered the same issues as @AtheMathmo some months ago and I've been successfully using a static build of the library on Linux and Windows for quite some time.

Now after some quick googling, adding this seems to be the actual fix for building the shared library with CMake >= 3.4:

set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

EDIT: Also, instead of having a separate install section for each OS, it's probably better to just use the cmake commands:

# Use `Debug` instead of `Release` for debug builds
cmake . -B build -DCMAKE_BUILD_TYPE=Release 
cmake --build build --config Release --parallel 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error when building on windows
4 participants