[x265-commits] [x265] cmake: cleanup EXTRA_LINK_FLAGS, move all logic together

Steve Borho steve at borho.org
Thu Jul 9 20:08:11 CEST 2015


details:   http://hg.videolan.org/x265/rev/993bf36248f1
branches:  
changeset: 10781:993bf36248f1
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 09 12:38:22 2015 -0500
description:
cmake: cleanup EXTRA_LINK_FLAGS, move all logic together

it is no longer just for the static library
Subject: [x265] cmake: demonstrate how MSVC static libs can be combined for multilib packages

details:   http://hg.videolan.org/x265/rev/c943d5032ffa
branches:  
changeset: 10782:c943d5032ffa
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 09 12:57:29 2015 -0500
description:
cmake: demonstrate how MSVC static libs can be combined for multilib packages
Subject: [x265] cmake: msys includes GNU ar and can use the same approach as Linux

details:   http://hg.videolan.org/x265/rev/50d32509a1f4
branches:  
changeset: 10783:50d32509a1f4
user:      Steve Borho <steve at borho.org>
date:      Thu Jul 09 13:07:52 2015 -0500
description:
cmake: msys includes GNU ar and can use the same approach as Linux

diffstat:

 build/msys/multilib.sh         |  12 ++++++++++++
 build/vc10-x86_64/multilib.bat |   3 +++
 build/vc11-x86_64/multilib.bat |   3 +++
 build/vc12-x86_64/multilib.bat |   3 +++
 build/vc9-x86_64/multilib.bat  |   3 +++
 source/CMakeLists.txt          |   6 +++---
 6 files changed, 27 insertions(+), 3 deletions(-)

diffs (94 lines):

diff -r 3db2bb3c599d -r 50d32509a1f4 build/msys/multilib.sh
--- a/build/msys/multilib.sh	Thu Jul 09 10:30:35 2015 -0500
+++ b/build/msys/multilib.sh	Thu Jul 09 13:07:52 2015 -0500
@@ -15,3 +15,15 @@ cp libx265.a ../8bit/libx265_main10.a
 cd ../8bit
 cmake -G "MSYS Makefiles" ../../../source -DEXTRA_LIB="x265_main10.a;x265_main12.a" -DEXTRA_LINK_FLAGS=-L. -DLINKED_10BIT=ON -DLINKED_12BIT=ON
 make ${MAKEFLAGS}
+
+# rename the 8bit library, then combine all three into libx265.a using GNU ar
+mv libx265.a libx265_main.a
+
+ar -M <<EOF
+CREATE libx265.a
+ADDLIB libx265_main.a
+ADDLIB libx265_main10.a
+ADDLIB libx265_main12.a
+SAVE
+END
+EOF
diff -r 3db2bb3c599d -r 50d32509a1f4 build/vc10-x86_64/multilib.bat
--- a/build/vc10-x86_64/multilib.bat	Thu Jul 09 10:30:35 2015 -0500
+++ b/build/vc10-x86_64/multilib.bat	Thu Jul 09 13:07:52 2015 -0500
@@ -36,6 +36,9 @@ if not exist x265-static-main12.lib (
 cmake -G "Visual Studio 10 Win64" ../../../source -DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON
 if exist x265.sln (
   MSBuild /property:Configuration="Release" x265.sln
+  :: combine static libraries (ignore warnings caused by winxp.cpp hacks)
+  move Release\x265-static.lib x265-static-main.lib
+  LIB.EXE /ignore:4006 /ignore:4221 /OUT:Release\x265-static.lib x265-static-main.lib x265-static-main10.lib x265-static-main12.lib
 )
 
 pause
diff -r 3db2bb3c599d -r 50d32509a1f4 build/vc11-x86_64/multilib.bat
--- a/build/vc11-x86_64/multilib.bat	Thu Jul 09 10:30:35 2015 -0500
+++ b/build/vc11-x86_64/multilib.bat	Thu Jul 09 13:07:52 2015 -0500
@@ -36,6 +36,9 @@ if not exist x265-static-main12.lib (
 cmake -G "Visual Studio 11 Win64" ../../../source -DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON
 if exist x265.sln (
   MSBuild /property:Configuration="Release" x265.sln
+  :: combine static libraries (ignore warnings caused by winxp.cpp hacks)
+  move Release\x265-static.lib x265-static-main.lib
+  LIB.EXE /ignore:4006 /ignore:4221 /OUT:Release\x265-static.lib x265-static-main.lib x265-static-main10.lib x265-static-main12.lib
 )
 
 pause
diff -r 3db2bb3c599d -r 50d32509a1f4 build/vc12-x86_64/multilib.bat
--- a/build/vc12-x86_64/multilib.bat	Thu Jul 09 10:30:35 2015 -0500
+++ b/build/vc12-x86_64/multilib.bat	Thu Jul 09 13:07:52 2015 -0500
@@ -36,6 +36,9 @@ if not exist x265-static-main12.lib (
 cmake -G "Visual Studio 12 Win64" ../../../source -DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON
 if exist x265.sln (
   MSBuild /property:Configuration="Release" x265.sln
+  :: combine static libraries (ignore warnings caused by winxp.cpp hacks)
+  move Release\x265-static.lib x265-static-main.lib
+  LIB.EXE /ignore:4006 /ignore:4221 /OUT:Release\x265-static.lib x265-static-main.lib x265-static-main10.lib x265-static-main12.lib
 )
 
 pause
diff -r 3db2bb3c599d -r 50d32509a1f4 build/vc9-x86_64/multilib.bat
--- a/build/vc9-x86_64/multilib.bat	Thu Jul 09 10:30:35 2015 -0500
+++ b/build/vc9-x86_64/multilib.bat	Thu Jul 09 13:07:52 2015 -0500
@@ -36,6 +36,9 @@ if not exist x265-static-main12.lib (
 cmake -G "Visual Studio 9 2008 Win64" ../../../source -DEXTRA_LIB="x265-static-main10.lib;x265-static-main12.lib" -DLINKED_10BIT=ON -DLINKED_12BIT=ON
 if exist x265.sln (
   MSBuild /property:Configuration="Release" x265.sln
+  :: combine static libraries (ignore warnings caused by winxp.cpp hacks)
+  move Release\x265-static.lib x265-static-main.lib
+  LIB.EXE /ignore:4006 /ignore:4221 /OUT:Release\x265-static.lib x265-static-main.lib x265-static-main10.lib x265-static-main12.lib
 )
 
 pause
diff -r 3db2bb3c599d -r 50d32509a1f4 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu Jul 09 10:30:35 2015 -0500
+++ b/source/CMakeLists.txt	Thu Jul 09 13:07:52 2015 -0500
@@ -272,6 +272,9 @@ set(LIB_INSTALL_DIR lib CACHE STRING "In
 set(BIN_INSTALL_DIR bin CACHE STRING "Install location of executables")
 set(EXTRA_LIB "" CACHE STRING "Extra libraries to link against")
 set(EXTRA_LINK_FLAGS "" CACHE STRING "Extra link flags")
+if(EXTRA_LINK_FLAGS)
+    list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
+endif()
 mark_as_advanced(EXTRA_LIB EXTRA_LINK_FLAGS)
 
 if(X64)
@@ -406,9 +409,6 @@ endif()
 if(EXTRA_LIB)
     target_link_libraries(x265-static ${EXTRA_LIB})
 endif()
-if(EXTRA_LINK_FLAGS)
-    list(APPEND LINKER_OPTIONS ${EXTRA_LINK_FLAGS})
-endif()
 install(TARGETS x265-static
     LIBRARY DESTINATION ${LIB_INSTALL_DIR}
     ARCHIVE DESTINATION ${LIB_INSTALL_DIR})


More information about the x265-commits mailing list