-
Notifications
You must be signed in to change notification settings - Fork 85
/
CMakeLists.txt
89 lines (74 loc) · 2.27 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
cmake_minimum_required( VERSION 3.6 )
set( project_name png )
project( ${project_name} )
if( MSVC )
add_definitions(/MP)
endif()
set( source_dir ${CMAKE_CURRENT_SOURCE_DIR}/jni )
set( headers
${source_dir}/pnginfo.h
${source_dir}/config.h
${source_dir}/png.h
${source_dir}/pngconf.h
${source_dir}/pngdebug.h
${source_dir}/pnglibconf.h
${source_dir}/pngpriv.h
${source_dir}/pngstruct.h
)
set( sources
${source_dir}/arm/arm_init.c
${source_dir}/arm/filter_neon.S
${source_dir}/arm/filter_neon_intrinsics.c
${source_dir}/png.c
${source_dir}/pngerror.c
${source_dir}/pngget.c
${source_dir}/pngmem.c
${source_dir}/pngpread.c
${source_dir}/pngread.c
${source_dir}/pngrio.c
${source_dir}/pngrtran.c
${source_dir}/pngrutil.c
${source_dir}/pngset.c
${source_dir}/pngtest.c
${source_dir}/pngtrans.c
${source_dir}/pngwio.c
${source_dir}/pngwrite.c
${source_dir}/pngwtran.c
${source_dir}/pngwutil.c
)
find_package( zlib REQUIRED )
# If you want a shared library instead of static, specify the BUILD_SHARED_LIBS
# variable (which is a built-in CMake option).
add_library( ${project_name} ${sources} ${headers} )
target_link_libraries( ${project_name} PUBLIC ZLIB::ZLIB )
target_include_directories( ${project_name} PUBLIC
$<BUILD_INTERFACE:${source_dir}>
$<INSTALL_INTERFACE:include>
)
############################################################
## INSTALL
############################################################
include( CMakePackageConfigHelpers )
set( PNG_VERSION 1.6.37 )
set( PNG_EXPORT_DIR share/png-${PNG_VERSION}/cmake )
set( PNG_EXPORT_NAME png-export )
install( TARGETS png EXPORT ${PNG_EXPORT_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)
install( FILES ${headers} DESTINATION include )
install( EXPORT ${PNG_EXPORT_NAME} DESTINATION ${PNG_EXPORT_DIR} )
configure_file( png-config.cmake.in png-config.cmake @ONLY )
write_basic_package_version_file(
png-config-version.cmake
VERSION ${PNG_VERSION}
COMPATIBILITY AnyNewerVersion
)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/png-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/png-config-version.cmake
DESTINATION ${PNG_EXPORT_DIR}
)