Skip to content

Commit 61e6a1a

Browse files
author
Oleh Kulykov
committed
1722295270
1 parent 5ebae1a commit 61e6a1a

24 files changed

+569
-366
lines changed

.github/workflows/cmake-cygwin.yml renamed to .github/workflows/cmake-mingw.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
22
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3-
name: CMake with CygWin
3+
name: CMake MinGW
44

55
on:
66
push:
@@ -32,6 +32,12 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v4
3434

35+
- name: List infos
36+
run: |
37+
gcc --version
38+
g++ --version
39+
mingw32-make --version
40+
3541
- name: Set reusable strings
3642
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
3743
id: strings
@@ -43,18 +49,20 @@ jobs:
4349
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
4450
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
4551
run: >
46-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
52+
cmake -G"MinGW Makefiles"
53+
-DCMAKE_MAKE_PROGRAM=mingw32-make
54+
-B ${{ steps.strings.outputs.build-output-dir }}
4755
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
4856
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
4957
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
5058
-S ${{ github.workspace }}
5159
5260
- name: Build
5361
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
54-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
62+
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} --parallel 4
5563

5664
- name: Test
5765
working-directory: ${{ steps.strings.outputs.build-output-dir }}
5866
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
5967
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
60-
run: ctest --build-config ${{ matrix.build_type }}
68+
run: ctest --build-config ${{ matrix.build_type }} --verbose

.github/workflows/cmake-multi-platform.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
c_compiler: cl
5151

5252
steps:
53-
- uses: actions/checkout@v3
53+
- uses: actions/checkout@v4
5454

5555
- name: Set reusable strings
5656
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.

CHANGELOG

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
(Portable, Patched, Package, cross-P-latform) Lzma SDK, libplzma
22

3-
1.4.4: (current):
3+
1.4.5: (current):
4+
- MinGW support.
5+
6+
1.4.4:
47
- Update of the underlying code.
58

69
1.4.3:

CMakeLists.txt

Lines changed: 96 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ set(PACKAGE "libplzma")
3333
set(CPACK_PACKAGE_NAME "${PACKAGE}")
3434
set(CPACK_PACKAGE_VERSION_MAJOR "1")
3535
set(CPACK_PACKAGE_VERSION_MINOR "4")
36-
set(CPACK_PACKAGE_VERSION_PATCH "4")
36+
set(CPACK_PACKAGE_VERSION_PATCH "5")
3737
set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}")
3838
set(CPACK_PACKAGE_VENDOR "olehkulykov@gmail.com")
3939
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PACKAGE} ${PACKAGE_VERSION}")
40-
set(SOVERSION "1.4.4")
40+
set(SOVERSION "1.4.5")
4141
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
4242
set(VERSION "${CPACK_PACKAGE_VERSION}")
4343

@@ -97,26 +97,42 @@ More info: https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run
9797

9898

9999
# ---- definitions ----
100-
if(WIN32)
101-
message("WIN32")
102-
add_definitions(-DWIN32)
103-
add_definitions(-D_WIN32)
104-
add_definitions(-DUNICODE)
105-
add_definitions(-D_UNICODE)
100+
if (WIN32 OR WIN64)
101+
add_definitions(-DUNICODE=1)
102+
add_definitions(-D_UNICODE=1)
103+
104+
if (WIN64 OR CMAKE_SIZEOF_VOID_P EQUAL 8)
105+
message("WIN 64")
106+
add_definitions(-DWIN64=1)
107+
add_definitions(-D_WIN64=1)
108+
elseif (WIN32 OR CMAKE_SIZEOF_VOID_P EQUAL 4)
109+
message("WIN 32")
110+
add_definitions(-DWIN32=1)
111+
add_definitions(-D_WIN32=1)
112+
else()
113+
message("WIN.. undefined")
114+
endif()
115+
116+
endif()
117+
118+
if (MINGW)
119+
add_definitions(-DLIBPLZMA_MINGW=1)
120+
message("MinGW")
106121
endif()
107122

108-
if(MSVC)
109-
message("MSVC")
110-
if(LIBPLZMA_OPT_MSVC_MULTITHREAD_STATIC)
111-
if(CMAKE_BUILD_TYPE MATCHES Debug)
123+
if (MSVC)
124+
# Run-Time Library
125+
# https://learn.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library
126+
if (LIBPLZMA_OPT_MSVC_MULTITHREAD_STATIC)
127+
if (CMAKE_BUILD_TYPE MATCHES Debug)
112128
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MTd")
113129
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MTd")
114130
else()
115131
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MT")
116132
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MT")
117133
endif()
118134
else()
119-
if(CMAKE_BUILD_TYPE MATCHES Debug)
135+
if (CMAKE_BUILD_TYPE MATCHES Debug)
120136
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MDd")
121137
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MDd")
122138
else()
@@ -130,71 +146,80 @@ if(MSVC)
130146
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /utf-8")
131147
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /utf-8")
132148

133-
if(LIBPLZMA_OPT_DISABLE_RUNTIME_TYPE_INFORMATION)
149+
if (LIBPLZMA_OPT_DISABLE_RUNTIME_TYPE_INFORMATION)
134150
# Disable Run-Time Type Information
151+
# Defined as 1 if the /GR (Enable Run-Time Type Information) compiler option is set. Otherwise, undefined.
152+
# When /GR is on, the compiler defines the _CPPRTTI preprocessor macro.
153+
# By default, /GR is on. /GR- disables run-time type information.
154+
# However, /GR increases the size of the .rdata sections of your image.
155+
# If your code does not use dynamic_cast or typeid, /GR- may produce a smaller image.
156+
# https://learn.microsoft.com/en-us/cpp/build/reference/gr-enable-run-time-type-information
135157
# https://docs.microsoft.com/en-us/cpp/build/reference/gr-enable-run-time-type-information
136158
# Check vs version: ?view=vs-2015
137159
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /GR-")
138160
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
161+
add_definitions(-DLIBPLZMA_NO_CPP_RTTI=1)
139162
endif()
140163

141164
else()
165+
142166
# C with -fPIC
143167
check_c_compiler_flag("-fPIC" WITH_FPIC_C)
144-
if(WITH_FPIC_C)
168+
if (WITH_FPIC_C)
145169
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
146170
endif()
147171

148172
# CXX with -fPIC
149173
check_cxx_compiler_flag("-fPIC" WITH_FPIC_CXX)
150-
if(WITH_FPIC_CXX)
174+
if (WITH_FPIC_CXX)
151175
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
152176
endif()
153177

154-
if(LIBPLZMA_OPT_DISABLE_RUNTIME_TYPE_INFORMATION)
178+
if (LIBPLZMA_OPT_DISABLE_RUNTIME_TYPE_INFORMATION)
155179
# CXX with -fno-rtti
156180
check_cxx_compiler_flag("-fno-rtti" WITH_FNO_RTTI_CXX)
157-
if(WITH_FNO_RTTI_CXX)
181+
if (WITH_FNO_RTTI_CXX)
158182
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
159183
add_definitions(-DLIBPLZMA_NO_CPP_RTTI=1)
160184
endif()
161185
endif()
162186

163187
endif()
164188

165-
if(LIBPLZMA_OPT_TESTS)
189+
190+
if (LIBPLZMA_OPT_TESTS)
166191
add_definitions(-DCMAKE_BUILD_WITH_TESTS=1)
167192
endif()
168193

169-
if(CMAKE_BUILD_TYPE MATCHES Debug)
194+
if (CMAKE_BUILD_TYPE MATCHES Debug)
170195
add_definitions(-DDEBUG=1)
171196
endif()
172197

173-
if(LIBPLZMA_OPT_BUILD_NUMBER)
198+
if (LIBPLZMA_OPT_BUILD_NUMBER)
174199
add_definitions(-DLIBPLZMA_VERSION_BUILD=${LIBPLZMA_OPT_BUILD_NUMBER})
175200
endif()
176201

177-
if(LIBPLZMA_OPT_NO_C_BINDINGS)
202+
if (LIBPLZMA_OPT_NO_C_BINDINGS)
178203
add_definitions(-DLIBPLZMA_NO_C_BINDINGS=1)
179204
endif()
180205

181-
if(LIBPLZMA_OPT_NO_CRYPTO)
206+
if (LIBPLZMA_OPT_NO_CRYPTO)
182207
add_definitions(-DLIBPLZMA_NO_CRYPTO=1)
183208
endif()
184209

185-
if(LIBPLZMA_OPT_HAVE_STD)
210+
if (LIBPLZMA_OPT_HAVE_STD)
186211
add_definitions(-DLIBPLZMA_HAVE_STD=1)
187212
endif()
188213

189-
if(LIBPLZMA_OPT_NO_TAR)
214+
if (LIBPLZMA_OPT_NO_TAR)
190215
add_definitions(-DLIBPLZMA_NO_TAR=1)
191216
endif()
192217

193-
if(LIBPLZMA_OPT_NO_PROGRESS)
218+
if (LIBPLZMA_OPT_NO_PROGRESS)
194219
add_definitions(-DLIBPLZMA_NO_PROGRESS=1)
195220
endif()
196221

197-
if(LIBPLZMA_OPT_THREAD_UNSAFE)
222+
if (LIBPLZMA_OPT_THREAD_UNSAFE)
198223
add_definitions(-DLIBPLZMA_THREAD_UNSAFE=1)
199224
endif()
200225

@@ -206,53 +231,77 @@ add_definitions(-DLIBPLZMA_BUILD=1)
206231
set(THREADS_PREFER_PTHREAD_FLAG ON)
207232
find_package(Threads REQUIRED)
208233

209-
if(LIBPLZMA_OPT_ANDROID)
234+
if (LIBPLZMA_OPT_ANDROID)
210235
find_library(log-lib log)
211236
endif()
212237

213238
# ---- check include ----
214239
CHECK_INCLUDE_FILE("sys/types.h" LIBPLZMA_HAVE_SYS_TYPES_H)
215-
if(LIBPLZMA_HAVE_SYS_TYPES_H)
240+
if (LIBPLZMA_HAVE_SYS_TYPES_H)
216241
add_definitions(-DHAVE_SYS_TYPES_H=1)
217242
endif()
243+
218244
CHECK_INCLUDE_FILE("sys/sys_types.h" LIBPLZMA_HAVE_SYS_SYS_TYPES_H)
219-
if(LIBPLZMA_HAVE_SYS_SYS_TYPES_H)
245+
if (LIBPLZMA_HAVE_SYS_SYS_TYPES_H)
220246
add_definitions(-DHAVE_SYS_SYS_TYPES_H=1)
221247
endif()
248+
222249
CHECK_INCLUDE_FILE("sys/sysmacros.h" LIBPLZMA_HAVE_SYS_SYSMACROS_H)
223-
if(LIBPLZMA_HAVE_SYS_SYSMACROS_H)
250+
if (LIBPLZMA_HAVE_SYS_SYSMACROS_H)
224251
add_definitions(-DHAVE_SYS_SYSMACROS_H=1)
225252
endif()
253+
226254
CHECK_INCLUDE_FILE("sys/utime.h" LIBPLZMA_HAVE_SYS_UTIME_H)
227-
if(LIBPLZMA_HAVE_SYS_UTIME_H)
255+
if (LIBPLZMA_HAVE_SYS_UTIME_H)
228256
add_definitions(-DHAVE_SYS_UTIME_H=1)
229257
endif()
258+
230259
CHECK_INCLUDE_FILE("utime.h" LIBPLZMA_HAVE_UTIME_H)
231-
if(LIBPLZMA_HAVE_UTIME_H)
260+
if (LIBPLZMA_HAVE_UTIME_H)
232261
add_definitions(-DHAVE_UTIME_H=1)
233262
endif()
234263

264+
CHECK_INCLUDE_FILE("semaphore.h" LIBPLZMA_SEMAPHORE_H)
265+
if (LIBPLZMA_SEMAPHORE_H)
266+
add_definitions(-DHAVE_SEMAPHORE_H=1)
267+
endif()
268+
269+
CHECK_INCLUDE_FILE("unistd.h" LIBPLZMA_UNISTD_H)
270+
if (LIBPLZMA_UNISTD_H)
271+
add_definitions(-DHAVE_UNISTD_H=1)
272+
endif()
273+
274+
CHECK_INCLUDE_FILE("pthread.h" LIBPLZMA_PTHREAD_H)
275+
if (LIBPLZMA_PTHREAD_H)
276+
add_definitions(-DHAVE_PTHREAD_H=1)
277+
endif()
278+
279+
CHECK_INCLUDE_FILE("android/api-level.h" LIBPLZMA_ANDROID_API_LEVEL_H)
280+
if (LIBPLZMA_ANDROID_API_LEVEL_H)
281+
add_definitions(-DHAVE_ANDROID_API_LEVEL_H=1)
282+
endif()
283+
235284

236285
# ---- check functions ----
237-
if(MSVC)
286+
if (MSVC)
238287
check_symbol_exists(_wfopen_s "stdio.h" HAVE__WFOPEN_S)
239-
if(NOT HAVE__WFOPEN_S)
288+
if (NOT HAVE__WFOPEN_S)
240289
check_symbol_exists(_wfopen_s "wchar.h" HAVE__WFOPEN_S)
241290
endif()
242-
if(HAVE__WFOPEN_S)
291+
if (HAVE__WFOPEN_S)
243292
add_definitions(-DHAVE__WFOPEN_S=1)
244293
endif()
245294

246295
check_symbol_exists(_wdupenv_s "stdlib.h" HAVE__WDUPENV_S)
247-
if(NOT HAVE__WDUPENV_S)
296+
if (NOT HAVE__WDUPENV_S)
248297
check_symbol_exists(_wdupenv_s "wchar.h" HAVE__WDUPENV_S)
249298
endif()
250-
if(HAVE__WDUPENV_S)
299+
if (HAVE__WDUPENV_S)
251300
add_definitions(-DHAVE__WDUPENV_S=1)
252301
endif()
253302

254303
check_symbol_exists(_dupenv_s "stdlib.h" HAVE__DUPENV_S)
255-
if(HAVE__DUPENV_S)
304+
if (HAVE__DUPENV_S)
256305
add_definitions(-DHAVE__DUPENV_S=1)
257306
endif()
258307
endif(MSVC)
@@ -992,27 +1041,27 @@ source_group("CPP/7zip/Crypto"
9921041
src/CPP/7zip/Crypto/StdAfx.h
9931042
)
9941043

995-
if(LIBPLZMA_OPT_SHARED)
1044+
if (LIBPLZMA_OPT_SHARED)
9961045
add_library(plzma SHARED ${LIBPLZMA_SOURCES} ${LIBPLZMA_PUBLIC_HEADERS} ${LIBPLZMA_INTERNAL_HEADERS})
997-
set_property(TARGET plzma APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_SHARED)
998-
if(MSVC)
1046+
set_property(TARGET plzma APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_SHARED=1)
1047+
if (MSVC)
9991048
message("Shared lib. MSVC")
10001049
# MSVC does not append 'lib' - do it here to have consistent name
10011050
set_property(TARGET plzma PROPERTY PREFIX "lib")
10021051
set_property(TARGET plzma PROPERTY IMPORT_PREFIX "lib")
10031052
endif()
10041053
target_link_libraries(plzma Threads::Threads)
1005-
if(LIBPLZMA_OPT_ANDROID)
1054+
if (LIBPLZMA_OPT_ANDROID)
10061055
target_link_libraries(plzma android)
10071056
target_link_libraries(plzma ${log-lib})
10081057
endif()
10091058
install(TARGETS plzma DESTINATION lib)
10101059
endif()
10111060

1012-
if(LIBPLZMA_OPT_STATIC)
1061+
if (LIBPLZMA_OPT_STATIC)
10131062
add_library(plzma_static STATIC ${LIBPLZMA_SOURCES} ${LIBPLZMA_PUBLIC_HEADERS} ${LIBPLZMA_INTERNAL_HEADERS})
1014-
set_property(TARGET plzma_static APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_STATIC)
1015-
if(MSVC)
1063+
set_property(TARGET plzma_static APPEND PROPERTY COMPILE_FLAGS -DLIBPLZMA_STATIC=1)
1064+
if (MSVC)
10161065
# MSVC does not append 'lib' - do it here to have consistent name
10171066
set_target_properties(plzma_static PROPERTIES PREFIX "lib")
10181067
endif()
@@ -1021,7 +1070,7 @@ endif()
10211070

10221071
install(FILES ${LIBPLZMA_PUBLIC_HEADERS} DESTINATION include)
10231072

1024-
if(LIBPLZMA_OPT_TESTS)
1073+
if (LIBPLZMA_OPT_TESTS)
10251074
enable_testing()
10261075
add_subdirectory(cmake_tests)
10271076

PLzmaSDK-ObjC.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'PLzmaSDK-ObjC'
3-
s.version = '1.4.4'
3+
s.version = '1.4.5'
44
s.summary = '(Portable, Patched, Package, cross-P-latform) Lzma SDK, libplzma'
55
s.homepage = 'https://github.com/OlehKulykov/PLzmaSDK'
66
s.source = { :git => s.homepage + '.git', :tag => s.version }
@@ -14,7 +14,7 @@ Pod::Spec.new do |s|
1414

1515
s.source_files = 'libplzma.h', 'libplzma.hpp', 'src/**/*.{c,cpp,h,hpp}', 'objc/*.{mm,h,inl}'
1616
s.public_header_files = 'objc/*.h'
17-
s.compiler_flags = '-DLIBPLZMA_VERSION_BUILD=761', '-DLIBPLZMA_NO_C_BINDINGS=1'
17+
s.compiler_flags = '-DLIBPLZMA_VERSION_BUILD=858', '-DLIBPLZMA_NO_C_BINDINGS=1'
1818
s.libraries = 'c++'
1919
s.requires_arc = true
2020

PLzmaSDK.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'PLzmaSDK'
3-
s.version = '1.4.4'
3+
s.version = '1.4.5'
44
s.summary = '(Portable, Patched, Package, cross-P-latform) Lzma SDK, libplzma'
55
s.homepage = 'https://github.com/OlehKulykov/PLzmaSDK'
66
s.source = { :git => s.homepage + '.git', :tag => s.version }
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
1616
s.subspec 'libplzma' do |libplzma|
1717
libplzma.source_files = 'libplzma.h', 'libplzma.hpp', 'src/**/*.{c,cpp,h,hpp}'
1818
libplzma.public_header_files = 'libplzma.h'
19-
libplzma.compiler_flags = '-DLIBPLZMA_VERSION_BUILD=761'
19+
libplzma.compiler_flags = '-DLIBPLZMA_VERSION_BUILD=858'
2020
libplzma.libraries = 'c++'
2121
end
2222

0 commit comments

Comments
 (0)