]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix cmakebuild test 3883/head
authorYann Collet <cyan@fb.com>
Sat, 27 Jan 2024 23:09:21 +0000 (15:09 -0800)
committerYann Collet <cyan@fb.com>
Sun, 28 Jan 2024 01:30:06 +0000 (17:30 -0800)
write it in a way which is more compatible with older versions of cmake (<3.13)

Also:
fix pzstd compilation (notably on macos)

.github/workflows/dev-short-tests.yml
.gitignore
Makefile
build/cmake/contrib/pzstd/CMakeLists.txt

index 911ba60cc2e20b8b27e815362b7193105f62a0ea..593f37879ab2c1f7e5fceb7fc42a16af0295f548 100644 (file)
@@ -80,19 +80,16 @@ jobs:
         make clean
         LDFLAGS=-Wl,--no-undefined make -C lib libzstd-mt
 
-    # candidate test (to check) : underlink test
+    # candidate test (for discussion) : underlink test
     # LDFLAGS=-Wl,--no-undefined : will make the linker fail if dll is underlinked
 
   cmake-build-and-test-check:
     runs-on: ubuntu-latest
     steps:
     - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # tag=v3
-    - name: cmake build and test check
+    - name: cmake build and test
       run: |
-        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild
-        cp -r ./ "../zstd source"
-        cd "../zstd source"
-        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild
+        FUZZERTEST=-T1mn ZSTREAM_TESTTIME=-T1mn make cmakebuild V=1
 
   cpp-gnu90-c99-compatibility:
     runs-on: ubuntu-latest
index e95a8d07cd8685e07ae60af338884c3f05f320d7..048a4c4e49247a6390aa14a00c25298726fb6636 100644 (file)
@@ -27,6 +27,8 @@ tmp*
 dictionary.
 dictionary
 NUL
+cmakebuild/
+install/
 
 # Build artefacts
 contrib/linux-kernel/linux/
index 7bc7ec5bf9170eac705afaf59eb191405d24b398..87d80d16dea7ec0177a7e249456901843fc04628 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -145,7 +145,7 @@ clean:
        $(Q)$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
        $(Q)$(MAKE) -C contrib/externalSequenceProducer $@ > $(VOID)
        $(Q)$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
-       $(Q)$(RM) -r lz4
+       $(Q)$(RM) -r lz4 cmakebuild install
        @echo Cleaning completed
 
 #------------------------------------------------------------------------------
@@ -389,28 +389,32 @@ lz4install:
 endif
 
 
-CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
-
 ifneq (,$(filter MSYS%,$(shell uname)))
 HOST_OS = MSYS
-CMAKE_PARAMS = -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
 endif
 
 #------------------------------------------------------------------------
 # target specific tests
 #------------------------------------------------------------------------
 ifneq (,$(filter $(HOST_OS),MSYS POSIX))
-.PHONY: cmakebuild c89build gnu90build c99build gnu99build c11build bmix64build bmix32build bmi32build staticAnalyze
-cmakebuild:
-       cmake --version
-       $(RM) -r $(BUILDIR)/cmake/build
-       $(MKDIR) $(BUILDIR)/cmake/build
-       cd $(BUILDIR)/cmake/build; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) ..
-       $(MAKE) -C $(BUILDIR)/cmake/build -j4;
-       $(MAKE) -C $(BUILDIR)/cmake/build install;
-       $(MAKE) -C $(BUILDIR)/cmake/build uninstall;
-       cd $(BUILDIR)/cmake/build; ctest -V -L Medium
 
+CMAKE ?= cmake
+CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON
+
+ifneq (,$(filter MSYS%,$(shell uname)))
+CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
+endif
+
+.PHONY: cmakebuild
+cmakebuild:
+       $(CMAKE) --version
+       $(RM) -r cmakebuild install
+       $(MKDIR) cmakebuild install
+       cd cmakebuild; $(CMAKE) -Wdev -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_FLAGS="-Werror -O0" -DCMAKE_INSTALL_PREFIX=install $(CMAKE_PARAMS) ../build/cmake
+       $(CMAKE) --build cmakebuild --target install -- -j V=1
+       cd cmakebuild; ctest -V -L Medium
+
+.PHONY: c89build gnu90build c99build gnu99build c11build bmix64build bmix32build bmi32build staticAnalyze
 c89build: clean
        $(CC) -v
        CFLAGS="-std=c89 -Werror -Wno-attributes -Wpedantic -Wno-long-long -Wno-variadic-macros -O0" $(MAKE) lib zstd
index f7098fa0f7f2dc0afd3130e90e76d1a436301f05..e1c8e0672fe98abce02884c59c60ff341cf6c0c4 100644 (file)
@@ -18,6 +18,7 @@ set(PZSTD_DIR ${ZSTD_SOURCE_DIR}/contrib/pzstd)
 include_directories(${PROGRAMS_DIR} ${LIBRARY_DIR} ${LIBRARY_DIR}/common ${PZSTD_DIR})
 
 add_executable(pzstd ${PROGRAMS_DIR}/util.c ${PZSTD_DIR}/main.cpp ${PZSTD_DIR}/Options.cpp ${PZSTD_DIR}/Pzstd.cpp ${PZSTD_DIR}/SkippableFrame.cpp)
+target_compile_features(pzstd PRIVATE cxx_std_11)
 set_property(TARGET pzstd APPEND PROPERTY COMPILE_DEFINITIONS "NDEBUG")
 set_property(TARGET pzstd APPEND PROPERTY COMPILE_OPTIONS "-Wno-shadow")