Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CMake static & TDM  (Read 1787 times)

0 Members and 1 Guest are viewing this topic.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
CMake static & TDM
« on: October 09, 2013, 08:20:00 pm »
So I've been meaning to implement a way to recognize TDM builds, so that SFML actually builds correctly and not static for shared & static (yeah I assume the official builds are built wrong as well). ;)

The critical part would involve changing the following lines (Macros.cmake:101):
    # for gcc >= 4.0 on Windows, apply the SFML_USE_STATIC_STD_LIBS option if it is enabled
    if(SFML_OS_WINDOWS AND SFML_COMPILER_GCC AND SFML_USE_STATIC_STD_LIBS)
        if(NOT SFML_GCC_VERSION VERSION_LESS "4")
            set_target_properties(${target} PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
        endif()
    endif()

But once I tried to change things around I started to ask myself:
  • Why do we not use -static, thus removing the need for the check, listing of both flags and linking everything possible static - which would be what one would expect. For example if the shipped compiler uses pthread for handling threads and one compiles just with -static-libgcc and -static-libstdc++ one will still have to ship the libwinpthread.dll, because it didn't get linked statically. So what's the reason for not using -static?
  • If you don't want to change it, would it be okay to pull the VERSION check into the upper if and do a TDM + shared/TDM + static check in an inner if?

Given the occasion of discussing linker stuff, I want to bring the other topic about properly linking dependencies again to attention. I still feel it should be changed... ;D
« Last Edit: October 09, 2013, 08:21:48 pm by eXpl0it3r »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10821
    • View Profile
    • development blog
    • Email
Re: CMake static & TDM
« Reply #1 on: October 10, 2013, 02:36:26 pm »
Damn binary1248 must have been right, that Laurent quit this thread when reading the last line first.  :-[

I guess, I'll just go ahead and move the discussion over to the pull request... ;D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: CMake static & TDM
« Reply #2 on: October 10, 2013, 06:33:53 pm »
I'm really sorry, I have no time. The only things I a able to do are answering on the forum and doing trivial tasks for SFML. Anything else is already too much for the moment :-\
Laurent Gomila - SFML developer