Jump to content
Sign in to follow this  
fabio

Using our Libpng instead of wx bundled one

Recommended Posts

19 hours ago, stanislas69 said:

@fabio I looked at using the libpng we compile for OSX however they don't seem to have a flag to specify the path of such a library, and they do some stuff with it because it's not compatible out of the box. Could you assist me with the flags ?

I would first move building libpng (around L376) before wxwidgets (L335).

Then replace --with-png=builtin wxwidgets compile option with --with-libpng=sys .

It probably will fail because it will search in standard system location.

Then try to change the wxwidgets CPPFLAGS from CPPFLAGS="-stdlib=libc++ ... to something like CPPFLAGS="-Irelative/path/to/just/compiled/libpng/headers -stdlib=libc++ ... and LDFLAGS from LDFLAGS="$LDFLAGS"  to LDFLAGS="-Lrelative/path/to/just/compiled/libpng/lib $LDFLAGS" .

EDIT: it should be similar to what done on sdl2 with iconv (L293).

  • Like 2

Share this post


Link to post
Share on other sites
8 minutes ago, fabio said:

Without changing cppflags it may includes different headers than the ones of the library and problems may arise...

Yeah I was surprised it worked.

Share this post


Link to post
Share on other sites

@fabio So I tried, and it didn't work.

Reference for flags https://raw.githubusercontent.com/wxWidgets/wxWidgets/master/configure (Might be some we can add)

If I pass

 --with-libpng=sys, 

he says:

system png library not found or too old! Use --with-libpng=builtin to use built-in version"

Full command


  CONF_OPTS="--prefix=$INSTALL_DIR --disable-shared --enable-macosx_arch=$ARCH --enable-unicode --with-cocoa --with-opengl --with-libiconv-prefix=${ICONV_DIR} --with-expat=builtin --with-libpng --without-libtiff --without-sdl --without-x --disable-webview --disable-webkit --disable-webviewwebkit --disable-webviewie"
  # wxWidgets configure now defaults to targeting 10.5, if not specified,
  # but that conflicts with our flags
  if [[ $MIN_OSX_VERSION && ${MIN_OSX_VERSION-_} ]]; then
    CONF_OPTS="$CONF_OPTS --with-macosx-version-min=$MIN_OSX_VERSION"
  fi
  (../configure CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" CPPFLAGS="-L$LIB_PNG_DIR/include -stdlib=libc++ -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=1" LDFLAGS="-L$LIB_PNG_DIR/lib $LDFLAGS" $CONF_OPTS && make ${JOBS} && make install) || die "wxWidgets build failed"

I also tried

--with-libpng=$LIB_PNG_DIR 

Fails like above.

I ended up passing

--with-libpng

And it built complaining about

clang: warning: argument unused during compilation: '-L/Users/Stan/0ad/libraries/osx/libpng/include

So I guess it's not working either...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×