Skip to content

Commit

Permalink
capture compilation flags into binary
Browse files Browse the repository at this point in the history
  • Loading branch information
dernasherbrezon committed Jan 2, 2025
1 parent f2cb72f commit 8a10a33
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
15 changes: 10 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
cmake_minimum_required(VERSION 2.8)
project(sdr-server)

set(CMAKE_C_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffast-math -std=c11")
if(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage ")
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -ffast-math")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} --coverage")

if(NO_MANUAL_SIMD)
add_definitions(-DNO_MANUAL_SIMD)
else()
remove_definitions(-DNO_MANUAL_SIMD)
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
set(BUILD_COMPILATION_FLAGS "${CMAKE_C_FLAGS_DEBUG}")
elseif(CMAKE_BUILD_TYPE MATCHES Release)
set(BUILD_COMPILATION_FLAGS "${CMAKE_C_FLAGS_RELEASE}")
endif()
add_definitions(-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} ${BUILD_COMPILATION_FLAGS}")

add_library(sdr_serverLib
${CMAKE_CURRENT_SOURCE_DIR}/src/config.c
${CMAKE_CURRENT_SOURCE_DIR}/src/sdr_device.c
Expand Down
1 change: 1 addition & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ int main(int argc, char **argv) {
}
setvbuf(stdout, NULL, _IOLBF, 0);
printf("SIMD optimization: %s\n", SIMD_STATUS);
printf("compilation flags: %s\n", CMAKE_C_FLAGS);
struct server_config *server_config = NULL;
int code = create_server_config(&server_config, argv[1]);
if (code != 0) {
Expand Down
1 change: 1 addition & 0 deletions test/perf_xlating.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extern const char *SIMD_STATUS;

int main(void) {
printf("SIMD optimization: %s\n", SIMD_STATUS);
printf("compilation flags: %s\n", CMAKE_C_FLAGS);
uint32_t sampling_freq = 2016000;
uint32_t target_freq = 48000;
float *taps = NULL;
Expand Down

0 comments on commit 8a10a33

Please sign in to comment.