summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 22c5817e10952a01e4bafbc878f08cea63333542 (plain)
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
159
############################################
#
#  (C) 2023 Michele Calgaro
#  Michele (DOT) Calgaro (AT) yahoo.it
#
#  Improvements and feedback are welcome
#
#  This file is released under GPL >= 2
#
############################################


cmake_minimum_required( VERSION 3.1 )


#### general package setup

project( libksquirrel )

set(LIBKSQUIRREL_VERSION_MAJOR 0)
set(LIBKSQUIRREL_VERSION_MINOR 8)
set(LIBKSQUIRREL_VERSION_PATCH 0)
set(LIBKSQUIRREL_VERSION_STRING
    "${LIBKSQUIRREL_VERSION_MAJOR}.${LIBKSQUIRREL_VERSION_MINOR}.${LIBKSQUIRREL_VERSION_PATCH}")


#### include essential cmake modules

include( FindPkgConfig          )
include( CheckFunctionExists    )
include( CheckSymbolExists      )
include( CheckIncludeFile       )
include( CheckLibraryExists     )
include( CheckCSourceCompiles   )
include( CheckCXXSourceCompiles )


#### include our cmake modules

include( TDEMacros )


##### set version number

tde_set_project_version( )


##### setup install paths

include( TDESetupPaths )
tde_setup_paths( )


##### optional stuff

option( WITH_ALL_OPTIONS "Enable all optional support"         OFF )
option( WITH_JPEG        "Build camera code with jpeg support" ${WITH_ALL_OPTIONS} )
option( WITH_LCMS        "Build codecs with lcms support"      ${WITH_ALL_OPTIONS} )

option( WITH_GCC_VISIBILITY "Enable fvisibility and fvisibility-inlines-hidden" ${WITH_ALL_OPTIONS} )


##### user requested modules

option( BUILD_ALL      "Build all"            ON           )
option( BUILD_DOC      "Build documentation"  ${BUILD_ALL} )

option( BUILD_AVS      "Build avs codec"      ${BUILD_ALL} )
option( BUILD_BMP      "Build bmp codec"      ${BUILD_ALL} )
option( BUILD_CAMERA   "Build camera codec"   ${BUILD_ALL} )
option( BUILD_CUT      "Build cut codec"      ${BUILD_ALL} )
option( BUILD_DDS      "Build dds codec"      ${BUILD_ALL} )
option( BUILD_DICOM    "Build dicom codec"    ${BUILD_ALL} )
option( BUILD_DJVU     "Build djvu codec"     ${BUILD_ALL} )
option( BUILD_DXF      "Build dxf codec"      OFF          )
option( BUILD_EPS      "Build eps codec"      ${BUILD_ALL} )
option( BUILD_FIG      "Build fig codec"      ${BUILD_ALL} )
option( BUILD_FLI      "Build fli codec"      ${BUILD_ALL} )
option( BUILD_GIF      "Build gif codec"      ${BUILD_ALL} )
option( BUILD_HDR      "Build hdr codec"      ${BUILD_ALL} )
option( BUILD_ICO      "Build ico codec"      ${BUILD_ALL} )
option( BUILD_IFF      "Build iff codec"      ${BUILD_ALL} )
option( BUILD_JBIG     "Build jbig codec"     ${BUILD_ALL} )
option( BUILD_JPEG2000 "Build jpeg2000 codec" ${BUILD_ALL} )
option( BUILD_JPEG     "Build jpeg codec"     ${BUILD_ALL} )
option( BUILD_KOALA    "Build koala codec"    ${BUILD_ALL} )
option( BUILD_LEAF     "Build leaf codec"     ${BUILD_ALL} )
option( BUILD_LIF      "Build lif codec"      ${BUILD_ALL} )
option( BUILD_LJPEG    "Build ljpeg codec"    ${BUILD_ALL} )
option( BUILD_MAC      "Build mac codec"      ${BUILD_ALL} )
option( BUILD_MDL      "Build mdl codec"      ${BUILD_ALL} )
option( BUILD_MNG      "Build mng codec"      ${BUILD_ALL} )
option( BUILD_MSP      "Build msp codecs"     ${BUILD_ALL} )
option( BUILD_MTV      "Build mtv codec"      ${BUILD_ALL} )
option( BUILD_NEO      "Build neo codec"      ${BUILD_ALL} )
option( BUILD_OPENEXR  "Build openexr codec"  ${BUILD_ALL} )
option( BUILD_PCX      "Build pcx codec"      ${BUILD_ALL} )
option( BUILD_PI1      "Build pi1 codec"      ${BUILD_ALL} )
option( BUILD_PI3      "Build pi3 codec"      ${BUILD_ALL} )
option( BUILD_PICT     "Build pict codec"     ${BUILD_ALL} )
option( BUILD_PIX      "Build pix codec"      ${BUILD_ALL} )
option( BUILD_PNG      "Build png codec"      ${BUILD_ALL} )
option( BUILD_PNM      "Build pnm codec"      ${BUILD_ALL} )
option( BUILD_PSD      "Build psd codec"      ${BUILD_ALL} )
option( BUILD_PSP      "Build psp codec"      ${BUILD_ALL} )
option( BUILD_PXR      "Build pxr codec"      ${BUILD_ALL} )
option( BUILD_RAS      "Build ras codec"      ${BUILD_ALL} )
option( BUILD_RAWRGB   "Build rawrgb codec"   ${BUILD_ALL} )
option( BUILD_SCT      "Build sct codec"      ${BUILD_ALL} )
option( BUILD_SGI      "Build sgi codec"      ${BUILD_ALL} )
option( BUILD_SUN      "Build sun codec"      ${BUILD_ALL} )
option( BUILD_SVG      "Build svg codec"      ${BUILD_ALL} )
option( BUILD_TGA      "Build tga codec"      ${BUILD_ALL} )
option( BUILD_TIFF     "Build tiff codec"     ${BUILD_ALL} )
option( BUILD_TTF      "Build ttf codec"      ${BUILD_ALL} )
option( BUILD_UTAH     "Build utah codec"     ${BUILD_ALL} )
option( BUILD_WAL      "Build wal codec"      ${BUILD_ALL} )
option( BUILD_WBMP     "Build wbmp codec"     ${BUILD_ALL} )
option( BUILD_WMF      "Build wmf codec"      ${BUILD_ALL} )
option( BUILD_XBM      "Build xbm codec"      ${BUILD_ALL} )
option( BUILD_XCF      "Build xcf codec"      ${BUILD_ALL} )
option( BUILD_XCUR     "Build xcur codec"     ${BUILD_ALL} )
option( BUILD_XIM      "Build xim codec"      ${BUILD_ALL} )
option( BUILD_XPM      "Build xpm codec"      ${BUILD_ALL} )
option( BUILD_XWD      "Build xwd codec"      ${BUILD_ALL} )


##### configure checks

include( ConfigureChecks.cmake )


##### global compiler settings

add_definitions( -DHAVE_CONFIG_H )

set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--no-undefined" )


##### write pkgconfig file

string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} )

configure_file( ksquirrellibs.pc.cmake ksquirrellibs.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/ksquirrellibs.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )


##### source directories

add_subdirectory( kernel )
tde_conditional_add_subdirectory( BUILD_DOC doc )


##### write configure files

configure_file( config.h.cmake config.h @ONLY )