-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
55 lines (41 loc) · 1.83 KB
/
CMakeLists.txt
File metadata and controls
55 lines (41 loc) · 1.83 KB
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
cmake_minimum_required(VERSION 2.8.11)
# Remove a macOS warning.
set(CMAKE_MACOSX_RPATH 1)
# Leave following 4 lines at the top of this file if you only want out-of-source builds.
if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
file(REMOVE CMakeCache.txt)
message(FATAL_ERROR "Do not build in-source. Please remove CMakeCache.txt and the CMakeFiles/ directory. Then build out-of-source.")
endif()
project (libframegen)
set(VERSION "0.1.0")
## Check Dependencies ##
find_package( ZLIB REQUIRED 1.2.11 REQUIRED)
if ( NOT ZLIB_FOUND )
message (FATAL_ERROR "Fatal error: ZLIB (version >= 1.2.11) required.\n")
endif( NOT ZLIB_FOUND )
## COMPILER SETUP ##
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -std=c++11 -Wall -g")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
message(INFO "${CMAKE_CXX_COMPILER_VERSION}")
message(FATAL_ERROR "GCC version must be at least 4.8!")
endif()
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -opt-prefetch -unroll-aggressive -march=native -mtune=native")
endif()
## SOURCES AND TARGETS ##
include_directories("." ${CMAKE_BINARY_DIR} ${ZLIB_INCLUDE_DIRS})
file(GLOB FRAMEGEN_SOURCES src/FrameGen.cpp)
add_library(framegen SHARED ${FRAMEGEN_SOURCES})
target_link_libraries(framegen ${ZLIB_LIBRARIES})
## Necessary directories for the test program. ##
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/exampleframes/lotsoffiles ${CMAKE_BINARY_DIR}/exampleframes/range)
add_executable(framegen-test src/framegen-test.cpp)
target_link_libraries(framegen-test framegen ${ZLIB_LIBRARIES})
## INSTALLATION ##
install(TARGETS framegen
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES src/FrameGen.hpp DESTINATION include)