wjakob / nanogui

Minimalistic GUI library for OpenGL
Other
4.66k stars 608 forks source link

Compilation with TDM-GCC under windows #27

Closed phicore closed 8 years ago

phicore commented 8 years ago

It can be done but the CMakelists.txt must be sligthly updated

First WIN32 must be defined explicitely by adding:

if(WIN32)
    add_definitions ("-DWIN32")
endif()

and also adding -std=c++11 in case we are not using MSVC

if(MSVC)
  if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
    string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
  else()
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
  endif()
else()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -std=c++11")
endif()

Beside this nanogui works out of the box with the current TDM (tdm64-gcc-5.1.0-2.exe)

wjakob commented 8 years ago

Hi,

I decided to make a different set of changes. Can you check if you can compile the latest version out of the box?

Thanks, Wenzel

phicore commented 8 years ago

Hi,

Your last changes have the benefit of creating the library and the both examples out of the box without tweaking the CMakelists.txt.

But unfortunately the executables are not working anymore:

image

During the link phase i saw something new about LTO items

image

Indeed if I comment out the line

  set_property(TARGET nanogui APPEND_STRING PROPERTY COMPILE_FLAGS "-flto ")

Everything is fine again. So the message is clear TDM-GCC unlike standard GCC doesn't like LTO.

Best regards

phicore commented 8 years ago

I was able to suppress the linker warnings by applying what is included here :

http://stackoverflow.com/questions/32221221/mingw-x64-windows-plugin-needed-to-handle-lto-object

But the executables are still not working

So the only thing working for me currently is removing the -flto option altogether.

wjakob commented 8 years ago

ok, another attempt. I tried to add some code that tries to autodetect if -flto is supported in the first place.

Can you check if you're able to compile the latest nanogui out of the box?

wjakob commented 8 years ago

I committed this in cee7e0307866cf4897f5eb9f1aece3aba0b51630 -- please check that version.

phicore commented 8 years ago

It works perfectly now out of the box. Thanks for supporting a now even larger set of the platforms out there.

wjakob commented 8 years ago

Great, thanks. I am closing this ticket then.