summaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
blob: f0edde7aeea53e415e3742c3b5adc293d5757a72 (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
# --- Look for SSE support --------------------------------------------------
include(CheckCXXSourceRuns)
set(SSE_FLAGS)
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
    set(CMAKE_REQUIRED_FLAGS "-msse")
    check_cxx_source_runs("
        #include <xmmintrin.h>
        int main()
        {
            __m128 a, b;
            float vals[4] = {0};
            a = _mm_loadu_ps(vals);
            b = a;
            b = _mm_add_ps(a,b);
            _mm_storeu_ps(vals,b);
            return 0;
        }"
    SSE_AVAILABLE)

    set(CMAKE_REQUIRED_FLAGS)

    if (SSE_AVAILABLE)
        option(HAVE_SSE "Use SSE extensions" ON)
        set(SSE_FLAGS "-msse")
    endif()
endif()

# --- Build library and install ---------------------------------------------
include_directories(
    ${CMAKE_SOURCE_DIR}/src 
    ${CMAKE_CURRENT_BINARY_DIR}
)

set(IPECAMERA_WIDTH "5120" CACHE STRING "Sensor width in pixels (default: 5120)")

configure_file("config.h.in"
               "${CMAKE_CURRENT_BINARY_DIR}/config.h")

add_definitions("--std=c99 -Wall -O2 ${SSE_FLAGS}")

add_library(ufodecode SHARED ufodecode.c)

set_target_properties(ufodecode PROPERTIES
    VERSION ${LIBUFODECODE_ABI_VERSION}
    SOVERSION ${LIBUFODECODE_ABI_MAJOR_VERSION}
)

install(TARGETS ufodecode
    LIBRARY DESTINATION ${LIBUFODECODE_LIBDIR}
)

install(FILES
    ufodecode.h
    DESTINATION ${LIBUFODECODE_INCLUDEDIR}
)