mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Use pkg-config to detect libpng
Only fall back to findpng
This commit is contained in:
@@ -35,9 +35,6 @@ if(srcdir STREQUAL bindir)
|
|||||||
message(FATAL_ERROR "Terminating configuration")
|
message(FATAL_ERROR "Terminating configuration")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PNG 1.2 REQUIRED)
|
|
||||||
find_package(BISON REQUIRED)
|
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/include")
|
include_directories("${PROJECT_SOURCE_DIR}/include")
|
||||||
|
|
||||||
if(DEVELOP)
|
if(DEVELOP)
|
||||||
|
|||||||
@@ -12,6 +12,16 @@ set(common_src
|
|||||||
"version.c"
|
"version.c"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
find_package(BISON REQUIRED)
|
||||||
|
find_package(PkgConfig)
|
||||||
|
|
||||||
|
if(NOT PKG_CONFIG_FOUND)
|
||||||
|
# fallback to find_package
|
||||||
|
find_package(PNG REQUIRED)
|
||||||
|
else()
|
||||||
|
pkg_check_modules(LIBPNG REQUIRED libpng)
|
||||||
|
endif()
|
||||||
|
|
||||||
BISON_TARGET(ASMy "asm/asmy.y"
|
BISON_TARGET(ASMy "asm/asmy.y"
|
||||||
"${PROJECT_SOURCE_DIR}/src/asm/asmy.c"
|
"${PROJECT_SOURCE_DIR}/src/asm/asmy.c"
|
||||||
DEFINES_FILE "${PROJECT_SOURCE_DIR}/src/asm/asmy.h"
|
DEFINES_FILE "${PROJECT_SOURCE_DIR}/src/asm/asmy.h"
|
||||||
@@ -68,9 +78,15 @@ foreach(PROG "asm" "fix" "gfx" "link")
|
|||||||
install(TARGETS rgb${PROG} RUNTIME DESTINATION bin)
|
install(TARGETS rgb${PROG} RUNTIME DESTINATION bin)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
target_compile_definitions(rgbgfx PRIVATE ${PNG_DEFINITIONS})
|
if(LIBPNG_FOUND) # pkg-config
|
||||||
target_include_directories(rgbgfx PRIVATE ${PNG_INCLUDE_DIRS})
|
target_include_directories(rgbgfx PRIVATE ${LIBPNG_INCLUDE_DIRS})
|
||||||
target_link_libraries(rgbgfx PRIVATE ${PNG_LIBRARIES})
|
target_link_directories(rgbgfx PRIVATE ${LIBPNG_LIBRARY_DIRS})
|
||||||
|
target_link_libraries(rgbgfx PRIVATE ${LIBPNG_LIBRARIES})
|
||||||
|
else()
|
||||||
|
target_compile_definitions(rgbgfx PRIVATE ${PNG_DEFINITIONS})
|
||||||
|
target_include_directories(rgbgfx PRIVATE ${PNG_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(rgbgfx PRIVATE ${PNG_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
check_library_exists("m" "sin" "" HAS_LIBM)
|
check_library_exists("m" "sin" "" HAS_LIBM)
|
||||||
|
|||||||
Reference in New Issue
Block a user