Bunch of CMake fixes
* Add more Git ignore patterns * Fix Ogg dependency handling (closes #203) * Remove unneeded compiler flag (closes #204) * Fix Visual Studio DLL build error error C2491: 'flac_internal_rename_utf8': definition of dllimport function not allowed (closes #205) * Add alias targets * Reduce number of CMake files * Improve CMake intrinsics detection
This commit is contained in:
parent
7a35c52849
commit
e0b62a61a7
15
.gitignore
vendored
15
.gitignore
vendored
@ -77,3 +77,18 @@ test/picture.log
|
||||
microbench/benchmark_residual
|
||||
oss-fuzz/fuzz-decoder
|
||||
oss-fuzz/fuzz-encoder
|
||||
|
||||
/*[Bb]uild*/
|
||||
CMakeLists.txt.user
|
||||
CMakeCache.txt
|
||||
CMakeFiles
|
||||
CMakeScripts
|
||||
Testing
|
||||
Makefile
|
||||
cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
_deps
|
||||
|
||||
/.vs*/
|
||||
|
@ -23,7 +23,7 @@ option(INSTALL_CMAKE_CONFIG_MODULE "Install CMake package-config module" ON)
|
||||
option(WITH_OGG "ogg support (default: test for libogg)" ON)
|
||||
|
||||
if(WITH_OGG)
|
||||
find_package(OGG REQUIRED)
|
||||
find_package(Ogg REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Iconv)
|
||||
@ -36,9 +36,6 @@ endif()
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef")
|
||||
endif()
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_EXE_LINKER_FLAGS -no-pie)
|
||||
endif()
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
include(CPack)
|
||||
@ -57,7 +54,11 @@ include(TestBigEndian)
|
||||
check_include_file("byteswap.h" HAVE_BYTESWAP_H)
|
||||
check_include_file("inttypes.h" HAVE_INTTYPES_H)
|
||||
check_include_file("stdint.h" HAVE_STDINT_H)
|
||||
check_include_file("x86intrin.h" FLAC__HAS_X86INTRIN)
|
||||
if(MSVC)
|
||||
check_include_file("intrin.h" FLAC__HAS_X86INTRIN)
|
||||
else()
|
||||
check_include_file("x86intrin.h" FLAC__HAS_X86INTRIN)
|
||||
endif()
|
||||
|
||||
check_function_exists(fseeko HAVE_FSEEKO)
|
||||
|
||||
@ -140,7 +141,6 @@ if(INSTALL_CMAKE_CONFIG_MODULE)
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/flac-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/flac-config-version.cmake"
|
||||
"cmake/FindOGG.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake")
|
||||
endif()
|
||||
|
||||
|
@ -41,7 +41,7 @@ EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
config.cmake.h.in \
|
||||
flac-config.cmake.in \
|
||||
cmake/FindOGG.cmake \
|
||||
cmake/FindOgg.cmake \
|
||||
cmake/UseSystemExtensions.cmake \
|
||||
COPYING.FDL \
|
||||
COPYING.GPL \
|
||||
|
@ -14,7 +14,7 @@ mark_as_advanced(
|
||||
OGG_LIBRARY)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(OGG
|
||||
find_package_handle_standard_args(Ogg
|
||||
REQUIRED_VARS OGG_INCLUDE_DIR OGG_LIBRARY
|
||||
VERSION_VAR _OGG_VERSION)
|
||||
|
@ -19,7 +19,28 @@ doxygen_add_docs(FLAC-doxygen
|
||||
"${PROJECT_SOURCE_DIR}/include/FLAC"
|
||||
"${PROJECT_SOURCE_DIR}/include/FLAC++")
|
||||
|
||||
add_subdirectory(html)
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/"
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/html/api")
|
||||
|
||||
install(FILES
|
||||
html/images/logo.svg
|
||||
html/images/logo130.gif
|
||||
html/changelog.html
|
||||
html/developers.html
|
||||
html/documentation.html
|
||||
html/documentation_bugs.html
|
||||
html/documentation_example_code.html
|
||||
html/documentation_format_overview.html
|
||||
html/documentation_tools.html
|
||||
html/documentation_tools_flac.html
|
||||
html/documentation_tools_metaflac.html
|
||||
html/faq.html
|
||||
html/favicon.ico
|
||||
html/features.html
|
||||
html/flac.css
|
||||
html/format.html
|
||||
html/id.html
|
||||
html/index.html
|
||||
html/license.html
|
||||
html/ogg_mapping.html
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/html")
|
||||
|
@ -1,22 +0,0 @@
|
||||
add_subdirectory(images)
|
||||
|
||||
install(FILES
|
||||
changelog.html
|
||||
developers.html
|
||||
documentation.html
|
||||
documentation_bugs.html
|
||||
documentation_example_code.html
|
||||
documentation_format_overview.html
|
||||
documentation_tools.html
|
||||
documentation_tools_flac.html
|
||||
documentation_tools_metaflac.html
|
||||
faq.html
|
||||
favicon.ico
|
||||
features.html
|
||||
flac.css
|
||||
format.html
|
||||
id.html
|
||||
index.html
|
||||
license.html
|
||||
ogg_mapping.html
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/html")
|
@ -38,7 +38,7 @@ html_DATA = \
|
||||
license.html \
|
||||
ogg_mapping.html
|
||||
|
||||
EXTRA_DIST = $(html_DATA) api CMakeLists.txt
|
||||
EXTRA_DIST = $(html_DATA) api
|
||||
|
||||
if FLaC__HAS_DOXYGEN
|
||||
# The install targets don't copy whole directories so we have to
|
||||
|
@ -1,4 +0,0 @@
|
||||
install(FILES
|
||||
logo.svg
|
||||
logo130.gif
|
||||
DESTINATION "${CMAKE_INSTALL_DOCDIR}/html/images")
|
@ -22,4 +22,4 @@ logos_DATA = \
|
||||
logo.svg \
|
||||
logo130.gif
|
||||
|
||||
EXTRA_DIST = $(logos_DATA) CMakeLists.txt
|
||||
EXTRA_DIST = $(logos_DATA)
|
||||
|
@ -1,4 +1,7 @@
|
||||
add_subdirectory("c")
|
||||
add_subdirectory("c/decode/file")
|
||||
add_subdirectory("c/encode/file")
|
||||
|
||||
if(BUILD_CXXLIBS)
|
||||
add_subdirectory("cpp")
|
||||
add_subdirectory("cpp/decode/file")
|
||||
add_subdirectory("cpp/encode/file")
|
||||
endif()
|
||||
|
@ -1,2 +0,0 @@
|
||||
add_subdirectory("decode/file")
|
||||
add_subdirectory("encode/file")
|
@ -17,5 +17,3 @@
|
||||
# distribution.
|
||||
|
||||
SUBDIRS = decode encode
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
@ -1,2 +0,0 @@
|
||||
add_subdirectory("decode/file")
|
||||
add_subdirectory("encode/file")
|
@ -17,5 +17,3 @@
|
||||
# distribution.
|
||||
|
||||
SUBDIRS = decode encode
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
@ -1,10 +1,7 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
if(@OGG_FOUND@)
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(OGG)
|
||||
endif()
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Ogg)
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/targets.cmake")
|
||||
|
||||
|
@ -7,12 +7,22 @@ add_subdirectory("libFLAC")
|
||||
if(BUILD_CXXLIBS)
|
||||
add_subdirectory("libFLAC++")
|
||||
endif()
|
||||
add_subdirectory("share")
|
||||
add_subdirectory("share/replaygain_analysis")
|
||||
add_subdirectory("share/replaygain_synthesis")
|
||||
add_subdirectory("share/getopt")
|
||||
add_subdirectory("share/utf8")
|
||||
add_subdirectory("share/grabbag")
|
||||
|
||||
if(BUILD_PROGRAMS)
|
||||
add_subdirectory("flac")
|
||||
add_subdirectory("metaflac")
|
||||
endif()
|
||||
add_subdirectory("utils")
|
||||
if(BUILD_CXXLIBS)
|
||||
add_subdirectory(utils/flacdiff)
|
||||
if(WIN32)
|
||||
add_subdirectory(utils/flactimer)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_XMMS)
|
||||
add_subdirectory("plugin_common")
|
||||
|
@ -9,16 +9,15 @@ add_executable(flacapp
|
||||
main.c
|
||||
local_string_utils.c
|
||||
utils.c
|
||||
vorbiscomment.c)
|
||||
vorbiscomment.c
|
||||
$<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>)
|
||||
set_property(TARGET flacapp PROPERTY RUNTIME_OUTPUT_NAME flac)
|
||||
target_link_libraries(flacapp
|
||||
FLAC
|
||||
getopt
|
||||
replaygain_synthesis
|
||||
utf8)
|
||||
if(TARGET win_utf8_io)
|
||||
target_link_libraries(flacapp win_utf8_io)
|
||||
endif()
|
||||
|
||||
install(TARGETS flacapp EXPORT targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
@ -35,6 +35,8 @@ if(BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(FLAC::FLAC++ ALIAS FLAC++)
|
||||
|
||||
install(TARGETS FLAC++ EXPORT targets
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
|
||||
|
@ -75,6 +75,8 @@ add_library(FLAC
|
||||
stream_encoder_intrin_avx2.c
|
||||
stream_encoder_framing.c
|
||||
window.c
|
||||
$<$<BOOL:${WIN32}>:../../include/share/windows_unicode_filenames.h>
|
||||
$<$<BOOL:${WIN32}>:windows_unicode_filenames.c>
|
||||
$<$<BOOL:${OGG_FOUND}>:ogg_decoder_aspect.c>
|
||||
$<$<BOOL:${OGG_FOUND}>:ogg_encoder_aspect.c>
|
||||
$<$<BOOL:${OGG_FOUND}>:ogg_helper.c>
|
||||
@ -82,9 +84,6 @@ add_library(FLAC
|
||||
if(TARGET FLAC-asm)
|
||||
target_sources(FLAC PRIVATE $<TARGET_OBJECTS:FLAC-asm>)
|
||||
endif()
|
||||
if(WIN32)
|
||||
target_sources(FLAC PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/windows_unicode_filenames.c>)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(FLAC
|
||||
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC_API_EXPORTS>
|
||||
@ -108,6 +107,8 @@ if(BUILD_SHARED_LIBS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(FLAC::FLAC ALIAS FLAC)
|
||||
|
||||
|
||||
install(TARGETS FLAC EXPORT targets
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}/"
|
||||
|
@ -8,11 +8,10 @@ add_executable(metaflac
|
||||
operations_shorthand_vorbiscomment.c
|
||||
options.c
|
||||
usage.c
|
||||
utils.c)
|
||||
utils.c
|
||||
$<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>)
|
||||
target_link_libraries(metaflac FLAC getopt utf8)
|
||||
if(TARGET win_utf8_io)
|
||||
target_link_libraries(metaflac win_utf8_io)
|
||||
endif()
|
||||
|
||||
install(TARGETS metaflac EXPORT targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
@ -1,8 +0,0 @@
|
||||
add_subdirectory("replaygain_analysis")
|
||||
add_subdirectory("replaygain_synthesis")
|
||||
add_subdirectory("getopt")
|
||||
add_subdirectory("utf8")
|
||||
if(WIN32)
|
||||
add_subdirectory("win_utf8_io")
|
||||
endif()
|
||||
add_subdirectory("grabbag")
|
@ -21,7 +21,6 @@ AUTOMAKE_OPTIONS = subdir-objects
|
||||
AM_CPPFLAGS = -I$(top_builddir) -I$(srcdir)/include -I$(top_srcdir)/include
|
||||
|
||||
EXTRA_DIST = \
|
||||
CMakeLists.txt \
|
||||
Makefile.lite \
|
||||
README \
|
||||
getopt/CMakeLists.txt \
|
||||
@ -52,7 +51,6 @@ EXTRA_DIST = \
|
||||
utf8/utf8_static.vcproj \
|
||||
utf8/utf8_static.vcxproj \
|
||||
utf8/utf8_static.vcxproj.filters \
|
||||
win_utf8_io/CMakeLists.txt \
|
||||
win_utf8_io/Makefile.lite \
|
||||
win_utf8_io/win_utf8_io_static.vcproj \
|
||||
win_utf8_io/win_utf8_io_static.vcxproj \
|
||||
|
@ -1 +0,0 @@
|
||||
add_library(win_utf8_io STATIC win_utf8_io.c)
|
@ -1,2 +1,5 @@
|
||||
add_executable(test_cuesheet main.c)
|
||||
add_executable(test_cuesheet
|
||||
main.c
|
||||
$<$<BOOL:${WIN32}>:../../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../../share/win_utf8_io/win_utf8_io.c>)
|
||||
target_link_libraries(test_cuesheet FLAC grabbag)
|
||||
|
@ -1,2 +1,5 @@
|
||||
add_executable(test_picture main.c)
|
||||
add_executable(test_picture
|
||||
main.c
|
||||
$<$<BOOL:${WIN32}>:../../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../../share/win_utf8_io/win_utf8_io.c>)
|
||||
target_link_libraries(test_picture FLAC grabbag)
|
||||
|
@ -4,5 +4,7 @@ add_executable(test_libFLAC++
|
||||
main.cpp
|
||||
metadata.cpp
|
||||
metadata_manip.cpp
|
||||
metadata_object.cpp)
|
||||
metadata_object.cpp
|
||||
$<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>)
|
||||
target_link_libraries(test_libFLAC++ FLAC++ test_libs_common grabbag)
|
||||
|
@ -14,7 +14,9 @@ add_executable(test_libFLAC
|
||||
"$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/bitreader.c"
|
||||
"$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/bitwriter.c"
|
||||
"$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/crc.c"
|
||||
"$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/md5.c")
|
||||
"$<TARGET_PROPERTY:FLAC,SOURCE_DIR>/md5.c"
|
||||
$<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>)
|
||||
|
||||
target_compile_definitions(test_libFLAC PRIVATE
|
||||
$<$<BOOL:${ENABLE_64_BIT_WORDS}>:ENABLE_64_BIT_WORDS>)
|
||||
|
@ -1,2 +1,5 @@
|
||||
add_executable(test_seeking main.c)
|
||||
add_executable(test_seeking
|
||||
main.c
|
||||
$<$<BOOL:${WIN32}>:../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../share/win_utf8_io/win_utf8_io.c>)
|
||||
target_link_libraries(test_seeking FLAC)
|
||||
|
@ -1,6 +0,0 @@
|
||||
if(BUILD_CXXLIBS)
|
||||
add_subdirectory(flacdiff)
|
||||
if(WIN32)
|
||||
add_subdirectory(flactimer)
|
||||
endif()
|
||||
endif()
|
@ -17,5 +17,3 @@
|
||||
# distribution.
|
||||
|
||||
SUBDIRS = flacdiff flactimer
|
||||
|
||||
EXTRA_DIST = CMakeLists.txt
|
||||
|
@ -1,5 +1,5 @@
|
||||
add_executable(flacdiff main.cpp)
|
||||
add_executable(flacdiff
|
||||
main.cpp
|
||||
$<$<BOOL:${WIN32}>:../../../include/share/win_utf8_io.h>
|
||||
$<$<BOOL:${WIN32}>:../../share/win_utf8_io/win_utf8_io.c>)
|
||||
target_link_libraries(flacdiff FLAC++)
|
||||
if(TARGET win_utf8_io)
|
||||
target_link_libraries(flacdiff win_utf8_io)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user