Cmake: Detect CPU Features
This commit is contained in:
@@ -1,15 +1,31 @@
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
project(NeuralNetwork CXX)
|
||||
|
||||
include(cmake/CPUFeatures)
|
||||
|
||||
OPTION(BUILD_SHARED_LIBS "Build also shared library." ON)
|
||||
OPTION(USE_AVX "IF avx should be used." ON)
|
||||
OPTION(USE_SSE "IF sse should be used." ON)
|
||||
OPTION(USE_SSE2 "IF only sse2 should be used." OFF)
|
||||
|
||||
if(CPU_AVX_AVAILABLE)
|
||||
OPTION(USE_AVX "If AVX instruction set should be used." ON)
|
||||
endif(CPU_AVX_AVAILABLE)
|
||||
|
||||
if(CPU_SSE3_AVAILABLE)
|
||||
|
||||
OPTION(USE_SSE "If SSE instruction set should be used." ON)
|
||||
|
||||
if(CPU_SSE4.2_AVAILABLE)
|
||||
OPTION(USE_SSE2 "If SSE 2 instruction set should be used." OFF)
|
||||
else()
|
||||
OPTION(USE_SSE2 "If SSE 2 instruction set should be used." ON)
|
||||
endif(CPU_SSE4.2_AVAILABLE)
|
||||
|
||||
endif(CPU_SSE3_AVAILABLE)
|
||||
|
||||
OPTION(ENABLE_TESTS "enables tests" ON)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic -Weffc++ -Wshadow -Wstrict-aliasing -ansi -Woverloaded-virtual -Wdelete-non-virtual-dtor -Wno-unused-function")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++14")
|
||||
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -pthread")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user