CMakeLists.txt (1835B)
1 # Copyright (C) 2016-2023 Dan Cazarin (https://www.kfrlib.com) 2 # This file is part of KFR 3 # 4 # KFR is free software: you can redistribute it and/or modify 5 # it under the terms of the GNU General Public License as published by 6 # the Free Software Foundation, either version 2 of the License, or 7 # (at your option) any later version. 8 # 9 # KFR is distributed in the hope that it will be useful, 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # GNU General Public License for more details. 13 # 14 # You should have received a copy of the GNU General Public License 15 # along with KFR. 16 17 cmake_minimum_required(VERSION 3.12) 18 19 if (NOT WIN32) 20 set(CMAKE_CXX_VISIBILITY_PRESET "hidden") 21 set(CMAKE_C_VISIBILITY_PRESET "hidden") 22 endif () 23 24 if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") 25 add_compile_options(-fdiagnostics-absolute-paths) 26 endif () 27 28 add_library(kfr_capi SHARED capi.cpp) 29 target_link_libraries(kfr_capi PRIVATE kfr_dft kfr_dsp) 30 31 target_compile_definitions(kfr_capi PRIVATE KFR_BUILDING_DLL=1) 32 33 if (CMAKE_SYSTEM_NAME STREQUAL "Linux") 34 set_property( 35 TARGET kfr_capi 36 APPEND 37 PROPERTY LINK_LIBRARIES 38 -nodefaultlibs 39 -Wl,-Bdynamic 40 -lm 41 -lc 42 -Wl,-Bstatic 43 -lstdc++ 44 -lgcc 45 -s) 46 endif () 47 48 if (KFR_INSTALL_LIBRARIES) 49 if (KFR_ENABLE_CAPI_BUILD) 50 install( 51 TARGETS kfr_capi 52 EXPORT kfr_export 53 ARCHIVE DESTINATION lib$<$<CONFIG:Debug>:${KFR_DEBUG_INSTALL_SUFFIX}> 54 LIBRARY DESTINATION lib$<$<CONFIG:Debug>:${KFR_DEBUG_INSTALL_SUFFIX}> 55 RUNTIME DESTINATION bin$<$<CONFIG:Debug>:${KFR_DEBUG_INSTALL_SUFFIX}> 56 ) 57 endif () 58 endif ()