-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
148 lines (118 loc) · 4.47 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
cmake_minimum_required(VERSION 2.8.6)
# Enable folder grouping of projects in IDEs
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (NOT CMAKE_BUILD_TYPE)
message(WARNING "No build type selected, defaulting to Debug")
set(CMAKE_BUILD_TYPE "Debug")
endif()
if (NOT DEFINED CMAKE_CL_64)
message(FATAL_ERROR "Must define CMAKE_CL_64 to some value")
endif (NOT DEFINED CMAKE_CL_64)
set(XMP_BUILD_STATIC "1")
# Our project
project(sjcam_raw2dng)
# import XMP SDK
set(XMPROOT "xmp_sdk")
# import DNG SDK
add_subdirectory(dng_sdk/projects/cmake)
set(SRC_DIR src)
add_definitions(-DqDNGThreadSafe)
if (CMAKE_CL_64)
add_definitions(-DqDNG64Bit)
endif (CMAKE_CL_64)
if (UNIX)
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DqMacOS=1 -DqWinOS=0 -DqLinux=0")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-z,relro -Wl,-z,now -Wl,-z,noexecstack")
set(warning_flags "-Wall \
-Wsign-compare \
-Wclobbered \
-Wempty-body \
-Wignored-qualifiers \
-Wsign-compare \
-Wtype-limits \
-Wunused-but-set-parameter \
-Wconversion \
-Winit-self \
-Wno-unused-function")
set(CMAKE_CXX_FLAGS_DEBUG "${warning_flags} \
-O0 \
-ggdb \
-DqDNGDebug=1 \
-D_FORTIFY_SOURCE=2")
set(CMAKE_CXX_FLAGS_RELEASE "${warning_flags} \
-O2 \
-DNDEBUG \
-U_FORTIFY_SOURCE")
endif (APPLE)
endif()
if (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /DqMacOS=0 /DqWinOS=1 /DqLinux=0 /D_CRT_SECURE_NO_DEPRECATE /DqDNGXMPDocOps=0")
endif(MSVC)
# cmake adds -rdynamic to all links which effectively disables lto
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
set(target sjcam_raw2dng)
add_executable(${target} ${SRC_DIR}/CFAReader.cpp
${SRC_DIR}/DNGConverter.cpp
${SRC_DIR}/CameraProfile.cpp
${SRC_DIR}/FileFinder.cpp
${SRC_DIR}/utils.cpp
${SRC_DIR}/StopWatch.cpp
${SRC_DIR}/sjcam_raw2dng.cpp)
target_include_directories(${target} PUBLIC ${SRC_DIR}
dng_sdk/source
${XMPROOT}/public/include)
if (UNIX)
if (APPLE)
set_property(TARGET ${target} PROPERTY LINK_FLAGS "-framework CoreFoundation -framework CoreServices")
endif (APPLE)
target_link_libraries(${target}
dng_sdk
pthread
dl
XMPFilesStatic
XMPCoreStatic
jpeg
dl
)
endif(UNIX)
if (MSVC)
target_link_libraries(${target}
dng_sdk
XMPFilesStatic
XMPCoreStatic
jpeg
)
endif(MSVC)
set(target prune_raw)
add_executable(${target} ${SRC_DIR}/prune_raw.cpp
${SRC_DIR}/FileFinder.cpp
${SRC_DIR}/utils.cpp)
target_include_directories(${target} PUBLIC ${SRC_DIR})
set(target extract_xmp)
add_executable(${target} ${SRC_DIR}/extract_xmp.cpp)
target_include_directories(${target} PUBLIC ${SRC_DIR}
${XMPROOT}/public/include)
if (UNIX)
target_link_libraries(${target}
pthread
dl
XMPFilesStatic
XMPCoreStatic
dl
)
if (APPLE)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "-DMAC_ENV=1")
else()
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "-DUNIX_ENV=1")
endif(APPLE)
endif(UNIX)
if (MSVC)
target_link_libraries(${target}
XMPFilesStatic
XMPCoreStatic
)
set_target_properties(${target} PROPERTIES COMPILE_FLAGS "/DWIN_ENV=1")
endif(MSVC)