direwolf/external/misc/CMakeLists.txt

74 lines
1.8 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
set(MISC_LIBRARIES misc CACHE INTERNAL "misc")
include_directories(
${CMAKE_SOURCE_DIR}/src
)
if(LINUX)
# Previously -
# list(APPEND misc_SOURCES
# # Provide our own copy of strlcpy and strlcat
# # because they are not included with Linux.
# ${CUSTOM_MISC_DIR}/strlcpy.c
# ${CUSTOM_MISC_DIR}/strlcat.c
# )
# It seems that Alpine Linux and Void Linux have strlcpy and
# strlcat so we need to handle the situation more delicately.
# When doing it this way, there is probably no reason to
# distinguish between Linux and BSD-like systems here.
# If we kept going, the same thing could be done for each
# of the functions and no OS check would be needed.
if (NOT HAVE_STRLCPY)
list(APPEND misc_SOURCES
${CUSTOM_MISC_DIR}/strlcpy.c
)
endif()
if (NOT HAVE_STRLCAT)
list(APPEND misc_SOURCES
${CUSTOM_MISC_DIR}/strlcat.c
)
endif()
# Add_library doesn't like to get an empty source file list.
# I tried several variations on this theme to test whether the list
# was not empty and was not successful in getting it to work
# on both Alpine and RPi.
#if("${misc_SOURCES}")
# This is less elegant and less maintainable but it works.
if ((NOT HAVE_STRLCPY) OR (NOT HAVE_STRLCAT))
add_library(misc STATIC
${misc_SOURCES}
)
else()
set(MISC_LIBRARIES "" CACHE INTERNAL "")
endif()
elseif(WIN32 OR CYGWIN) # windows
list(APPEND misc_SOURCES
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
# There are several string functions found in Linux
# but not on Windows. Need to provide our own copy.
${CUSTOM_MISC_DIR}/strsep.c
${CUSTOM_MISC_DIR}/strtok_r.c
${CUSTOM_MISC_DIR}/strcasestr.c
${CUSTOM_MISC_DIR}/strlcpy.c
${CUSTOM_MISC_DIR}/strlcat.c
)
add_library(misc STATIC
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
${misc_SOURCES}
)
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
else()
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
# on macOS, OpenBSD and FreeBSD not misc is necessary
set(MISC_LIBRARIES "" CACHE INTERNAL "")
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()