Jump to content

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
Link to comment
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


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"
  (../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


Fails like above.

I ended up passing


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...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...