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

Author Topic: Building multiple targets for MingW with CMake  (Read 3237 times)

0 Members and 1 Guest are viewing this topic.

Kian

  • Newbie
  • *
  • Posts: 44
    • View Profile
Building multiple targets for MingW with CMake
« on: May 03, 2013, 04:22:46 pm »
Hi, I was wondering if it is possible to crate a makefile that will build Release and Debug versions of SFML with CMake.

What I'm doing now is load CMake, set target to Release, Configure, Generate, then run mingw32-make install, then go back to CMake, set the target to Debug, and repeat. I was wondering if there was some target that automatically built both versions.

Thanks.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Building multiple targets for MingW with CMake
« Reply #1 on: May 03, 2013, 04:27:43 pm »
You can create batch/shell script, that does this automatically, but CMake itself doesn't offer such options afaik. ;)
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: 32498
    • View Profile
    • SFML's website
    • Email
Re: Building multiple targets for MingW with CMake
« Reply #2 on: May 03, 2013, 05:22:35 pm »
Keep each build configuration in a separate folder, there's no need to overwrite the same one again and again.
Laurent Gomila - SFML developer

Kian

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Building multiple targets for MingW with CMake
« Reply #3 on: May 03, 2013, 11:22:43 pm »
Ah, right. The not-dumb way of doing it. Should have thought of it before :) And a batch file automates the rest of the process.

I just need to add a script to check the repository for updates, download changes, and build everything.

Kian

  • Newbie
  • *
  • Posts: 44
    • View Profile
Re: Building multiple targets for MingW with CMake
« Reply #4 on: May 03, 2013, 11:56:18 pm »
Quick additional question!

The tutorial didn't make it clear for me. If I want to create the static version of the libraries with cmake, do I just need to turn off the "BUILD_SHARED_LIBS" variable, or do I also have to select "SFML_USE_STATIC_STD_LIBS"? I understand I can't have both on at the same time, I'm just not sure if the second one is actually necessary for building the static library.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Building multiple targets for MingW with CMake
« Reply #5 on: May 04, 2013, 12:30:03 am »
BUILD_SHARED_LIBS decides whether the library is build shared or static.
SFML_USE_STATIC_STD_LIBS decides whether SFML links against the runtime library shared or static.

It doesn't make sense to link against the runtime libraries statically, while building shared libraries, thus you're not given that option.
If you link the runtime libraries shared, then you'll have to provide the needed shared libs (e.g. for Visual Studio this would be the redistribution thingy, or for MinGW that would be libgcc and libstd).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything