Skip to content

Commit

Permalink
Merge pull request #1349 from piponazo/027_Winsock2
Browse files Browse the repository at this point in the history
0.27 winsock2 changes
  • Loading branch information
clanmills committed Oct 8, 2020
2 parents 632684f + 7784795 commit 203c390
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ project(exiv2 # use TWEAK to categorize the build
LANGUAGES CXX
)
include(cmake/mainSetup.cmake REQUIRED)
add_compile_options(-DEXIV2_BUILDING_EXIV2)

# options and their default values
option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON )
Expand Down
2 changes: 1 addition & 1 deletion cmake/compilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if(MSVC)

# Object Level Parallelism
add_compile_options(/MP)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
add_definitions(-DNOMINMAX) # This definition is not only needed for Exiv2 but also for xmpsdk

# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
if (MSVC_VERSION GREATER_EQUAL "1910") # VS2017 and up
Expand Down
6 changes: 0 additions & 6 deletions include/exiv2/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,6 @@ typedef int pid_t;
# endif
#endif
//////////////////////////////////////
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__)
#ifdef EXIV2_BUILDING_EXIV2
#define __USE_W32_SOCKETS
#include <winsock2.h>
#endif
#endif


// https://softwareengineering.stackexchange.com/questions/291141/how-to-handle-design-changes-for-auto-ptr-deprecation-in-c11
Expand Down
4 changes: 3 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ if (EXIV2_ENABLE_WEBREADY)
endif()

if (WIN32)
target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905)
target_compile_definitions(exiv2lib PRIVATE PSAPI_VERSION=1) # to be compatible with <= WinVista (#905)
# Since windows.h is included in some headers, we need to propagate this definition
target_compile_definitions(exiv2lib PUBLIC WIN32_LEAN_AND_MEAN)
endif()

if (NOT MSVC)
Expand Down
7 changes: 6 additions & 1 deletion src/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/

// included header files
#if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW__)
#define __USE_W32_SOCKETS
#include <winsock2.h>
#endif

#include "config.h"
#include "datasets.hpp"
#include "http.hpp"
Expand All @@ -40,6 +44,7 @@

////////////////////////////////////////
// platform specific code

#if defined(WIN32) || defined(_MSC_VER) || defined(__MINGW__)
#include <string.h>
#include <io.h>
Expand Down

0 comments on commit 203c390

Please sign in to comment.