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

Author Topic: SFML source and Visual Studio 2013  (Read 4290 times)

0 Members and 1 Guest are viewing this topic.

yoni0505

  • Newbie
  • *
  • Posts: 9
    • View Profile
SFML source and Visual Studio 2013
« on: September 30, 2013, 02:24:30 pm »
Today I tried to compile SFML for Visual Studio 2013 Express RC.
Using CMake-GUI, I configured to make static libs (BUILD_SHARED_LIBS unchecked), and some of the projects failed to load.

The problem was that some of the .vcxproj files had unnecessary &quot";" next to some of the quotes inside tags.
So to fix it you simply have to remove all the &quot";" from these files.

I'm unfamiliar with the cmake stuff, so is it a bug with CMake-GUI, Visual Studio 2013, or the implementation of SFML's cmake?

Oh and if anyone is interested, here's the VS 2013 RC build I compiled:
http://www.mediafire.com/?49879nw207yv0ac
« Last Edit: September 30, 2013, 02:36:48 pm by yoni0505 »
"There is no knowledge that is not power."

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: SFML source and Visual Studio 2013
« Reply #1 on: September 30, 2013, 02:29:13 pm »
Shouldn't have anything to do with SFML, since the build script is using CMake language to describe what CMake itself should generate. Then again you're using an RC = Release Candidate = Not Officially Released = Might Have Bugs version of Visual Studio, so you shouldn't be surprised if you run into any issues. ;D
I'm sure once VS12 is officially out, CMake will bring out an update, which will be fully compatible. In the mean time, you might want to generate NMake files instead.
« Last Edit: September 30, 2013, 02:32:06 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/

MorleyDev

  • Full Member
  • ***
  • Posts: 219
  • "It is not enough for code to work."
    • View Profile
    • http://www.morleydev.co.uk/
Re: SFML source and Visual Studio 2013
« Reply #2 on: September 30, 2013, 03:41:47 pm »
To be honest, the CMake GUI sucks. Always has. It's much easier to just use the command line.

Also to build SFML for Visual Studio 2013 RC at the moment, I have found I have to explicitly tell msbuild to change a flag to the correct visual studio version. The following works for me when ran by the command line: EDIT: Nevermind, last cmake update added Visual Studio 12 support. I've modified the scripts to reflect.

Code: [Select]
cmake <PATH TO SFML> -G"Visual Studio 11"
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /p:Configuration=Release SFML.sln

Obviously replacing <PATH TO SFML> with the path to the root of the SFML directory. Also the location of the VS12 (Visual Studio 2013) msbuild on your system may be different.

EDIT: Here's a batch script (save it as a .bat and run from the command line) to completely download and rebuild SFML, and extract the headers, libs and bin into appropriate folders for both debug and release.

Code: [Select]
mkdir sfml2
pushd sfml2
mkdir include
mkdir lib
mkdir bin

git clone https://github.com/SFML/SFML.git
pushd SFML
mkdir build
pushd build
cmake .. -G"Visual Studio 12"
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /m:10 /p:Configuration=Debug SFML.sln
"C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" /m:10 /p:Configuration=Release SFML.sln

xcopy lib\Debug\*.lib ..\..\lib /Y /S /I
xcopy lib\Debug\*.dll ..\..\bin /Y /S /I

xcopy lib\Release\*.lib ..\..\lib /Y /S /I
xcopy lib\Release\*.dll ..\..\bin /Y /S /I
popd
xcopy include ..\include /Y /S /I
popd
rd SFML /S /Q
popd
« Last Edit: September 30, 2013, 08:18:29 pm by MorleyDev »
UnitTest11 - A unit testing library in C++ written to take advantage of C++11.

All code is guilty until proven innocent, unworthy until tested, and pointless without singular and well-defined purpose.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: SFML source and Visual Studio 2013
« Reply #3 on: September 30, 2013, 05:40:48 pm »
No wonder CMake doesn't find the right version if specify the wrong one. It should be cmake -G"Visual Studio 12" not 11 (VS 11 = VS 2012, VS12 = VS 2013). Also you always have to specify which generator to use, plus the GUI is not bad at all, it's basically just listing all your variables, thus it's easier to play around with since you don't have to retype everything and you can easily switch between normal and advanced settings. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

The Illusionist Mirage

  • Full Member
  • ***
  • Posts: 115
  • My Life = Linux, C++ & Computers
    • View Profile
    • fleptic
    • Email
Re: SFML source and Visual Studio 2013
« Reply #4 on: September 30, 2013, 05:41:54 pm »
To be honest, the CMake GUI sucks. Always has. It's much easier to just use the command line.   

Up to some extent,  I agree with you that the command line is better than GUI. Since I am quite new to CMake myself, whenever a build fails in the command line, I have to revert to the GUI.

MorleyDev

  • Full Member
  • ***
  • Posts: 219
  • "It is not enough for code to work."
    • View Profile
    • http://www.morleydev.co.uk/
Re: AW: SFML source and Visual Studio 2013
« Reply #5 on: September 30, 2013, 08:03:31 pm »
Huh, I'm sure when I looked at the list of generators for 2.8.11 it still didn't list Visual Studio 12...my mistake. I've amended my original post, and modified the scripts I posted to reflect.

CMake gui gives me more issues than command line ever does over the little things like "MinGW Makefiles" needing CMAKE_MAKE_PROGRAM defined.

I still stand by it's better to use the cmake command line, but I can be a bit obsessed with automation at times. Why do yourself what the computer can be scripted to do for you in two lines? :) I always script my 3rd party installs nowadays, much easier than faffing around with manual copying and manual building.
« Last Edit: September 30, 2013, 08:18:44 pm by MorleyDev »
UnitTest11 - A unit testing library in C++ written to take advantage of C++11.

All code is guilty until proven innocent, unworthy until tested, and pointless without singular and well-defined purpose.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: SFML source and Visual Studio 2013
« Reply #6 on: September 30, 2013, 08:24:35 pm »
Tbh I was surprised as well that VS 12 was in. :D

Yeah I also use scripts (e.g. for my Nigthly Builds), thus it's a must there, but whenever I get a new library, I rather go with the GUI, because I don't know what variables the CMake script generates for me, and hsving to type all these lengthy name (CMAKE_MODULE_PATH, CMAKE_BUILD_SHARED, etc etc), is just rather painful, especially since CMake generates these names for me with GUI. Or mind you add a space between -D and your variable, good luck figuering out the error. ;D
Of course you can keep your opinion, not trying to convince you, just showing the benefits I see. :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: SFML source and Visual Studio 2013
« Reply #7 on: September 30, 2013, 08:53:52 pm »
What about cmake -i?
Back to C++ gamedev with SFML in May 2023

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: AW: SFML source and Visual Studio 2013
« Reply #8 on: September 30, 2013, 10:31:07 pm »
CMake gui gives me more issues than command line ever does over the little things like "MinGW Makefiles" needing CMAKE_MAKE_PROGRAM defined.
  • Open a command prompt with admin rights.
  • Go to MinGW's bin dir.
  • Run "mklink /D make.exe mingw32-make.exe"
  • Profit. :)

gbromios

  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: SFML source and Visual Studio 2013
« Reply #9 on: November 10, 2013, 05:11:44 am »

I know it was meant to be a simple example of how to make for vs2013, but this explanation is actually the nicest, cleanest tutorial for building libs on Windows I've ever seen. This is a process which before was completely opaque and baffling to me as someone who has only ever really programmed in Linux. Thanks!!