Skip to content

Commit bfd0ae7

Browse files
committed
fix compilation errors in case of building without ut
1 parent 302636b commit bfd0ae7

File tree

5 files changed

+36
-25
lines changed

5 files changed

+36
-25
lines changed

CMakeLists.txt

-25
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,5 @@
11
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
22

3-
macro(use_cxx11)
4-
if (CMAKE_VERSION VERSION_LESS "3.1")
5-
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
6-
set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
7-
endif ()
8-
else ()
9-
set (CMAKE_CXX_STANDARD 11)
10-
endif ()
11-
endmacro(use_cxx11)
12-
13-
use_cxx11()
14-
15-
macro(use_c11)
16-
if (CMAKE_VERSION VERSION_LESS "3.1")
17-
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
18-
set (CMAKE_C_FLAGS "--std=gnu11 ${CMAKE_C_FLAGS}")
19-
endif ()
20-
else ()
21-
set (CMAKE_C_STANDARD 11)
22-
endif ()
23-
endmacro(use_c11)
24-
25-
use_c11()
26-
273
add_subdirectory(3rd/gtest-1.7.0)
284
add_subdirectory(src)
295
add_subdirectory(test)
30-

src/CMakeLists.txt

+14
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
22

3+
macro(use_11)
4+
if (CMAKE_VERSION VERSION_LESS "3.1")
5+
message ("cmake version: " ${CMAKE_VERSION} " --std arguments will be forced")
6+
7+
set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE)
8+
set (CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
9+
else ()
10+
set (CMAKE_CXX_STANDARD 11)
11+
set (CMAKE_C_STANDARD 11)
12+
endif ()
13+
endmacro(use_11)
14+
15+
use_11()
16+
317
#add_definitions( "-Wall -O2 -g -Rpass-analysis=loop-vectorize" )
418
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")
519

src/config.h

+5
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ typedef double TFloat;
77
#else
88
typedef float TFloat;
99
#endif
10+
11+
12+
#ifndef M_PI
13+
#define M_PI (3.14159265358979323846)
14+
#endif

src/mdct/vorbis_impl/mdct.c

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
*/
3838

3939
#include "mdct.h"
40+
#include <alloca.h>
4041

4142
/**
4243
* Allocates and initializes lookup tables in the MDCT context.

test/CMakeLists.txt

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
2+
3+
macro(use_11)
4+
if (CMAKE_VERSION VERSION_LESS "3.1")
5+
message ("cmake version: " ${CMAKE_VERSION} " --std arguments will be forced")
6+
7+
set (CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}" CACHE STRING "" FORCE)
8+
set (CMAKE_C_FLAGS "-std=c11 ${CMAKE_C_FLAGS}" CACHE STRING "" FORCE)
9+
else ()
10+
set (CMAKE_CXX_STANDARD 11)
11+
set (CMAKE_C_STANDARD 11)
12+
endif ()
13+
endmacro(use_11)
14+
15+
use_11()
16+
117
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fsanitize=address -fno-omit-frame-pointer")
218

319
include_directories(${gtest_SOURCE_DIR}/include)

0 commit comments

Comments
 (0)