diff options
author | evpobr <evpobr@gmail.com> | 2020-05-02 10:54:28 +0500 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2020-05-03 17:13:50 +1000 |
commit | e0b62a61a7b65aef187b038454925a34fa315125 (patch) | |
tree | 42cd4bd9f1924528b722fe0fcb6402c17348d94f /src | |
parent | 7a35c528495b6d8a51e87e007f6810b5553101bc (diff) | |
download | flac-e0b62a61a7b65aef187b038454925a34fa315125.tar.gz |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/flac/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/libFLAC++/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/libFLAC/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/metaflac/CMakeLists.txt | 7 | ||||
-rw-r--r-- | src/share/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/share/Makefile.am | 2 | ||||
-rw-r--r-- | src/share/win_utf8_io/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/test_grabbag/cuesheet/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/test_grabbag/picture/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/test_libFLAC++/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/test_libFLAC/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/test_seeking/CMakeLists.txt | 5 | ||||
-rw-r--r-- | src/utils/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/utils/Makefile.am | 2 | ||||
-rw-r--r-- | src/utils/flacdiff/CMakeLists.txt | 8 |
16 files changed, 46 insertions, 41 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5579fa88..b3c9fcf5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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") diff --git a/src/flac/CMakeLists.txt b/src/flac/CMakeLists.txt index ea4f6873..c227cd87 100644 --- a/src/flac/CMakeLists.txt +++ b/src/flac/CMakeLists.txt @@ -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}") diff --git a/src/libFLAC++/CMakeLists.txt b/src/libFLAC++/CMakeLists.txt index 9b453007..ec27835c 100644 --- a/src/libFLAC++/CMakeLists.txt +++ b/src/libFLAC++/CMakeLists.txt @@ -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}/" diff --git a/src/libFLAC/CMakeLists.txt b/src/libFLAC/CMakeLists.txt index 84f9ab83..cb5b2a63 100644 --- a/src/libFLAC/CMakeLists.txt +++ b/src/libFLAC/CMakeLists.txt @@ -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}/" diff --git a/src/metaflac/CMakeLists.txt b/src/metaflac/CMakeLists.txt index 77eafbdb..677ab1a5 100644 --- a/src/metaflac/CMakeLists.txt +++ b/src/metaflac/CMakeLists.txt @@ -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}") diff --git a/src/share/CMakeLists.txt b/src/share/CMakeLists.txt deleted file mode 100644 index b3c5a712..00000000 --- a/src/share/CMakeLists.txt +++ /dev/null @@ -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") diff --git a/src/share/Makefile.am b/src/share/Makefile.am index 00724ec5..9ee826b4 100644 --- a/src/share/Makefile.am +++ b/src/share/Makefile.am @@ -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 \ diff --git a/src/share/win_utf8_io/CMakeLists.txt b/src/share/win_utf8_io/CMakeLists.txt deleted file mode 100644 index 797e728b..00000000 --- a/src/share/win_utf8_io/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_library(win_utf8_io STATIC win_utf8_io.c) diff --git a/src/test_grabbag/cuesheet/CMakeLists.txt b/src/test_grabbag/cuesheet/CMakeLists.txt index dbe3a1a6..5f9a646c 100644 --- a/src/test_grabbag/cuesheet/CMakeLists.txt +++ b/src/test_grabbag/cuesheet/CMakeLists.txt @@ -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) diff --git a/src/test_grabbag/picture/CMakeLists.txt b/src/test_grabbag/picture/CMakeLists.txt index a51f7db8..77f1a388 100644 --- a/src/test_grabbag/picture/CMakeLists.txt +++ b/src/test_grabbag/picture/CMakeLists.txt @@ -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) diff --git a/src/test_libFLAC++/CMakeLists.txt b/src/test_libFLAC++/CMakeLists.txt index 11c0052c..2fa7b1e7 100644 --- a/src/test_libFLAC++/CMakeLists.txt +++ b/src/test_libFLAC++/CMakeLists.txt @@ -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) diff --git a/src/test_libFLAC/CMakeLists.txt b/src/test_libFLAC/CMakeLists.txt index 4bbadb9c..36a58200 100644 --- a/src/test_libFLAC/CMakeLists.txt +++ b/src/test_libFLAC/CMakeLists.txt @@ -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>) diff --git a/src/test_seeking/CMakeLists.txt b/src/test_seeking/CMakeLists.txt index dc7ae799..51442916 100644 --- a/src/test_seeking/CMakeLists.txt +++ b/src/test_seeking/CMakeLists.txt @@ -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) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt deleted file mode 100644 index cd7b060f..00000000 --- a/src/utils/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -if(BUILD_CXXLIBS) - add_subdirectory(flacdiff) - if(WIN32) - add_subdirectory(flactimer) - endif() -endif() diff --git a/src/utils/Makefile.am b/src/utils/Makefile.am index 9ea289be..7696a6cd 100644 --- a/src/utils/Makefile.am +++ b/src/utils/Makefile.am @@ -17,5 +17,3 @@ # distribution. SUBDIRS = flacdiff flactimer - -EXTRA_DIST = CMakeLists.txt diff --git a/src/utils/flacdiff/CMakeLists.txt b/src/utils/flacdiff/CMakeLists.txt index e6d08a63..ec9f771c 100644 --- a/src/utils/flacdiff/CMakeLists.txt +++ b/src/utils/flacdiff/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() |