-
Notifications
You must be signed in to change notification settings - Fork 447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add cmake support #40
base: master
Are you sure you want to change the base?
Conversation
I have to admit I'm not a fan of CMake for its recursive makefile generation, but this is intriguing. At the end of the day if it's easier for people to build, then it's a win in my book. I'll take a closer look at this soon. |
Thanks! If you have any question or request, feel free to ask, I'll be happy to help. |
I messed with a cmake build a while ago. Its probably not as complete, but the work is here: pothosware@5b1c843 I actually made a little python script to parse the makefile rules into cmake variables to reduce the amount of duplication. For better for for worse :-) Here is a snippet if you want to extract the version number from liquid.h instead:
|
@guruofquality thanks! will update it as soon as i am back home! |
I've updated the change, removed some redundancy in building examples and merged the bits from @guruofquality. I've also fixed a couple of other issues related to cross compiling. |
@tienex Also, I would suggest throwing in a variable for LIB_SUFFIX. This helps the multi-arch systems (like when debian uses lib/x86_64-linux-gnu or when redhat uses lib64). I'm not suggesting any kind of automatic detection, just a way to set this if need-be. Here is a snippet/example that I commonly use:
Also thanks for doing this :-) |
@jgaeddert What about just improving autotools building? I had to improve build system a little bit so I moved project to use libtool and automake so it is easier for me to cross compile and build dll libraries on windows (mingw). If you're interested in I could tidy up the code and create pull request. |
@lleoha I want to state I didn't do this with the goal to replace the current build system nor I asked for that, I am just interested to have liquid-dsp build being integrable in larger cmake projects. |
OK I cleaned it up some more, especially the mess I did for CPU features check improving the CheckCPUID when cross-compiling based on compiler features available and added the ${LIB_SUFFIX} @guruofquality asked for. |
Hi tienex, any help on how to use the library on windows on Eclipse GCC for an STM32F7?? |
This is great stuff. liquid is the last dependency for my project that doesn't use cmake, so with this change I can just use the same toolchain file everywhere for cross-compiling 👍 |
Hi! liquid-dsp has has quite a few changes since this CMake branch was created. Has anyone had success using it to build in Windows/MSYS2/MinGW on more recent versions? Out of the box, I am getting undefined references:
Does the CMakeLists file need any changes to reflect the current code from jgaeddert? |
If you're still interested in maintining this, there was a file added that isn't in the CMakeLists.txt: src/math/src/windows.c Once I added that the static and shared lib both built. Haven't tried using yet... but the built finishes at least. |
How about adding cotire to all of this? |
Sorry to necropost but this would be great 😄 |
We still waiting... |
@jgaeddert instead of introducing CMAKE into the baseline, simply provide instructions on how to add this to an existing cmake project? There are many ways to add third-party dependencies. I am using CPM. CPMAddPackage(
NAME fftw3
URL "http://fftw.org/fftw-3.3.10.tar.gz"
OPTIONS "ENABLE_THREADS ON" "ENABLE_FLOAT ON" "BUILD_TESTS OFF"
) Then add liquid-dsp. CPMAddPackage(
NAME liquid
GITHUB_REPOSITORY jgaeddert/liquid-dsp
GIT_TAG v1.5.0
VERSION v1.5.0
DOWNLOAD_ONLY YES
)
if (liquid_ADDED)
set( liquid_LIBRARY "${liquid_BINARY_DIR}/lib/libliquid.so" )
set(CONFIGURE_ARGS "--prefix=${liquid_BINARY_DIR}")
execute_process( COMMAND "./bootstrap.sh"
WORKING_DIRECTORY ${liquid_SOURCE_DIR}
RESULT_VARIABLE BS_RESULT OUTPUT_VARIABLE
BS_OUTPUT ERROR_VARIABLE BS_ERROR)
execute_process( COMMAND "./configure" ${CONFIGURE_ARGS}
WORKING_DIRECTORY ${liquid_SOURCE_DIR}
RESULT_VARIABLE BS_RESULT OUTPUT_VARIABLE
BS_OUTPUT ERROR_VARIABLE BS_ERROR)
execute_process( COMMAND "make"
WORKING_DIRECTORY ${liquid_SOURCE_DIR}
RESULT_VARIABLE BS_RESULT OUTPUT_VARIABLE
BS_OUTPUT ERROR_VARIABLE BS_ERROR)
execute_process( COMMAND "make" "install"
WORKING_DIRECTORY ${liquid_SOURCE_DIR}
RESULT_VARIABLE BS_RESULT OUTPUT_VARIABLE
BS_OUTPUT ERROR_VARIABLE BS_ERROR)
add_library( liquid::liquid INTERFACE IMPORTED GLOBAL)
target_include_directories( liquid::liquid INTERFACE ${liquid_BINARY_DIR}/include)
target_link_libraries( liquid::liquid INTERFACE "${liquid_LIBRARY}")
endif() Then to include it in a target: target_link_libraries(my-program liquid::liquid fftw3f ) |
In case it helps, until official CMake support gets merged, I'm currently using liquid-dsp as an external project, which is kind of hacky: ExternalProject_Add(liquid-dsp-project
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/liquid-dsp
BUILD_IN_SOURCE TRUE
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/liquid-dsp/bootstrap.sh
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/liquid-dsp/configure
--prefix=${CMAKE_BINARY_DIR}/liquid-dsp
--enable-fftoverride
CFLAGS=${CMAKE_C_FLAGS}
CPPFLAGS=${CMAKE_C_FLAGS}
CXXFLAGS=${CMAKE_CXX_FLAGS}
LDFLAGS=${CMAKE_EXE_LINKER_FLAGS}
INSTALL_COMMAND ""
BUILD_BYPRODUCTS ${CMAKE_CURRENT_SOURCE_DIR}/liquid-dsp/libliquid.a
BUILD_ALWAYS TRUE
)
add_library(liquid-dsp STATIC IMPORTED GLOBAL)
add_dependencies(liquid-dsp liquid-dsp-project)
set_target_properties(liquid-dsp PROPERTIES
IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/liquid-dsp/libliquid.a
)
target_include_directories(liquid-dsp INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/liquid-dsp/include>
$<INSTALL_INTERFACE:${CMAKE_BINARY_DIR}/liquid-dsp/include/liquid>
)
target_link_libraries(liquid-dsp INTERFACE
m
) |
I needed to use this awesome library in a bigger project which requires CMake, since I don't feel to maintain it for the whole lifetime of the project, it would be nice if this could get merged as an alternative way to build liquid. I successfully compiled it on different architectures, including Windows (although some changes are required in order to run the benchmark suite) with Mingw.