-1

I am trying to compile a cross platform QT Application for windows via AppVeyor with cmake.

Under Linux the cmake compiles just fine, so the CMakeLists.txt should be valid.

AppVeyor compiles a necessary library, which works, too. But when it comes to the project CMakeLists.txt it fails with the following errors:

-- Could NOT find ZLIB (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR)
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/FindPNG.cmake:157 (find_package_handle_standard_args)
CMakeLists.txt:20 (find_package)

the corresponding part inside the CMakeLists.txt is:

find_package(PNG REQUIRED)

[...some other cmake stuff...]

# link required other libraries
include_directories(${PNG_INCLUDE_DIR} ${GSL_INCLUDE_DIRS})
target_link_libraries(projectName ${PNG_LIBRARY} ${GSL_LIBRARIES})

this is the current build fail: https://ci.appveyor.com/project/zebastian/mandelbulber2

the used CMakeLists.txt and appveyor.yml file can be found in the project root here: https://github.com/zebastian/mandelbulber2

Since the FindPNG.cmake is present it seems that only zlib is missing, which seems a little odd. I have seen a couple of appveyor.yml files which circumvent this problem by downloading and compiling some png / zlib source folders or by using external dependencies, but IMHO this should be a simple task for the CI.

Or am i missing something?

Any help appreciated...

zebastian
  • 1
  • 1
  • Clear you cache and re-run CMake. If it outputs that PNG is missing, CMake is not able to find it and you have to tell CMake where to find it. – usr1234567 May 03 '16 at 06:18
  • It seems from the error message that CMake can neither find zlib nor png. Where are those libraries installed in your appveyor build? Note that on WIndows you usually have to spoonfeed the locations of all libraries to CMake, which your build does not seem to do. – ComicSansMS May 03 '16 at 11:56
  • @usr1234567 thanks, but this would be the TODO if the build should happen on my own machine. The build CI AppVeyor only takes a describing yml file which sets up an almost bare windows virtual machine with common build programs / packages / etc. You can find the describing file here: https://github.com/zebastian/mandelbulber2/blob/master/.appveyor.yml It wuld be good, if this problem can be solved in a good manner inside this yml file. So this is more of an AppVeyor internal question. ComicSansMS: yes, this seems to be the problem. But the FindPNG.cmake seems to be present. – zebastian May 03 '16 at 12:54
  • @zebastian The FindPng.cmake should be part of your CMake installation. However, this does not provide png, it can only detected png if it's being provided on the system. You will still have to get the png binaries into your Appveyor environment manually. – ComicSansMS May 03 '16 at 14:13

1 Answers1

0

Ok, I found a solution for this particular problem:

In windows there is a package manager called nuget to resolve this kind of dependency which also works quite well with appveyor. To install libpng i used the following command:

#packages from nuget
- nuget install zlib-msvc14-x64-master -Version 1.2.8.4 -Source https://ci.appveyor.com/nuget/zlib-shallow-x0n34b3pfq1b
- ps: move zlib*\* deps -force
- move deps\zlibstatic.lib deps\zlib.lib
- nuget install libpng-msvc14-x64-master -Version 1.6.18.44 -Source https://ci.appveyor.com/nuget/libpng-7hwq4pmmrc48
- ps: move libpng*\* deps -force
- move deps\libpng16_static.lib deps\png.lib

where the ps and move are only for moving things around. For me this seems to be a reasonable solution and may save some people from tedious self compiling.

Compilation still fails due to windows occupying and colliding with 4-letter pragmas, and other msvc specific behaviour. But thats a topic for another day...

zebastian
  • 1
  • 1