forked from Unity-Technologies/crunch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
149 lines (134 loc) · 3.64 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
cmake_minimum_required(VERSION 3.5)
project(crunch)
if ("${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message(FATAL_ERROR
"Building from within the source tree is not supported.\n"
"Hint: mkdir -p build; cmake -H. -Bbuild; make -Cbuild\n")
endif ()
set(CMAKE_CXX_STANDARD 11)
find_package(Threads REQUIRED)
option(BUILD_SHARED_LIBS "Build crnlib as a shared library" OFF)
set(CRUNCH_TOOL_NAME crunch CACHE STRING "Name of crunch tool to build.")
set(CRUNCH_LIBRARY_NAME crnlib CACHE STRING "Name of crunch library to build.")
set(CRUNCH_COMPILE_OPTIONS
"-ffast-math"
"-fno-strict-aliasing"
"-Wno-attributes"
"-Wno-unused"
"-Wno-deprecated-declarations"
)
set(CRNLIB_SOURCE_FILES
crnlib/crn_arealist.cpp
crnlib/crn_assert.cpp
crnlib/crn_checksum.cpp
crnlib/crn_colorized_console.cpp
crnlib/crn_command_line_params.cpp
crnlib/crn_comp.cpp
crnlib/crn_console.cpp
crnlib/crn_core.cpp
crnlib/crn_data_stream.cpp
crnlib/crn_dds_comp.cpp
crnlib/crn_decomp.cpp
crnlib/crn_dxt.cpp
crnlib/crn_dxt1.cpp
crnlib/crn_dxt5a.cpp
crnlib/crn_dxt_endpoint_refiner.cpp
crnlib/crn_dxt_fast.cpp
crnlib/crn_dxt_hc.cpp
crnlib/crn_dxt_hc_common.cpp
crnlib/crn_dxt_image.cpp
crnlib/crn_dynamic_string.cpp
crnlib/crn_etc.cpp
crnlib/crn_file_utils.cpp
crnlib/crn_find_files.cpp
crnlib/crn_hash.cpp
crnlib/crn_hash_map.cpp
crnlib/crn_huffman_codes.cpp
crnlib/crn_image_utils.cpp
crnlib/crn_jpgd.cpp
crnlib/crn_jpge.cpp
crnlib/crn_ktx_texture.cpp
crnlib/crn_lzma_codec.cpp
crnlib/crn_math.cpp
crnlib/crn_mem.cpp
crnlib/crn_miniz.cpp
crnlib/crn_mipmapped_texture.cpp
crnlib/crn_pixel_format.cpp
crnlib/crn_platform.cpp
crnlib/crn_prefix_coding.cpp
crnlib/crn_qdxt1.cpp
crnlib/crn_qdxt5.cpp
crnlib/crn_rand.cpp
crnlib/crn_resample_filters.cpp
crnlib/crn_resampler.cpp
crnlib/crn_rg_etc1.cpp
crnlib/crn_ryg_dxt.cpp
crnlib/crn_sparse_bit_array.cpp
crnlib/crn_stb_image.cpp
crnlib/crn_strutils.cpp
crnlib/crn_symbol_codec.cpp
crnlib/crn_texture_comp.cpp
crnlib/crn_texture_conversion.cpp
crnlib/crn_texture_file_types.cpp
crnlib/crn_threaded_resampler.cpp
crnlib/crn_threading_pthreads.cpp
crnlib/crn_timer.cpp
crnlib/crn_utils.cpp
crnlib/crn_value.cpp
crnlib/crn_vector.cpp
crnlib/crnlib.cpp
crnlib/lzma_7zBuf.cpp
crnlib/lzma_7zBuf2.cpp
crnlib/lzma_7zCrc.cpp
crnlib/lzma_7zFile.cpp
crnlib/lzma_7zStream.cpp
crnlib/lzma_Alloc.cpp
crnlib/lzma_Bcj2.cpp
crnlib/lzma_Bra.cpp
crnlib/lzma_Bra86.cpp
crnlib/lzma_BraIA64.cpp
crnlib/lzma_LzFind.cpp
crnlib/lzma_LzmaDec.cpp
crnlib/lzma_LzmaEnc.cpp
crnlib/lzma_LzmaLib.cpp
)
set(CRNLIB_PUBLIC_HEADERS
inc/crnlib.h
)
add_library(crnlib ${CRNLIB_SOURCE_FILES})
set_target_properties(crnlib PROPERTIES
OUTPUT_NAME ${CRUNCH_LIBRARY_NAME}
PUBLIC_HEADER ${CRNLIB_PUBLIC_HEADERS})
target_compile_options(crnlib
PRIVATE ${CRUNCH_COMPILE_OPTIONS})
target_include_directories(crnlib PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}/crnlib
)
target_link_libraries(crnlib
${CMAKE_THREAD_LIBS_INIT}
)
set(CRUNCH_SOURCE_FILES
crunch/crunch.cpp
crunch/corpus_gen.cpp
crunch/corpus_test.cpp
)
add_executable(crunch ${CRUNCH_SOURCE_FILES})
set_target_properties(crunch PROPERTIES
OUTPUT_NAME ${CRUNCH_TOOL_NAME}
)
target_compile_options(crunch PRIVATE ${CRUNCH_COMPILE_OPTIONS})
target_link_libraries(crunch
${CMAKE_DL_LIBS}
crnlib
)
target_include_directories(crunch PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/inc
${CMAKE_CURRENT_SOURCE_DIR}/crnlib
)
install(TARGETS crnlib crunch
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include/crunch
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)