diff --git a/CMakeLists.txt b/CMakeLists.txt index 4342fec12..7fbfcc04a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off) option(USE_SHARED_JPEGLIB "Use your installed copy of jpeglib" off) option(USE_SHARED_ZLIB "Use your installed copy of zlib" off) option(USE_SHARED_LIBPNG "Use your installed copy of libpng" off) +option(USE_SHARED_LIBLOADPNG "Use your installed copy of libloadpng" off) option(USE_SHARED_TINYXML "Use your installed copy of tinyxml" off) option(USE_SHARED_GTEST "Use your installed copy of gtest" off) option(USE_SHARED_ALLEGRO4 "Use shared Allegro 4 library (without resize support)" off) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62e408125..3b48cfd39 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,8 +15,6 @@ set(aseprite_libraries aseprite-library undo-lib filters-lib ui-lib gfx-lib base include_directories(. .. ../third_party) # Third-party libraries -set(libs3rdparty loadpng) -include_directories(${LOADPNG_DIR}) if(USE_SHARED_JPEGLIB) find_package(JPEG) @@ -73,6 +71,17 @@ else() include_directories(${TINYXML_DIR}) endif() +if(USE_SHARED_LIBLOADPNG) + find_library(LIBLOADPNG_LIBRARY NAMES loadpng) + find_path(LIBLOADPNG_INCLUDE_DIR NAMES loadpng.h) + + set(libs3rdparty ${libs3rdparty} ${LIBLOADPNG_LIBRARY}) + include_directories(${LIBLOADPNG_INCLUDE_DIR}) +else() + set(libs3rdparty ${libs3rdparty} loadpng) + include_directories(${LOADPNG_DIR}) +endif() + if (CMAKE_USE_PTHREADS_INIT) set(sys_libs ${sys_libs} ${CMAKE_THREAD_LIBS_INIT}) endif() diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 48c17aeec..5480b7dd6 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -36,4 +36,6 @@ if(ENABLE_UPDATER AND NOT USE_SHARED_CURL) add_subdirectory(curl) endif() -add_subdirectory(loadpng) +if(NOT USE_SHARED_LIBLOADPNG) + add_subdirectory(loadpng) +endif()