direwolf/conf/CMakeLists.txt

49 lines
2.0 KiB
CMake
Raw Normal View History

cmake: new build tool this step unify the builing system for all platforms (windows, linux, osx and *BSD) * Requirements: - gcc/clang (C/C++ compiler) (in debian build-essential) - cmake (in debian cmake) - git if you build from source (in debian git) - posix threads ** Requirements on *BSD/macOS: - portaudio ** Optional Requirements: - gpsd (in debian libgps-dev) - libhamlib (in debian libhamlib-dev) ** Optional Requirements in Linux - udev (in debian libudev-dev) - alsa (in debian libasound2-dev) * Main changes: - version is now set only on CMakeLists.txt and automatically used on the code - cpu flags are auto-discovered in the default build and it works on gcc/clang/msvc on x86/x86_64/arm; you can force cpu flags with -DFORCE_SSE=1 for example (see CMakeLists.txt on root) - use a more "complex" tag on generic.conf to facilitate parsing by cmake (not more platform dependent). Now it is %C% or %R% for example - target `tocalls-symbols` is now called `data-update` - created debian/ directory to contains files to use debuild * Example to build: mkdir build && cd build cmake .. make make install make install-conf then you have the binary files on src/ and in the system directory * CMake options (see the head of CMakeLists.txt) - FORCE_SSE force sse instruction - FORCE_SSSE3 force ssse3 instruction - FORCE_SSE41 force ssse4.1 instruction - OPTIONAL_TEST compile optional test (might be broken) - BUILD_TESTING enable tests (ctest framework) - CMAKE_INSTALL_PREFIX if you want to change your install path prefix for example: cmake .. -DOPTIONAL_TEST=ON
2019-08-15 06:30:42 +00:00
# generate conf per platform
file(READ "${CUSTOM_CONF_DIR}/generic.conf" file_content)
if(LINUX)
string(REGEX REPLACE "\n%W%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%L%([^\n]*)" "\n\\1" file_content "${file_content}")
elseif(WIN32)
string(REGEX REPLACE "\n%M%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%L%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%W%([^\n]*)" "\n\\1" file_content "${file_content}")
else() # macOS FreeBSD OpenBSD
string(REGEX REPLACE "\n%W%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%L%[^\n]*" "" file_content "${file_content}")
string(REGEX REPLACE "\n%M%([^\n]*)" "\n\\1" file_content "${file_content}")
endif()
# remove remark
string(REGEX REPLACE "\n%R%[^\n]*" "" file_content "${file_content}")
# clear common lines
string(REGEX REPLACE "\n%C%([^\n]*)" "\n\\1" file_content "${file_content}")
string(REGEX REPLACE "^%C%([^\n]*)" "\\1" file_content "${file_content}")
file(WRITE "${CMAKE_BINARY_DIR}/direwolf.conf" "${file_content}")
# install udev rules for CM108
if(LINUX)
install(FILES "${CUSTOM_CONF_DIR}/99-direwolf-cmedia.rules" DESTINATION etc/udev/rules.d/)
endif()
install(FILES "${CMAKE_BINARY_DIR}/direwolf.conf" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
install(FILES "${CUSTOM_CONF_DIR}/sdr.conf" DESTINATION share/doc/${CMAKE_PROJECT_NAME}/examples)
# Put sample configuration & startup files in home directory.
# This step would be done as ordinary user.
# Some people like to put the direwolf config file in /etc/ax25.
# Note that all of these are also in $(DESTDIR)/share/doc/direwolf/examples/.
if(NOT WIN32)
add_custom_target(install-conf
COMMAND ${CMAKE_COMMAND}
-DCUSTOM_BINARY_DIR="${CMAKE_BINARY_DIR}"
-DCUSTOM_CONF_DIR="${CUSTOM_CONF_DIR}"
-DCUSTOM_SCRIPTS_DIR="${CUSTOM_SCRIPTS_DIR}"
-DCUSTOM_TELEMETRY_DIR="${CUSTOM_TELEMETRY_DIR}"
-P "${CMAKE_SOURCE_DIR}/conf/install_conf.cmake"
)
cmake: new build tool this step unify the builing system for all platforms (windows, linux, osx and *BSD) * Requirements: - gcc/clang (C/C++ compiler) (in debian build-essential) - cmake (in debian cmake) - git if you build from source (in debian git) - posix threads ** Requirements on *BSD/macOS: - portaudio ** Optional Requirements: - gpsd (in debian libgps-dev) - libhamlib (in debian libhamlib-dev) ** Optional Requirements in Linux - udev (in debian libudev-dev) - alsa (in debian libasound2-dev) * Main changes: - version is now set only on CMakeLists.txt and automatically used on the code - cpu flags are auto-discovered in the default build and it works on gcc/clang/msvc on x86/x86_64/arm; you can force cpu flags with -DFORCE_SSE=1 for example (see CMakeLists.txt on root) - use a more "complex" tag on generic.conf to facilitate parsing by cmake (not more platform dependent). Now it is %C% or %R% for example - target `tocalls-symbols` is now called `data-update` - created debian/ directory to contains files to use debuild * Example to build: mkdir build && cd build cmake .. make make install make install-conf then you have the binary files on src/ and in the system directory * CMake options (see the head of CMakeLists.txt) - FORCE_SSE force sse instruction - FORCE_SSSE3 force ssse3 instruction - FORCE_SSE41 force ssse4.1 instruction - OPTIONAL_TEST compile optional test (might be broken) - BUILD_TESTING enable tests (ctest framework) - CMAKE_INSTALL_PREFIX if you want to change your install path prefix for example: cmake .. -DOPTIONAL_TEST=ON
2019-08-15 06:30:42 +00:00
endif()