File: CMakeLists.txt

package info (click to toggle)
libsquish 1.15-1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 532 kB
  • ctags: 351
  • sloc: cpp: 2,728; makefile: 55
file content (117 lines) | stat: -rw-r--r-- 3,313 bytes parent folder | download
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
# cmake build file for squish
# by Stefan Roettger (snroettg@gmail.com)
# updated by Simon Brown (si@sjbrown.co.uk)

# features:
#   uses -fopenmp when available
#    use BUILD_SQUISH_WITH_OPENMP to override
#   Xcode: builds universal binaries, uses SSE2 on i386 and Altivec on ppc
#   Unix and VS: SSE2 support is enabled by default
#    use BUILD_SQUISH_WITH_SSE2 and BUILD_SQUISH_WITH_ALTIVEC to override

PROJECT(squish)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.3)

OPTION(BUILD_SQUISH_WITH_OPENMP "Build with OpenMP." ON)

OPTION(BUILD_SQUISH_WITH_SSE2 "Build with SSE2." ON)
OPTION(BUILD_SQUISH_WITH_ALTIVEC "Build with Altivec." OFF)

OPTION(BUILD_SHARED_LIBS "Build shared libraries." OFF)

OPTION(BUILD_SQUISH_EXTRA "Build extra source code." OFF)

IF (BUILD_SQUISH_WITH_OPENMP)
   FIND_PACKAGE(OpenMP)
   IF (OPENMP_FOUND)
       SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
       ADD_DEFINITIONS(-DSQUISH_USE_OPENMP)
   ENDIF()
ENDIF()

IF (CMAKE_GENERATOR STREQUAL "Xcode")
    SET(CMAKE_OSX_ARCHITECTURES "i386;ppc")
ELSE (CMAKE_GENERATOR STREQUAL "Xcode")
    IF (BUILD_SQUISH_WITH_SSE2 AND NOT WIN32)
        ADD_DEFINITIONS(-DSQUISH_USE_SSE=2 -msse2)
    ENDIF (BUILD_SQUISH_WITH_SSE2 AND NOT WIN32)
    IF (BUILD_SQUISH_WITH_ALTIVEC AND NOT WIN32)
        ADD_DEFINITIONS(-DSQUISH_USE_ALTIVEC=1 -maltivec)
    ENDIF (BUILD_SQUISH_WITH_ALTIVEC AND NOT WIN32)
ENDIF (CMAKE_GENERATOR STREQUAL "Xcode")

SET(SQUISH_HDRS
    squish.h
    )

SET(SQUISH_SRCS
    alpha.cpp
    alpha.h
    clusterfit.cpp
    clusterfit.h
    colourblock.cpp
    colourblock.h
    colourfit.cpp
    colourfit.h
    colourset.cpp
    colourset.h
    maths.cpp
    maths.h
    rangefit.cpp
    rangefit.h
    simd.h
    simd_float.h
    simd_sse.h
    simd_ve.h
    singlecolourfit.cpp
    singlecolourfit.h
    singlecolourlookup.inl
    squish.cpp
    )

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})

ADD_LIBRARY(squish ${SQUISH_SRCS} ${SQUISH_HDRS})

SET_TARGET_PROPERTIES(
    squish PROPERTIES
    PUBLIC_HEADER "${SQUISH_HDRS}"
    VERSION 0.0
    SOVERSION 0.0
    DEBUG_POSTFIX "d"
    XCODE_ATTRIBUTE_GCC_PREPROCESSOR_DEFINITIONS "$(SQUISH_CPP_$(CURRENT_ARCH))"
    XCODE_ATTRIBUTE_OTHER_CFLAGS "$(SQUISH_CFLAGS_$(CURRENT_ARCH))"
    XCODE_ATTRIBUTE_SQUISH_CPP_i386 "SQUISH_USE_SSE=2"
    XCODE_ATTRIBUTE_SQUISH_CFLAGS_i386 ""
    XCODE_ATTRIBUTE_SQUISH_CPP_ppc "SQUISH_USE_ALTIVEC=1"
    XCODE_ATTRIBUTE_SQUISH_CFLAGS_ppc "-maltivec"
    )

IF (BUILD_SQUISH_EXTRA)
    SET(SQUISHTEST_SRCS extra/squishtest.cpp)

    ADD_EXECUTABLE(squishtest ${SQUISHTEST_SRCS})
    SET_TARGET_PROPERTIES(squishtest PROPERTIES DEBUG_POSTFIX "d")
    TARGET_LINK_LIBRARIES(squishtest squish)

    SET(SQUISHPNG_SRCS extra/squishpng.cpp)

    FIND_PACKAGE(PNG)

    IF (PNG_FOUND)
        SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES)
        INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
        ADD_EXECUTABLE(squishpng ${SQUISHPNG_SRCS})
        SET_TARGET_PROPERTIES(squishpng PROPERTIES DEBUG_POSTFIX "d")
        TARGET_LINK_LIBRARIES(squishpng squish ${PNG_LIBRARIES})
    ENDIF (PNG_FOUND)
ENDIF (BUILD_SQUISH_EXTRA)

INSTALL(
    TARGETS squish
    LIBRARY DESTINATION lib
    ARCHIVE DESTINATION lib
    PUBLIC_HEADER DESTINATION include
    )