buildXMPsdk.cmd code complete.

v0.27.3
clanmills 8 years ago
parent 9da376a125
commit b715da1fcd

@ -1,14 +1,17 @@
@echo off @echo off
REM buildXMPsdk.cmd rem ----
rem buildXMPsdk.cmd
setlocal enableextensions setlocal enableextensions
set "_THIS_=%0%"
GOTO main GOTO main
:help :help
echo Options: --help ^| --2016 ^| --2014 ^| --2013 ^| --64 ^| --32 echo %_THIS_% [Options]
echo Options: --help ^| --2016 ^| --2014 ^| --2013 ^| --64 ^| --32 ^| --rebuild
exit /b 0 exit /b 0
:main :main
REM rem ----
rem always run this script in <exiv2dir>/xmpsdk rem always run this script in <exiv2dir>/xmpsdk
cd %~dp0 cd %~dp0
@ -30,8 +33,9 @@ if /I "%1" == "32" set "_BIT_=32"
if /I "%1" == "64" set "_BIT_=64" if /I "%1" == "64" set "_BIT_=64"
if /I "%1" == "--verbose" echo on if /I "%1" == "--verbose" echo on
if /I "%1" == "--silent" set _SILENT_=1
if /I "%1" == "--help" call:help && goto end if /I "%1" == "--help" call:help && goto end
if /I "%1" == "--rebuild" set _REBUILD_=1
shift shift
if not (%1) EQU () goto GETOPTS if not (%1) EQU () goto GETOPTS
@ -39,24 +43,32 @@ if not (%1) EQU () goto GETOPTS
if /I "%_SDK_%" == "2013" ( if /I "%_SDK_%" == "2013" (
set "_SDK_=XMP-Toolkit-SDK-CC201306" set "_SDK_=XMP-Toolkit-SDK-CC201306"
set "_ZIP_=XMP-Toolkit-SDK-CC-201306" set "_ZIP_=XMP-Toolkit-SDK-CC-201306"
set "_VC_=vc10"
) )
if /I "%_SDK_%" == "2014" ( if /I "%_SDK_%" == "2014" (
set "_SDK_=XMP-Toolkit-SDK-CC201412" set "_SDK_=XMP-Toolkit-SDK-CC201412"
set "_ZIP_=XMP-Toolkit-SDK-CC201412" set "_ZIP_=XMP-Toolkit-SDK-CC201412"
set "_VC_=vc11"
) )
if /I "%_SDK_%" == "2016" ( if /I "%_SDK_%" == "2016" (
set "_SDK_=XMP-Toolkit-SDK-CC201607" set "_SDK_=XMP-Toolkit-SDK-CC201607"
set "_ZIP_=XMP-Toolkit-SDK-CC201607" set "_ZIP_=XMP-Toolkit-SDK-CC201607"
set "_VC_=vc14"
) )
REM if DEFINED _REBUILD_ if EXIST Adobe\%_SDK_% rmdir/s/q Adobe\%_SDK_%
rem ----
rem if it's already built, we're done rem if it's already built, we're done
if EXIST Adobe\%_SDK_%\libXMPCore.lib ( set "_TARGET_=Adobe\%_SDK_%\public\doesntexist
dir Adobe\%_SDK_%\libXMPCore.lib if /I %_BIT_% == 64 set "_TARGET_=Adobe\%_SDK_%\public\libraries\windows_x64\Release\XMPCoreStatic.lib"
exit /b 0 if /I %_BIT_% == 32 set "_TARGET_=Adobe\%_SDK_%\public\libraries\windows\Release\XMPCoreStatic.lib"
if EXIST %_TARGET_% (
dir %_TARGET_%
GOTO end
) )
REM rem ----
rem Test the VC Environment rem Test the VC Environment
IF NOT DEFINED VSINSTALLDIR ( IF NOT DEFINED VSINSTALLDIR (
echo "VSINSTALLDIR not set. Run vcvars32.bat or vcvarsall.bat or vcvars.bat ***" echo "VSINSTALLDIR not set. Run vcvars32.bat or vcvarsall.bat or vcvars.bat ***"
@ -67,9 +79,35 @@ IF NOT EXIST "%VSINSTALLDIR%" (
GOTO error_end GOTO error_end
) )
rem ----
call:echo testing 7z is on path
7z > NUL
IF ERRORLEVEL 1 (
echo "*** please ensure 7z.exe is on the PATH ***"
GOTO error_end
)
rem ----
call:echo testing curl is on path
curl --version > NUL
IF ERRORLEVEL 1 (
echo "*** please ensure cmake.exe is on the PATH ***"
GOTO error_end
)
rem ----
call:echo testing my_echo is on path
if NOT EXIST my_echo.exe cl my_echo.cpp /o my_echo.exe
my_echo --version > NUL
IF ERRORLEVEL 1 (
echo "*** please ensure my_echo.exe is on the PATH ***"
GOTO error_end
)
call:report call:report
REM rem ----
rem Download the code from Adobe rem Download the code from Adobe
if NOT EXIST Adobe\%_SDK_% ( if NOT EXIST Adobe\%_SDK_% (
if NOT EXIST Adobe mkdir Adobe if NOT EXIST Adobe mkdir Adobe
@ -81,52 +119,81 @@ if NOT EXIST Adobe\%_SDK_% (
) )
if NOT EXIST Adobe\%_SDK_% ( if NOT EXIST Adobe\%_SDK_% (
echo *** ERROR SDK = Adobe\%_SDK_% not found" >2 echo *** ERROR SDK = Adobe\%_SDK_% not found"
GOTO error_end GOTO error_end
) )
REM rem ----
rem Copy in the third-party files rem Copy in the third-party files
xcopy/yesihq third-party\zlib Adobe\%_SDK_%\third-party\zlib xcopy/yesihq third-party\zlib Adobe\%_SDK_%\third-party\zlib
xcopy/yesihq third-party\expat\lib Adobe\%_SDK_%\third-party\expat\lib xcopy/yesihq third-party\expat\lib Adobe\%_SDK_%\third-party\expat\lib
xcopy/yesihq third-party\zuid\interfaces Adobe\%_SDK_%\third-party\zuid\interfaces xcopy/yesihq third-party\zuid\interfaces Adobe\%_SDK_%\third-party\zuid\interfaces
REM rem ----
rem generate the build the SDK rem generate and build the SDK
cd Adobe\%_SDK_%\build cd Adobe\%_SDK_%\build
dir set
c:\cygwin64\bin\echo -n 5 | call GenerateXMPToolkitSDK_win.bat
cd .. if /I %_BIT_% == 64 (
REM %_BUILDDIR_%\my_echo 5 | call GenerateXMPToolkitSDK_win.bat
rem build it! devenv %_VC_%\static\windows_x64\XMPToolkitSDK64.sln /Build "Release|x64" /ProjectConfig XMPCoreStatic
echo --------------------------------------- )
echo devenv XMPCore\build\vc14\static\windows_x64\XMPCore64.sln /Build "Release|x64"
echo --------------------------------------- if /I %_BIT_% == 32 (
devenv XMPCore\build\vc14\static\windows_x64\XMPCore64.sln /Build "Release|x64" %_BUILDDIR_%\my_echo 3 | call GenerateXMPToolkitSDK_win.bat
dir/s *.lib devenv %_VC_%\static\windows\XMPToolkitSDK.sln /Build "Release|Win32" /ProjectConfig XMPCoreStatic
)
cd ..\..\..
REM
rem ------------------------------------------------------------------------------
rem The Adobe script GeneratXMPToolkitSDK_win.bat
rem use the CMake Generators "Visual Studio 14 2015 Win64" and "Visual Studio 14 2015"
rem CMake provides more generators
rem Visual Studio 14 2015 [arch] = Generates Visual Studio 2015 project files.
rem Visual Studio 12 2013 [arch] = Generates Visual Studio 2013 project files.
rem Visual Studio 11 2012 [arch] = Generates Visual Studio 2012 project files.
rem Visual Studio 10 2010 [arch] = Generates Visual Studio 2010 project files.
rem Visual Studio 9 2008 [arch] = Generates Visual Studio 2008 project files.
rem Visual Studio 8 2005 [arch] = Generates Visual Studio 2005 project files.
rem Adobe generate the Visual Studio Solution with the CMake command:
rem cmake ../../../. ^
rem -G"Visual Studio 14 2015 Win64" ^ or -G"Visual Studio 14 2015 Win64"
rem -DXMP_CMAKEFOLDER_NAME="vc14/static/windows_x64" ^
rem -DCMAKE_CL_64=ON ^
rem -DCMAKE_ARCH=x64 ^ or -DCMAKE_ARCH=x64=x86
rem -DXMP_BUILD_WARNING_AS_ERROR=ON ^
rem -DXMP_BUILD_STATIC=ON
rem -DCMAKE_BUILD_TYPE=Release
rem I believe it's possible to build for other versions of Visual Studio
rem However I have never been tested this
rem ------------------------------------------------------------------------------
cd "%_BUILDDIR_%"
dir/s XMPCoreStatic.lib
GOTO end
rem -----------------------------------------
rem Functions
rem ----
rem normal end rem normal end
:end :end
endlocal endlocal
exit /b 0 exit /b 0
REM ----------------------------------------- rem ----
rem Functions
REM
rem echo (or don't if --silent). syntax: call:echo args ... rem echo (or don't if --silent). syntax: call:echo args ...
:echo :echo
if NOT DEFINED _SILENT_ echo %*% if NOT DEFINED _SILENT_ echo %*%
exit /b 0 exit /b 0
REM rem ----
rem end with an error syntax: call:error_end rem end with an error syntax: call:error_end
:error_end :error_end
endlocal endlocal
exit /b 1 exit /b 1
REM rem ----
rem report settings rem report settings
:report :report
echo.sdk = %_SDK_% echo.sdk = %_SDK_%
@ -138,4 +205,4 @@ echo ----------------------------------
exit /b 0 exit /b 0
rem That's all Folks! rem That's all Folks!
REM rem ----

@ -0,0 +1,10 @@
#include <stdio.h>
int main(int argc,const char** argv)
{
int args = argc;
while ( --argc ) {
printf("%s",argv[args-argc]);
if ( argc > 1 ) printf(" ");
}
return 0;
}
Loading…
Cancel
Save