Updated CMakeLists to compile with correct flags and settings
This commit is contained in:
parent
3738012c3e
commit
92fb5c1d76
@ -1,17 +1,27 @@
|
|||||||
cmake_minimum_required (VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(LASP LANGUAGES C CXX VERSION 1.1)
|
project(LASP LANGUAGES C CXX VERSION 1.1)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED)
|
set(CMAKE_CXX_STANDARD_REQUIRED)
|
||||||
|
|
||||||
option(LASP_DOUBLE_PRECISION "Compile as double precision floating point" ON)
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64")
|
||||||
|
set(RPI TRUE)
|
||||||
|
else()
|
||||||
|
set(RPI FALSE)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Setting defaults for PortAudio and RtAudio backend, depending on Linux /
|
# Setting defaults for PortAudio and RtAudio backend, depending on Linux /
|
||||||
# Windows.
|
# Windows.
|
||||||
|
set(DEFAULT_DOUBLE_PRECISION ON)
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(DEFAULT_RTAUDIO OFF)
|
set(DEFAULT_RTAUDIO OFF)
|
||||||
set(DEFAULT_PORTAUDIO ON)
|
set(DEFAULT_PORTAUDIO ON)
|
||||||
set(DEFAULT_ULDAQ OFF)
|
set(DEFAULT_ULDAQ OFF)
|
||||||
|
elseif(${RPI})
|
||||||
|
set(DEFAULT_RTAUDIO OFF)
|
||||||
|
set(DEFAULT_PORTAUDIO ON)
|
||||||
|
set(DEFAULT_ULDAQ OFF)
|
||||||
|
|
||||||
else()
|
else()
|
||||||
set(DEFAULT_RTAUDIO OFF)
|
set(DEFAULT_RTAUDIO OFF)
|
||||||
set(DEFAULT_PORTAUDIO ON)
|
set(DEFAULT_PORTAUDIO ON)
|
||||||
@ -19,6 +29,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
option(LASP_DOUBLE_PRECISION "Compile as double precision floating point" ${DEFAULT_DOUBLE_PRECISION})
|
||||||
option(LASP_HAS_RTAUDIO "Compile with RtAudio Daq backend" ${DEFAULT_RTAUDIO})
|
option(LASP_HAS_RTAUDIO "Compile with RtAudio Daq backend" ${DEFAULT_RTAUDIO})
|
||||||
option(LASP_HAS_PORTAUDIO "Compile with PortAudio Daq backend" ${DEFAULT_PORTAUDIO})
|
option(LASP_HAS_PORTAUDIO "Compile with PortAudio Daq backend" ${DEFAULT_PORTAUDIO})
|
||||||
if(LASP_HAS_PORTAUDIO AND LASP_HAS_RTAUDIO)
|
if(LASP_HAS_PORTAUDIO AND LASP_HAS_RTAUDIO)
|
||||||
@ -34,7 +45,7 @@ option(LASP_BUILD_CPP_TESTS "Build CPP test code" OFF)
|
|||||||
find_program(CCACHE_PROGRAM ccache)
|
find_program(CCACHE_PROGRAM ccache)
|
||||||
if(CCACHE_PROGRAM)
|
if(CCACHE_PROGRAM)
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
|
||||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
|
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_PROGRAM}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# To allow linking to static libs from other directories
|
# To allow linking to static libs from other directories
|
||||||
@ -105,13 +116,17 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ###################################### Compilation flags
|
# ###################################### Compilation flags
|
||||||
set(CMAKE_C_FLAGS_RELEASE "-O3 -flto -mfpmath=sse -march=x86-64 -mtune=native \
|
set(CMAKE_C_FLAGS_RELEASE "-O3 -flto -mtune=native \
|
||||||
-fdata-sections -ffunction-sections -fomit-frame-pointer -finline-functions")
|
-fdata-sections -ffunction-sections -fomit-frame-pointer -finline-functions")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-type-limits -Werror=return-type")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-type-limits -Werror=return-type")
|
||||||
|
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -mfpmath=sse -march=x86-64 -mtune=native \
|
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -mtune=native \
|
||||||
-fdata-sections -ffunction-sections -fomit-frame-pointer -finline-functions")
|
-fdata-sections -ffunction-sections -fomit-frame-pointer -finline-functions")
|
||||||
|
|
||||||
|
if(NOT ${RPI})
|
||||||
|
set(CMAKE_C_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} -mfpmath=sse -march=x86-64)
|
||||||
|
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} -mfpmath=sse -march=x86-64)
|
||||||
|
endif()
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall ")
|
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall ")
|
||||||
|
|
||||||
# ############################# End compilation flags
|
# ############################# End compilation flags
|
||||||
|
Loading…
Reference in New Issue
Block a user