RuiwenTang / Skity

A light weight 2D Vector Graphic renderer library writing in c++ for OpenGL3.3+ / OpenGLES3.0+ / Vulkan 1.1+/ WebGL2 with WASM
https://ruiwentang.github.io/Skity/
MIT License
219 stars 28 forks source link

Caveat while building on M1 Mac #47

Closed notshriram closed 1 year ago

notshriram commented 1 year ago

libpng wont build on macOS M1 unless the -DPNG_ARM_NEON=on flag is provided to cmake .. (solution from https://github.com/isl-org/Open3D/issues/3955)

Is this something that could be added to the README?

[  8%] Built target freetype
[ 16%] Built target skity
[ 16%] Built target pugixml-static
[ 16%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_attribute.cc.o
[ 16%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_attribute_parser.cc.o
[ 17%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_color_parser.cc.o
[ 17%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_container.cc.o
[ 17%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_dom.cc.o
[ 17%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_node.cc.o
[ 17%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_path.cc.o
[ 18%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_render_context.cc.o
[ 18%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_root.cc.o
[ 18%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_shape.cc.o
[ 18%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/svg/svg_transformable_node.cc.o
[ 18%] Building CXX object module/svg/CMakeFiles/skity-svg.dir/src/xml/xml_parser.cc.o
[ 18%] Linking CXX static library libskity-svg.a
[ 18%] Built target skity-svg
[ 20%] Built target genfiles
[ 20%] Building C object third_party/libpng/CMakeFiles/png.dir/arm/arm_init.c.o
/Users/username/Dev/CppProjects/Skity/third_party/libpng/arm/arm_init.c:49:4: error: "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
#  error "PNG_ARM_NEON_FILE undefined: no support for run-time ARM NEON checks"
   ^
/Users/username/Dev/CppProjects/Skity/third_party/libpng/arm/arm_init.c:86:27: error: call to undeclared function 'png_have_neon'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
               no_neon = !png_have_neon(pp);
                          ^
2 errors generated.
make[2]: *** [third_party/libpng/CMakeFiles/png.dir/arm/arm_init.c.o] Error 1
make[1]: *** [third_party/libpng/CMakeFiles/png.dir/all] Error 2
make: *** [all] Error 2
RuiwenTang commented 1 year ago

Thanks for your report. I don't have M1 Mac. So can not find this problem. I will mention this in the READM file.

RuiwenTang commented 1 year ago

Append in commit RuiwenTang/Skity@b6cdb45

notshriram commented 1 year ago

@RuiwenTang Thanks for that

I am also having another issue on the M1 Mac, when I try to use the library in my project's CMakeLists.txt using the method described in the readme

find_package(skity CONFIG REQUIRED)
target_link_library(${PROJECT_NAME} skity::skity)
CMake Error at CMakeLists.txt:10 (find_package):
  Found package configuration file:

    /opt/Skity/lib/cmake/skity/skityConfig.cmake

  but it set skity_FOUND to FALSE so package "skity" is considered to be NOT
  FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing: png
  Skity::turbojpeg
RuiwenTang commented 1 year ago

@RuiwenTang Thanks for that

I am also having another issue on the M1 Mac, when I try to use the library in my project's CMakeLists.txt using the method described in the readme

find_package(skity CONFIG REQUIRED)
target_link_library(${PROJECT_NAME} skity::skity)
CMake Error at CMakeLists.txt:10 (find_package):
  Found package configuration file:

    /opt/Skity/lib/cmake/skity/skityConfig.cmake

  but it set skity_FOUND to FALSE so package "skity" is considered to be NOT
  FOUND.  Reason given by package:

  The following imported targets are referenced, but are missing: png
  Skity::turbojpeg

May be this is caused by vcpkg configuration. But I don't have M1 Mac, can't reproduce this error. And hope someone can help me.

notshriram commented 1 year ago

I'll create a separate issue for this