-
Notifications
You must be signed in to change notification settings - Fork 40
/
CMakeLists.txt
48 lines (38 loc) · 1.41 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
cmake_minimum_required(VERSION 3.0)
project(fsst)
find_package(Threads REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_VERBOSE_MAKEFILE ON)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(COMPILER_SUPPORTS_MARCH_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
if(NOT MSVC)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG")
else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O3 /DNDEBUG")
endif()
if(CMAKE_BUILD_TYPE STREQUAL Release)
set_source_files_properties(
fsst_avx512.cpp
PROPERTIES
COMPILE_FLAGS -O1
)
endif()
add_library(fsst libfsst.cpp fsst_avx512.cpp fsst_avx512_unroll1.inc fsst_avx512_unroll2.inc fsst_avx512_unroll3.inc fsst_avx512_unroll4.inc)
add_executable(binary fsst.cpp)
target_link_libraries (binary LINK_PUBLIC fsst)
target_link_libraries (binary LINK_PUBLIC Threads::Threads)
set_target_properties(binary PROPERTIES OUTPUT_NAME fsst)
add_library(fsst12 libfsst12.cpp)
add_executable(binary12 fsst.cpp)
target_link_libraries (binary12 LINK_PUBLIC fsst12)
target_link_libraries (binary12 LINK_PUBLIC Threads::Threads)
set_target_properties(binary12 PROPERTIES OUTPUT_NAME fsst12)
set_target_properties(binary12 PROPERTIES COMPILE_FLAGS -DFSST12)