-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cmake][Project] Update generic CMake project files
- Loading branch information
1 parent
e1ad345
commit 6326d1f
Showing
13 changed files
with
437 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,114 @@ | ||
project(asplib) | ||
|
||
cmake_minimum_required(VERSION 2.6) | ||
enable_language(CXX) | ||
|
||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}) | ||
cmake_minimum_required(VERSION 3.0) | ||
project(asplib VERSION 1.0) | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE 1) | ||
|
||
# Enable C++11 | ||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
|
||
# TODO solve 'Enable C++ exceptions' to 'NO' and I got warning: warning C4530: C++ exception handler used, | ||
# but unwind semantics are not enabled. Specify /EHsc' | ||
# Solution: http://stackoverflow.com/questions/552695/how-can-i-switch-off-exception-handling-in-msvc | ||
|
||
# make sure CMAKE_PREFIX_PATH is set | ||
# if(NOT CMAKE_PREFIX_PATH) | ||
# set(CMAKE_PREFIX_PATH "E:/Kodi/adsp_addons/asplib_depends") | ||
# list(APPEND CMAKE_PREFIX_PATH "E:/Kodi/adsp_addons/asplib_depends/include") | ||
# list(APPEND CMAKE_PREFIX_PATH "E:/Kodi/adsp_addons/asplib_depends/lib") | ||
# else() | ||
file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH) | ||
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}") | ||
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/include") | ||
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}/lib") | ||
# endif() | ||
|
||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) | ||
message(STATUS "CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}") | ||
message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") | ||
|
||
foreach(path ${CMAKE_PREFIX_PATH}) | ||
message(STATUS "path=${path}") | ||
endforeach() | ||
|
||
if(NOT ASPLIB_MODULES_TO_BUILD) | ||
set(ASPLIB_MODULES_TO_BUILD all) | ||
endif() | ||
|
||
include(cmake/UseMultiArch.cmake) | ||
include(cmake/asplib_helpers.cmake) | ||
|
||
set(asplib_NAME asplib) | ||
set(asplib_DESCRIPTION "asplib (Achim's Signal Processing LIBrary), is a small and lightweight C++ library for digital signal processing.") | ||
set(asplib_VERSION_MAJOR 0) | ||
set(asplib_VERSION_MINOR 3) | ||
set(asplib_VERSION_PATCH 0) | ||
|
||
if(NOT WIN32) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") | ||
if(NOT ASPLIB_FORCE_DEPENCY_BUILDS) | ||
set(ASPLIB_FORCE_DEPENCY_BUILDS OFF) | ||
endif() | ||
|
||
if(CMAKE_SYSTEM_NAME MATCHES "Linux") | ||
set(CMAKE_CXX_FLAGS "-DTARGET_LINUX") | ||
# project defines vars such as PROJECT_NAME, PROJECT_VERSION, ... | ||
if(NOT ${ASPLIB_BUILD_COUNT}) | ||
set(ASPLIB_BUILD_COUNT 0) | ||
endif() | ||
set(asplib_VERSION_PATCH ${ASPLIB_BUILD_COUNT}) | ||
|
||
set(asplib_DESCRIPTION "asplib (Achim's Signal Processing LIBrary), is a small and lightweight C++ library for digital signal processing.") | ||
|
||
set(CMAKE_POSITION_INDEPENDENT_CODE ON) | ||
set(CMAKE_INCLUDE_CURRENT_DIR ON) | ||
|
||
if(CMAKE_SYSTEM_NAME MATCHES Linux) | ||
add_definitions(-DTARGET_LINUX -fPIC) | ||
elseif(CMAKE_SYSTEM_NAME MATCHES Windows) | ||
add_definitions(-DTARGET_WINDOWS) | ||
|
||
if(CMAKE_SYSTEM_NAME MATCHES "Windows") | ||
set(CMAKE_CXX_FLAGS "-DTARGET_WINDOWS") | ||
# Enable the orginization of projects with folders | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
endif() | ||
|
||
if (NOT WIN32) | ||
add_definitions(-fPIC -g -O2) | ||
endif() | ||
|
||
set(asplib_INCLUDE_DIRS ${PROJECT_SOURCE_DIR} | ||
${PROJECT_SOURCE_DIR}/Biquads | ||
${CMAKE_INSTALL_PREFIX}/include/asplib) | ||
|
||
include_directories(${asplib_INCLUDE_DIRS}) | ||
|
||
set(SOURCES Biquads/Biquad_Native/asplib_Biquad_Native.cpp | ||
Biquads/apslib_BiquadFactory.cpp) | ||
|
||
set(HEADERS interfaces/asplib_IBaseBiquad.h | ||
Biquads/apslib_BiquadFactory.h | ||
Biquads/Biquad_Native/asplib_Biquad_Native.h | ||
asplib_utils/constants_typedefs/asplib_constants.h | ||
asplib_utils/constants_typedefs/asplib_typedefs.h | ||
asplib_utils/os/asplib_base_os.h | ||
asplib_utils/os/android/android_definitions.h | ||
asplib_utils/os/darwin_ios/darwin_ios_definitions.h | ||
asplib_utils/os/darwin_osx/darwin_osx_definitions.h | ||
asplib_utils/os/freebsd/freebsd_definitions.h | ||
asplib_utils/os/linux/linux_definitions.h | ||
asplib_utils/os/raspberry_pi/raspberry_pi_definitions.h | ||
asplib_utils/os/windows/windows_definitions.h) | ||
|
||
asplib_source_group("${SOURCES}") | ||
asplib_source_group("${HEADERS}") | ||
|
||
add_library(asplib ${SOURCES} ${HEADERS}) | ||
target_link_libraries(asplib ${asplib_LIBRARIES}) | ||
set_target_properties(asplib PROPERTIES VERSION ${asplib_VERSION_MAJOR}.${asplib_VERSION_MINOR}.${asplib_VERSION_PATCH} | ||
SOVERSION ${asplib_VERSION_MAJOR}.0) | ||
|
||
|
||
install(TARGETS asplib DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
asplib_install_with_folder("${HEADERS}" ${CMAKE_INSTALL_PREFIX}/include/asplib) | ||
add_subdirectory(asplib_modules) | ||
|
||
IF(NOT WIN32) | ||
if(NOT WIN32) | ||
# Pkgconfig | ||
include(cmake/PkgConfigHandler.cmake) | ||
configure_pc_file(asplib asplib.pc.in | ||
configure_pc_file(asplib cmake/asplib.pc.in | ||
asplib.pc | ||
${CMAKE_INSTALL_PREFIX} | ||
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR} | ||
${CMAKE_INSTALL_PREFIX}/include) | ||
|
||
install(FILES ${CMAKE_BINARY_DIR}/asplib.pc | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asplib.pc | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/pkgconfig) | ||
ENDIF(NOT WIN32) | ||
endif() | ||
|
||
# config mode | ||
configure_file(asplib-config.cmake.in | ||
asplib-config.cmake @ONLY) | ||
install(FILES ${CMAKE_BINARY_DIR}/asplib-config.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/asplib) | ||
#configure_file(cmake/asplib-config.cmake.in | ||
# asplib-config.cmake @ONLY) | ||
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/asplib-config.cmake | ||
# DESTINATION ${CMAKE_INSTALL_LIBDIR_NOARCH}/asplib) | ||
|
||
# Generate and install a CMake config, version and target file | ||
include(CMakePackageConfigHelpers) | ||
set(CMAKE_INSTALL_CMAKECONFIGDIR | ||
${CMAKE_INSTALL_LIBDIR_NOARCH}/cmake/${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}) | ||
|
||
write_basic_package_version_file(${PROJECT_NAME}-config-version.cmake COMPATIBILITY SameMajorVersion) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake | ||
DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR}) | ||
|
||
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in ${PROJECT_NAME}-config.cmake | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR}) | ||
#PATH_VARS INCLUDE_INSTALL_DIR) | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR}) | ||
|
||
install(EXPORT ${PROJECT_NAME} FILE ${PROJECT_NAME}-targets.cmake NAMESPACE ${CMAKE_PROJECT_NAME}:: | ||
DESTINATION ${CMAKE_INSTALL_CMAKECONFIGDIR}) | ||
|
||
get_cmake_property(_variableNames VARIABLES) | ||
foreach (_variableName ${_variableNames}) | ||
message(STATUS "${_variableName}=${${_variableName}}") | ||
endforeach() | ||
|
||
# Print project configuration | ||
message(STATUS) | ||
message(STATUS "${CMAKE_PROJECT_NAME} - Configuration:") | ||
message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}") | ||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") | ||
message(STATUS) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@PACKAGE_INIT@ | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@-targets.cmake) | ||
|
||
# asplib_INCLUDE_DIRS - header directories with which to compile | ||
# asplib_LIBRARIES - names of the libraries with which to link | ||
|
||
set(_asplib_supported_components "@ASPLIB_SUPPORTED_COMPONENTS@") | ||
|
||
# TODO: components | ||
#set(asplib_LIBRARIES asplib::Core asplib::FFT asplib::SpectrumVisProcessor) | ||
#set(asplib_LIBRARIES asplib::SpectrumVisProcessor) | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 3.2) | ||
|
||
project(@DL_ARGS_PROJECT@-download NONE) | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add(@DL_ARGS_PROJECT@-download | ||
@DL_ARGS_UNPARSED_ARGUMENTS@;UPDATE_DISCONNECTED 1 | ||
SOURCE_DIR "@DL_ARGS_SOURCE_DIR@" | ||
BINARY_DIR "@DL_ARGS_BINARY_DIR@" | ||
DOWNLOAD_DIR "@DL_ARGS_DOWNLOAD_DIR@" | ||
URL "@DL_ARGS_URL@/@DL_ARGS_DOWNLOAD_NAME@" | ||
CONFIGURE_COMMAND "" | ||
BUILD_COMMAND "" | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
set(_cmake_helpers_dir "${CMAKE_CURRENT_LIST_DIR}") | ||
|
||
include(CMakeParseArguments) | ||
|
||
function(importURLProject) | ||
|
||
set(options QUIET) | ||
set(oneValueArgs | ||
PROJECT | ||
PREFIX | ||
DOWNLOAD_DIR | ||
SOURCE_DIR | ||
BINARY_DIR | ||
DOWNLOAD_NAME | ||
URL | ||
# Prevent the following from being passed through | ||
CONFIGURE_COMMAND | ||
BUILD_COMMAND | ||
INSTALL_COMMAND | ||
TEST_COMMAND | ||
) | ||
set(multiValueArgs "") | ||
|
||
cmake_parse_arguments(DL_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) | ||
|
||
# Hide output if requested | ||
if (DL_ARGS_QUIET) | ||
set(OUTPUT_QUIET "OUTPUT_QUIET") | ||
else() | ||
unset(OUTPUT_QUIET) | ||
message(STATUS "Downloading/updating ${DL_ARGS_PROJECT}") | ||
endif() | ||
|
||
# Set up where we will put our temporary CMakeLists.txt file and also | ||
# the base point below which the default source and binary dirs will be | ||
if (NOT DL_ARGS_PREFIX) | ||
set(DL_ARGS_PREFIX "${CMAKE_BINARY_DIR}/depends") | ||
endif() | ||
if (NOT DL_ARGS_DOWNLOAD_DIR) | ||
set(DL_ARGS_DOWNLOAD_DIR "${DL_ARGS_PREFIX}/0download/${DL_ARGS_PROJECT}") | ||
message(STATUS "DL_ARGS_DOWNLOAD_DIR=${DL_ARGS_DOWNLOAD_DIR}") | ||
endif() | ||
|
||
# Ensure the caller can know where to find the source and build directories | ||
if (NOT DL_ARGS_SOURCE_DIR) | ||
set(DL_ARGS_SOURCE_DIR "${DL_ARGS_PREFIX}/${DL_ARGS_PROJECT}") | ||
endif() | ||
if (NOT DL_ARGS_BINARY_DIR) | ||
set(DL_ARGS_BINARY_DIR "${DL_ARGS_PREFIX}/0build/${DL_ARGS_PROJECT}") | ||
endif() | ||
set(${DL_ARGS_PROJECT}_BINARY_DIR "${DL_ARGS_BINARY_DIR}" PARENT_SCOPE) | ||
set(${DL_ARGS_PROJECT}_SOURCE_DIR "${DL_ARGS_SOURCE_DIR}" PARENT_SCOPE) | ||
|
||
# Create and build a separate CMake project to carry out the download. | ||
# If we've already previously done these steps, they will not cause | ||
# anything to be updated, so extra rebuilds of the project won't occur. | ||
configure_file("${_cmake_helpers_dir}/importURLProject.CMakeLists.txt.in" | ||
"${DL_ARGS_BINARY_DIR}/CMakeLists.txt") | ||
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . ${OUTPUT_QUIET} WORKING_DIRECTORY "${DL_ARGS_BINARY_DIR}") | ||
execute_process(COMMAND ${CMAKE_COMMAND} --build . ${OUTPUT_QUIET} WORKING_DIRECTORY "${DL_ARGS_BINARY_DIR}") | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
project(asplib_contrib_KissFFT) | ||
message(STATUS "Processing dependency KissFFT...") | ||
|
||
if (NOT ASPLIB_DEPENDS_SRC_PREFIX) | ||
set(ASPLIB_DEPENDS_SRC_PREFIX ${CMAKE_BINARY_DIR}/src) | ||
set(ASPLIB_DEPENDS_DOWNLOAD TRUE) | ||
else() | ||
set(ASPLIB_DEPENDS_DOWNLOAD FALSE) | ||
endif() | ||
|
||
include(add_KissFFT.cmake) |
Oops, something went wrong.