-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
159 lines (142 loc) · 4.66 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# Copyright (c) 2010-2016 United States Government as represented by
# the U.S. Army Research Laboratory.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
#
# 3. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# *******************************************************************
# *** libutahrle CMakeLists.txt ***
# *******************************************************************
cmake_minimum_required(VERSION 3.18)
project(UTAHRLE)
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON)
endif(NOT DEFINED BUILD_SHARED_LIBS)
if(NOT DEFINED BUILD_STATIC_LIBS)
set(BUILD_STATIC_LIBS ON)
endif(NOT DEFINED BUILD_STATIC_LIBS)
if(NOT WIN32)
include(CheckLibraryExists)
check_library_exists(m cos "" HAVE_M_LIBRARY)
if(HAVE_M_LIBRARY)
set(M_LIBRARY m)
endif(HAVE_M_LIBRARY)
endif(NOT WIN32)
include(CheckIncludeFiles)
check_include_files(unistd.h HAVE_UNISTD_H)
if(HAVE_UNISTD_H)
add_definitions(-DHAVE_UNISTD_H=1)
endif(HAVE_UNISTD_H)
check_include_files(sys/wait.h HAVE_SYS_WAIT_H)
if(HAVE_SYS_WAIT_H)
add_definitions(-DHAVE_SYS_WAIT_H=1)
endif(HAVE_SYS_WAIT_H)
include_directories(
${${CMAKE_PROJECT_NAME}_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}
)
if(NOT DEFINED BIN_DIR)
set(BIN_DIR bin)
endif(NOT DEFINED BIN_DIR)
if(NOT DEFINED LIB_DIR)
set(LIB_DIR lib)
endif(NOT DEFINED LIB_DIR)
set(LIBUTAHRLE_PUBLIC_HDRS
${CMAKE_CURRENT_SOURCE_DIR}/include/rle.h
${CMAKE_CURRENT_SOURCE_DIR}/include/rle_code.h
${CMAKE_CURRENT_SOURCE_DIR}/include/rle_config.h
${CMAKE_CURRENT_SOURCE_DIR}/include/rle_put.h
${CMAKE_CURRENT_SOURCE_DIR}/include/rle_raw.h
)
set(LIBUTAHRLE_SOURCES
Runput.c
cmd_name.c
dither.c
float_to_exp.c
hilbert.c
inv_cmap.c
rle_addhist.c
rle_cp.c
rle_error.c
rle_getcom.c
rle_getraw.c
rle_getrow.c
rle_getskip.c
rle_global.c
rle_hdr.c
rle_open_f.c
rle_putcom.c
rle_putraw.c
rle_putrow.c
rle_raw_alc.c
rle_rawrow.c
rle_row_alc.c
vaxshort.c
)
if(MSVC)
add_definitions(
-DNO_DECLARE_MALLOC
-DNEED_BSTRING
-DNO_OPEN_PIPES
)
endif(MSVC)
if(BUILD_SHARED_LIBS)
add_library(utahrle SHARED ${LIBUTAHRLE_SOURCES})
if(MSVC)
set_property(TARGET utahrle APPEND PROPERTY COMPILE_DEFINITIONS "RLE_DLL_EXPORTS")
endif(MSVC)
target_link_libraries(utahrle ${M_LIBRARY})
set_target_properties(utahrle PROPERTIES VERSION 19.0.1 SOVERSION 19)
set_target_properties(utahrle PROPERTIES FOLDER "Third Party Libraries")
install(TARGETS utahrle
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
endif(BUILD_SHARED_LIBS)
if(BUILD_STATIC_LIBS)
add_library(utahrle-static STATIC ${LIBUTAHRLE_SOURCES})
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(utahrle-static PROPERTIES PREFIX "lib")
else(MSVC)
set_target_properties(utahrle-static PROPERTIES OUTPUT_NAME "utahrle")
endif(MSVC)
target_link_libraries(utahrle-static ${M_LIBRARY})
set_target_properties(utahrle-static PROPERTIES FOLDER "Third Party Libraries")
install(TARGETS utahrle-static
RUNTIME DESTINATION ${BIN_DIR}
LIBRARY DESTINATION ${LIB_DIR}
ARCHIVE DESTINATION ${LIB_DIR})
endif(BUILD_STATIC_LIBS)
install(FILES ${LIBUTAHRLE_PUBLIC_HDRS} DESTINATION include/utahrle)
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8