From 23aff3a11a0e022da37f92c3d2272aa5bbe94fd6 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Fri, 25 Aug 2017 11:49:18 +0100 Subject: [PATCH] buildXMPsdk.cmd testing/work-in-progress. --- xmpsdk/buildXMPsdk.cmd | 117 +++++++++++++++++++++++++---------------- xmpsdk/my_echo.cpp | 10 ---- 2 files changed, 71 insertions(+), 56 deletions(-) delete mode 100644 xmpsdk/my_echo.cpp diff --git a/xmpsdk/buildXMPsdk.cmd b/xmpsdk/buildXMPsdk.cmd index 43f4b6f5..a48dda5c 100644 --- a/xmpsdk/buildXMPsdk.cmd +++ b/xmpsdk/buildXMPsdk.cmd @@ -7,7 +7,8 @@ set "_THIS_=%0%" GOTO main :help echo %_THIS_% [Options] -echo Options: --help ^| --2016 ^| --2014 ^| --2013 ^| --64 ^| --32 ^| --rebuild +echo.Options: --help ^| --2016 ^| --2014 ^| --2013 ^| --64 ^| --32 ^| --rebuild ^| --dryrun +echo --sdk [2013^|2014^|2016] ^| --bit [32^|64] ^| --vs [2005^|2008^|2010^|2012^|2013^|2015^|2017] exit /b 0 :main @@ -18,6 +19,7 @@ cd %~dp0 set "_BUILDDIR_=%CD%" set _SDK_=2016 set _BIT_=64 +set _VS_=2015 :GETOPTS if /I "%1" == "--2013" set "_SDK_=2013" @@ -32,10 +34,16 @@ if /I "%1" == "--64" set "_BIT_=64" if /I "%1" == "32" set "_BIT_=32" if /I "%1" == "64" set "_BIT_=64" +if /I "%1" == "--vs" set "_VS_=%2"&shift +if /I "%1" == "--sdk" set "_SDK_=%2"&shift +if /I "%1" == "--bit" set "_BIT_=%2"&shift + if /I "%1" == "--verbose" echo on if /I "%1" == "--silent" set _SILENT_=1 if /I "%1" == "--help" call:help && goto end if /I "%1" == "--rebuild" set _REBUILD_=1 +if /I "%1" == "--distclean" set _DISTCLEAN_=1 +if /I "%1" == "--dryrun" set _DRYRUN_=1 shift if not (%1) EQU () goto GETOPTS @@ -43,20 +51,31 @@ if not (%1) EQU () goto GETOPTS if /I "%_SDK_%" == "2013" ( set "_SDK_=XMP-Toolkit-SDK-CC201306" set "_ZIP_=XMP-Toolkit-SDK-CC-201306" - set "_VC_=vc10" ) if /I "%_SDK_%" == "2014" ( set "_SDK_=XMP-Toolkit-SDK-CC201412" set "_ZIP_=XMP-Toolkit-SDK-CC201412" - set "_VC_=vc11" ) if /I "%_SDK_%" == "2016" ( set "_SDK_=XMP-Toolkit-SDK-CC201607" set "_ZIP_=XMP-Toolkit-SDK-CC201607" - set "_VC_=vc14" ) -if DEFINED _REBUILD_ if EXIST Adobe\%_SDK_% rmdir/s/q Adobe\%_SDK_% +if /I "%_VS_%" == "2015" set "_VC_=14" +if /I "%_VS_%" == "2013" set "_VC_=12" +if /I "%_VS_%" == "2012" set "_VC_=11" +if /I "%_VS_%" == "2010" set "_VC_=10" +if /I "%_VS_%" == "2008" set "_VC_=9" +if /I "%_VS_%" == "2005" set "_VC_=8" + set "_GENERATOR_=Visual Studio %_VC_% %_VS_%" +IF /I "%_BIT_%" == "64" set "_GENERATOR_=Visual Studio %_VC_% %_VS_% Win64" +if DEFINED _DRYRUN_ ( + call:report + GOTO end +) + +if DEFINED _REBUILD_ if EXIST Adobe\%_SDK_% rmdir/s/q Adobe\%_SDK_% +if DEFINED _DISTCLEAN_ if EXIST Adobe rmdir/s/q Adobe rem ---- rem if it's already built, we're done @@ -68,17 +87,6 @@ if EXIST %_TARGET_% ( GOTO end ) -rem ---- -rem Test the VC Environment -IF NOT DEFINED VSINSTALLDIR ( - echo "VSINSTALLDIR not set. Run vcvars32.bat or vcvarsall.bat or vcvars.bat ***" - GOTO error_end -) -IF NOT EXIST "%VSINSTALLDIR%" ( - echo "VSINSTALLDIR %VSINSTALLDIR% does not exist. Run vcvars32.bat or vcvarsall.bat ***" - GOTO error_end -) - rem ---- call:echo testing 7z is on path 7z > NUL @@ -96,15 +104,14 @@ IF ERRORLEVEL 1 ( ) 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 +call:echo testing cmake.exe is on path +cmake.exe > NUL IF ERRORLEVEL 1 ( - echo "*** please ensure my_echo.exe is on the PATH ***" + echo "*** please ensure cmake.exe is on the PATH ***" GOTO error_end ) + call:report rem ---- @@ -112,7 +119,6 @@ rem Download the code from Adobe if NOT EXIST Adobe\%_SDK_% ( if NOT EXIST Adobe mkdir Adobe cd Adobe - if NOT EXIST %_ZIP_%.zip copy/y y:\temp\XMP-Toolkit-SDK-CC201607.zip if NOT EXIST %_ZIP_%.zip curl -O http://download.macromedia.com/pub/developer/xmp/sdk/%_ZIP_%.zip IF NOT ERRORLEVEL 1 7z x %_ZIP_%.zip 2>nul cd .. @@ -134,39 +140,55 @@ rem generate and build the SDK cd Adobe\%_SDK_%\build set -if /I %_BIT_% == 64 ( - %_BUILDDIR_%\my_echo 5 | call GenerateXMPToolkitSDK_win.bat - devenv %_VC_%\static\windows_x64\XMPToolkitSDK64.sln /Build "Release|x64" /ProjectConfig XMPCoreStatic -) - -if /I %_BIT_% == 32 ( - %_BUILDDIR_%\my_echo 3 | call GenerateXMPToolkitSDK_win.bat - devenv %_VC_%\static\windows\XMPToolkitSDK.sln /Build "Release|Win32" /ProjectConfig XMPCoreStatic -) -cd ..\..\.. - 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 -G"Visual Studio 14 2015 Win64" ^ or -G"Visual Studio 14 2015" rem -DXMP_CMAKEFOLDER_NAME="vc14/static/windows_x64" ^ rem -DCMAKE_CL_64=ON ^ -rem -DCMAKE_ARCH=x64 ^ or -DCMAKE_ARCH=x64=x86 +rem -DCMAKE_ARCH=x64 ^ or -DCMAKE_ARCH=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 ------------------------------------------------------------------------------ +rem Building with the Adobe batch file GenerateXMPToolkitSDK_win.bat +TODO: Test the CMake.exe code and decide how to proceed + It's possible SDK=2016 demands VS=2015 (SDK=2014 & VS=2012) (SDK 2013 & VS=2010) +if /I %_BIT_% == 64 ( + echo 5|GenerateXMPToolkitSDK_win.bat + call "%_BUILDDIR_%\..\contrib\cmake\msvc\vcvars.bat" %_VS_% %_BIT_% + devenv vc%_VC_%\static\windows_x64\XMPToolkitSDK64.sln /Build "Release|x64" /ProjectConfig XMPCoreStatic +) + +if /I %_BIT_% == 32 ( + echo 3|GenerateXMPToolkitSDK_win.bat + call "%_BUILDDIR_%\..\contrib\cmake\msvc\vcvars.bat" %_VS_% %_BIT_% + devenv vc%_VC_%\static\windows\XMPToolkitSDK.sln /Build "Release|Win32" /ProjectConfig XMPCoreStatic +) + +rem set "_CL64_=-DCMAKE_CL_64=ON" +rem set "_ARCH_=-DCMAKE_ARCH=x64" +rem set "_OUT_=%_VS_%/static/windows_x64" +rem set "_BUILD_=Release|x64" +rem set "_SLN_=XMPToolkitSDK64.sln" +rem if /I "%_BIT_%" == "32" ( +rem set "_CL64_=-DCMAKE_CL_64=OFF" +rem set "_ARCH_=-DCMAKE_ARCH=x86" +rem set "_OUT_=%_VS_%/static/windows" +rem set "_BUILD_="Release|Win32" +rem set "_SLN_=XMPToolkitSDK.sln" +rem ) +rem @echo on +rem cmake.exe --version +rem call "%_BUILDDIR_%\..\contrib\cmake\msvc\vcvars.bat" %_VS_% %_BIT_% +rem cmake.exe . "-G%_GENERATOR_%" "%_CL64_%" "%_ARCH_%" -DXMP_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release "-DXMP_CMAKEFOLDER_NAME=%_OUT_%" +rem rem cmake.exe . --build +rem devenv "%_SLN_%" /Build "%_BUILD_%" /ProjectConfig XMPCoreStatic + +cd ..\..\.. +@echo off cd "%_BUILDDIR_%" dir/s XMPCoreStatic.lib @@ -196,11 +218,14 @@ exit /b 1 rem ---- rem report settings :report -echo.sdk = %_SDK_% +cmake.exe > NUL +IF NOT ERRORLEVEL 1 cmake.exe --version +echo.vs = %_VS_% echo.bit = %_BIT_% +echo.sdk = %_SDK_% +echo.generator = %_GENERATOR_% echo.zip = %_ZIP_% echo.builddir = %_BUILDDIR_% -echo.vsinstalldir = %VSINSTALLDIR% echo ---------------------------------- exit /b 0 diff --git a/xmpsdk/my_echo.cpp b/xmpsdk/my_echo.cpp deleted file mode 100644 index 98930558..00000000 --- a/xmpsdk/my_echo.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -int main(int argc,const char** argv) -{ - int args = argc; - while ( --argc ) { - printf("%s",argv[args-argc]); - if ( argc > 1 ) printf(" "); - } - return 0; -} \ No newline at end of file