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

Author Topic: batch file replace libraries with variable  (Read 862 times)

0 Members and 1 Guest are viewing this topic.

C_Worm

  • Newbie
  • *
  • Posts: 18
    • View Profile
batch file replace libraries with variable
« on: July 31, 2019, 01:04:33 pm »
I thought were supposed to be able to set all the libraries in one variable but it doesn't seem to work, if i replace the lin libraries with the variable i get a TON of error becuase the compiler don't seem to link the libraries.

How can this be solved?

THIS WORKS:
Code: [Select]
@echo off

IF NOT DEFINED winLibs SET winLibs = user32.lib gdi32.lib winmm.lib Opengl32.lib ws2_32.lib advapi32.lib
IF NOT DEFINED sfmlDependLibsX64 (SET sfmlDependLibsX64 = /LIBPATH:"C:\SFML\SFML-2.5.1_x64\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib)
IF NOT DEFINED sfmlDependLibsX86 (SET sfmlDependLibsX86 = /LIBPATH:"C:\SFML\SFML-2.5.1_x86\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib)

If NOT EXIST ..\buildx64 mkdir ..\buildx64
If NOT EXIST ..\buildx86 mkdir ..\buildx86

pushd ..\buildx64

cl /MD /EHsc -Zi -nologo /I ..\include ..\src\CJsfml_001.cpp /link user32.lib gdi32.lib winmm.lib Opengl32.lib ws2_32.lib advapi32.lib /LIBPATH:"C:\SFML\SFML-2.5.1_x64\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib  sfml-system-s.lib sfml-graphics-s.lib sfml-window-s.lib sfml-audio-s.lib sfml-network-s.lib

popd

:: ------------------ x86 BUILD (set vcvarsx86) -----------------

:: pushd ..\buildx86
::
:: cl /MD /EHsc -Zi -nologo /I ..\include ..\src\CJsfml_001.cpp user32.lib gdi32.lib winmm.lib Opengl32.lib ws2_32.lib advapi32.lib /link /LIBPATH:"C:\SFML\SFML-2.5.1_x86\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib  sfml-system-s.lib sfml-graphics-s.lib sfml-window-s.lib sfml-audio-s.lib sfml-network-s.lib
::
::
:: popd

del *.~ *.cpp~ *.bat~ *.un~


when i replace the libraires with the variables set at the top of the script it doesn't work.

THIS DOESN'T WORK:
Code: [Select]
@echo off

IF NOT DEFINED winLibs (SET winLibs = user32.lib gdi32.lib winmm.lib Opengl32.lib ws2_32.lib advapi32.lib)
IF NOT DEFINED sfmlDependLibsX64 (SET sfmlDependLibsX64 = /LIBPATH:"C:\SFML\SFML-2.5.1_x64\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib)
IF NOT DEFINED sfmlDependLibsX86 (SET sfmlDependLibsX86 = /LIBPATH:"C:\SFML\SFML-2.5.1_x86\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib)
IF NOT DEFINED sfmlLibsX64 (SET sfmlLibsX64 = /LIBPATH:"C:\SFML\SFML-2.5.1_x64\lib"sfml-system-s.lib sfml-graphics-s.lib sfml-window-s.lib sfml-audio-s.lib sfml-network-s.lib)
IF NOT DEFINED sfmlLibsX86 (SET sfmlLibsX86 = /LIBPATH:"C:\SFML\SFML-2.5.1_x86\lib"sfml-system-s.lib sfml-graphics-s.lib sfml-window-s.lib sfml-audio-s.lib sfml-network-s.lib)

If NOT EXIST ..\buildx64 mkdir ..\buildx64
If NOT EXIST ..\buildx86 mkdir ..\buildx86

pushd ..\buildx64

cl /MD /EHsc -Zi -nologo /I ..\include ..\src\CJsfml_001.cpp %winLibs% /link /LIBPATH:"C:\SFML\SFML-2.5.1_x64\lib" %sfmlDependLibsX64% %sfmlLibsX64%

popd

:: ------------------ x86 BUILD (set vcvarsx86) -----------------

:: pushd ..\buildx86
::
:: cl /MD /EHsc -Zi -nologo /I ..\include ..\src\CJsfml_001.cpp user32.lib gdi32.lib winmm.lib Opengl32.lib ws2_32.lib advapi32.lib /link /LIBPATH:"C:\SFML\SFML-2.5.1_x86\lib" freetype.lib openal32.lib flac.lib vorbisenc.lib vorbisfile.lib vorbis.lib ogg.lib  sfml-system-s.lib sfml-graphics-s.lib sfml-window-s.lib sfml-audio-s.lib sfml-network-s.lib
::
::
:: popd

del *.~ *.cpp~ *.bat~ *.un~


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: batch file replace libraries with variable
« Reply #1 on: August 02, 2019, 09:52:43 am »
This has nothing to do with SFML really. There are better Q&A/forum for batch programming questions. ;)

Also the SFML Projects subforum is certainly the wrong place to ask for help.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/