Skip to content

Commit

Permalink
Merge pull request #4 from neurolabusc/windows
Browse files Browse the repository at this point in the history
Windows
  • Loading branch information
neurolabusc authored Feb 19, 2020
2 parents 0d0abad + f60c05b commit ce36332
Show file tree
Hide file tree
Showing 678 changed files with 43 additions and 147,831 deletions.
Empty file modified CMakeLists.txt
100644 → 100755
Empty file.
16 changes: 16 additions & 0 deletions SuperBuild/External-CHROMIUM-ZLIB.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(CHROMIUM_BRANCH developChromium) # Chromium zlib branch

ExternalProject_Add(zlib
GIT_REPOSITORY "${git_protocol}://github.com/rogiedodgie/zlib"
GIT_TAG "${CHROMIUM_BRANCH}"
SOURCE_DIR chromium-zlib
BINARY_DIR chromium-zlib-build
CMAKE_ARGS
-Wno-dev
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=${DEP_INSTALL_DIR}
-DBUILD_SHARED_LIBS:STRING=OFF
)

set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
set(ZLIB_ROOT ${DEP_INSTALL_DIR})
8 changes: 7 additions & 1 deletion SuperBuild/SuperBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,19 @@ else()
endif()

set(ZLIB_IMPLEMENTATION "Cloudflare" CACHE STRING "Choose zlib implementation.")
set_property(CACHE ZLIB_IMPLEMENTATION PROPERTY STRINGS "Cloudflare;System;Intel;ng;Custom")
set_property(CACHE ZLIB_IMPLEMENTATION PROPERTY STRINGS "Cloudflare;Chromium;System;Intel;ng;Custom")
if(${ZLIB_IMPLEMENTATION} STREQUAL "Cloudflare")
message("-- Build with Cloudflare zlib: ON")
include(${CMAKE_SOURCE_DIR}/SuperBuild/External-CLOUDFLARE-ZLIB.cmake)
list(APPEND DEPENDENCIES zlib)
set(BUILD_CLOUDFLARE-ZLIB TRUE)
message("-- Will build Cloudflare zlib from github")
elseif(${ZLIB_IMPLEMENTATION} STREQUAL "Chromium")
message("-- Build with Chromium zlib: ON")
include(${CMAKE_SOURCE_DIR}/SuperBuild/External-CHROMIUM-ZLIB.cmake)
list(APPEND DEPENDENCIES zlib)
set(BUILD_CHROMIUM-ZLIB TRUE)
message("-- Will build Chromium zlib from github")
elseif(${ZLIB_IMPLEMENTATION} STREQUAL "Intel")
message("-- Build with Intel zlib: ON")
include(${CMAKE_SOURCE_DIR}/SuperBuild/External-INTEL-ZLIB.cmake)
Expand Down
13 changes: 9 additions & 4 deletions src/CMakeLists.txt
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ elseif(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4819") # The file contains a character that cannot be represented in the current code page
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4996") # 'access': The POSIX name for this item is deprecated
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:8388608") # set "Stack Reserve Size" to 8MB (default value is 1MB)
include_directories(${CMAKE_SOURCE_DIR}/win/dirent)
include_directories(${CMAKE_SOURCE_DIR}/win/thread)
endif()

# Compiler dependent flags
Expand Down Expand Up @@ -74,11 +76,14 @@ set(PIGZ_SRCS

add_executable(${PROJECT_NAME} ${PIGZ_SRCS})

target_link_libraries(${PROJECT_NAME} m)

if(MSVC)
message(STATUS "Add support for MSVC pthreads here")
else()
target_link_libraries(${PROJECT_NAME} m)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} Threads::Threads)
endif()
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME} Threads::Threads)

set(ZLIB_IMPLEMENTATION "System" CACHE STRING "Choose zlib implementation.")
set_property(CACHE ZLIB_IMPLEMENTATION PROPERTY STRINGS "System;Custom")
Expand Down
17 changes: 11 additions & 6 deletions src/win/msvc.bat
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
REM zlib
git clone https://github.com/rordenlab/zlib.git
cd zlib
nmake -f win32\Makefile.msc
cd ..\thread
cd ..
REM pthreads
git clone https://github.com/indigo-astronomy/pthreads4w
cd pthreads4w
nmake clean VC-static
cd ..
rm *.obj


cl -c ../pigz.c /utf-8 /Idirent /Ithread /Izlib -DNOZOPFLI
cl -c ../yarn.c /utf-8 /Idirent /Ithread /Izlib
cl -c ../try.c /utf-8 /Idirent /Ithread /Izlib
cl /Fepigz pigz.obj yarn.obj try.obj /utf-8 /Idirent /Ithread /Izlib /link shell32.lib zlib/zlib.lib thread/libpthreadVC3.lib /NODEFAULTLIB:MSVCRT
cl -c ../pigz.c /utf-8 /Idirent /Ipthreads4w /Izlib -DNOZOPFLI
cl -c ../yarn.c /utf-8 /Idirent /Ipthreads4w /Izlib
cl -c ../try.c /utf-8 /Idirent /Ipthreads4w /Izlib
cl /Fepigz pigz.obj yarn.obj try.obj /utf-8 /Idirent /Ipthreads4w /Izlib /link shell32.lib zlib/zlib.lib pthreads4w/libpthreadVC3.lib /NODEFAULTLIB:MSVCRT
rm *.obj
REM pigz -f -k Описание.pdf 测试.obj fx.pdf
REM pigz -d -f -k Описание.pdf.gz 测试.obj.gz
19 changes: 0 additions & 19 deletions src/win/thread/.gitignore

This file was deleted.

Loading

0 comments on commit ce36332

Please sign in to comment.