ICL: fix out of tree building and resource file usage on Windows
authorSteven Walters <kemuri9@gmail.com>
Sun, 12 Feb 2012 03:56:43 +0000 (22:56 -0500)
committerJason Garrett-Glaser <jason@x264.com>
Tue, 6 Mar 2012 16:51:07 +0000 (08:51 -0800)
Makefile
configure

index c735a88..5e39050 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -186,10 +186,10 @@ $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK): .depend
        -@ $(if $(STRIP), $(STRIP) -x $@) # delete local/anonymous symbols, so they don't show up in oprofile
 
 %.dll.o: %.rc x264.h
-       $(RC) -DDLL -o $@ $<
+       $(RC)$@ -DDLL $<
 
 %.o: %.rc x264.h
-       $(RC) -o $@ $<
+       $(RC)$@ $<
 
 .depend: config.mak
        @rm -f .depend
index 145d468..16970b8 100755 (executable)
--- a/configure
+++ b/configure
@@ -203,7 +203,12 @@ as_check() {
 rc_check() {
     log_check "whether $RC works"
     echo "$1" > conftest.rc
-    if $RC conftest.rc -o conftest.o >conftest.log 2>&1; then
+    if [ $compiler = ICL ]; then
+        rc_cmd="$RC -foconftest.o conftest.rc"
+    else
+        rc_cmd="$RC -o conftest.o conftest.rc"
+    fi
+    if $rc_cmd >conftest.log 2>&1; then
         res=$?
         log_ok
     else
@@ -211,7 +216,7 @@ rc_check() {
         log_fail
         log_msg "Failed commandline was:"
         log_msg "--------------------------------------------------"
-        log_msg "$RC conftest.rc -o conftest.o"
+        log_msg "$rc_cmd"
         cat conftest.log >> config.log
         log_msg "--------------------------------------------------"
         log_msg "Failed program was:"
@@ -424,7 +429,7 @@ if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
         # Windows Intel Compiler creates dependency generation with absolute Windows paths, Cygwin's make does not support Windows paths.
         [[ $host_os = cygwin* ]] && die "Windows Intel Compiler support requires MSYS"
         compiler=ICL
-        CFLAGS="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -Iextras"
+        CFLAGS="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -I\$(SRCPATH)/extras"
         QPRE="-Q"
         `$CC 2>&1 | grep -q IA-32` && host_cpu=i486
         `$CC 2>&1 | grep -q "Intel(R) 64"` && host_cpu=x86_64
@@ -631,7 +636,7 @@ esac
 
 RC=""
 if [ $SYS = WINDOWS ]; then
-    RC="${cross_prefix}windres"
+    [ $compiler = ICL ] && RC="rc" || RC="${cross_prefix}windres"
     if ! rc_check "0 RCDATA {0}" ; then
         RC=""
     fi
@@ -989,6 +994,7 @@ if [ $compiler = ICL ]; then
     LDFLAGSCLI="$(icl_ldflags $LDFLAGSCLI)"
     LIBX264=libx264.lib
     RANLIB=
+    [ -n "$RC" ] && RC="$RC -I. -I\$(SRCPATH)/extras -fo"
     STRIP=
     if [ $debug = yes ]; then
         LDFLAGS="-debug $LDFLAGS"
@@ -1002,6 +1008,7 @@ else
     DEPMT="-MT"
     LD="$CC -o "
     LIBX264=libx264.a
+    [ -n "$RC" ] && RC="$RC -I. -o "
 fi
 if [ $compiler = GNU ]; then
     PROF_GEN_CC="-fprofile-generate"
@@ -1084,7 +1091,7 @@ if [ "$shared" = "yes" ]; then
             # MSVC link does not act similarly, so it is required to make an export definition out of x264.h and use it at link time
             echo "SOFLAGS=-dll -def:x264.def -implib:\$(IMPLIBNAME) $SOFLAGS" >> config.mak
             echo "EXPORTS" > x264.def
-            grep "^\(int\|void\|x264_t\|extern\).*x264.*[\[(;]" x264.h | sed -e "s/.*\(x264.*\)[\[(].*/\1/;s/.*\(x264.*\);/\1/;s/open/open_$API/g" >> x264.def
+            grep "^\(int\|void\|x264_t\|extern\).*x264.*[\[(;]" ${SRCPATH}/x264.h | sed -e "s/.*\(x264.*\)[\[(].*/\1/;s/.*\(x264.*\);/\1/;s/open/open_$API/g" >> x264.def
         else
             echo 'IMPLIBNAME=libx264.dll.a' >> config.mak
             echo "SOFLAGS=-shared -Wl,--out-implib,\$(IMPLIBNAME) -Wl,--enable-auto-image-base $SOFLAGS" >> config.mak