Fixed agent compilation on Windows. Minor redesign for build images on Windows
This commit is contained in:
parent
47909f5fba
commit
1d350b9d5a
148
Dockerfiles/build-base/windows/CMakeLists.txt
Normal file
148
Dockerfiles/build-base/windows/CMakeLists.txt
Normal file
@ -0,0 +1,148 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(libmodbus_win C)
|
||||
|
||||
option(MODBUS_ENABLE_RTU "Build RTU backend (modbus-rtu.c)" ON)
|
||||
option(MODBUS_ENABLE_TCP "Build TCP backend (modbus-tcp.c)" ON)
|
||||
option(MODBUS_FIX_MSVC_SOCKOPT_WARNINGS "Fix MSVC winsock C4133 warnings" ON)
|
||||
|
||||
set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
|
||||
# --- 1) Prepare shim include dir (build-only includes live here) ---
|
||||
set(SHIM_INC_DIR "${CMAKE_CURRENT_BINARY_DIR}/include")
|
||||
file(MAKE_DIRECTORY "${SHIM_INC_DIR}")
|
||||
|
||||
# We expect config.h to exist in ${SRC_DIR}/config.h (you generate it via src/win32/configure.js)
|
||||
if(NOT EXISTS "${SRC_DIR}/win32/config.h")
|
||||
message(FATAL_ERROR
|
||||
"config.h not found at ${SRC_DIR}/win32/config.h. "
|
||||
"Run src/win32/configure.js and copy config.h into src/ before configuring with CMake.")
|
||||
endif()
|
||||
|
||||
# --- 2) Generate shim modbus.h (static-friendly MODBUS_API) ---
|
||||
file(READ "${SRC_DIR}/modbus.h" MODBUS_H_TXT)
|
||||
|
||||
set(MODBUS_API_BLOCK
|
||||
"#if defined(_MSC_VER)
|
||||
# if defined(DLLBUILD)
|
||||
/* define DLLBUILD when building the DLL */
|
||||
# define MODBUS_API __declspec(dllexport)
|
||||
# else
|
||||
# define MODBUS_API __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define MODBUS_API
|
||||
#endif")
|
||||
|
||||
set(MODBUS_API_BLOCK_REPL
|
||||
"#if defined(_MSC_VER)
|
||||
/* Static library: do NOT use dllimport/dllexport in public headers */
|
||||
# if defined(DLLBUILD)
|
||||
# define MODBUS_API __declspec(dllexport)
|
||||
# else
|
||||
# define MODBUS_API
|
||||
# endif
|
||||
#else
|
||||
# define MODBUS_API
|
||||
#endif")
|
||||
|
||||
string(REPLACE "${MODBUS_API_BLOCK}" "${MODBUS_API_BLOCK_REPL}" MODBUS_H_TXT "${MODBUS_H_TXT}")
|
||||
file(WRITE "${SHIM_INC_DIR}/modbus.h" "${MODBUS_H_TXT}")
|
||||
|
||||
# Copy remaining headers needed to compile (build-only set includes private/config)
|
||||
file(COPY "${SRC_DIR}/modbus-tcp.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
file(COPY "${SRC_DIR}/modbus-rtu.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
file(COPY "${SRC_DIR}/modbus-version.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
|
||||
# Build-only headers required by .c files
|
||||
file(COPY "${SRC_DIR}/win32/config.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
file(COPY "${SRC_DIR}/modbus-private.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
file(COPY "${SRC_DIR}/modbus-tcp-private.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
file(COPY "${SRC_DIR}/modbus-rtu-private.h" DESTINATION "${SHIM_INC_DIR}")
|
||||
|
||||
# --- 3) Generate shim sources (do not modify upstream sources on disk) ---
|
||||
set(SHIM_SRC_DIR "${CMAKE_CURRENT_BINARY_DIR}/shim_src")
|
||||
file(MAKE_DIRECTORY "${SHIM_SRC_DIR}")
|
||||
|
||||
function(make_shim_source in_file out_file)
|
||||
file(READ "${in_file}" TXT)
|
||||
|
||||
# Force includes via include paths (so our shim headers win)
|
||||
string(REPLACE "#include \"modbus.h\"" "#include <modbus.h>" TXT "${TXT}")
|
||||
string(REPLACE "#include \"modbus-tcp.h\"" "#include <modbus-tcp.h>" TXT "${TXT}")
|
||||
string(REPLACE "#include \"modbus-rtu.h\"" "#include <modbus-rtu.h>" TXT "${TXT}")
|
||||
string(REPLACE "#include \"modbus-version.h\"" "#include <modbus-version.h>" TXT "${TXT}")
|
||||
|
||||
# Some files include private/config with quotes; route those too
|
||||
string(REPLACE "#include \"config.h\"" "#include <config.h>" TXT "${TXT}")
|
||||
string(REPLACE "#include \"modbus-private.h\"" "#include <modbus-private.h>" TXT "${TXT}")
|
||||
string(REPLACE "#include \"modbus-tcp-private.h\"" "#include <modbus-tcp-private.h>" TXT "${TXT}")
|
||||
string(REPLACE "#include \"modbus-rtu-private.h\"" "#include <modbus-rtu-private.h>" TXT "${TXT}")
|
||||
|
||||
# Optional: silence MSVC winsock setsockopt warnings (C4133)
|
||||
# On Windows setsockopt expects const char* optval; libmodbus passes &int.
|
||||
if (MSVC AND MODBUS_FIX_MSVC_SOCKOPT_WARNINGS)
|
||||
string(REPLACE ", &option, sizeof(int))" ", (const char*)&option, sizeof(int))" TXT "${TXT}")
|
||||
endif()
|
||||
|
||||
file(WRITE "${out_file}" "${TXT}")
|
||||
endfunction()
|
||||
|
||||
# Base sources
|
||||
make_shim_source("${SRC_DIR}/modbus.c" "${SHIM_SRC_DIR}/modbus.c")
|
||||
make_shim_source("${SRC_DIR}/modbus-data.c" "${SHIM_SRC_DIR}/modbus-data.c")
|
||||
|
||||
set(MODBUS_SOURCES
|
||||
"${SHIM_SRC_DIR}/modbus.c"
|
||||
"${SHIM_SRC_DIR}/modbus-data.c"
|
||||
)
|
||||
|
||||
if(MODBUS_ENABLE_TCP)
|
||||
make_shim_source("${SRC_DIR}/modbus-tcp.c" "${SHIM_SRC_DIR}/modbus-tcp.c")
|
||||
list(APPEND MODBUS_SOURCES "${SHIM_SRC_DIR}/modbus-tcp.c")
|
||||
endif()
|
||||
|
||||
if(MODBUS_ENABLE_RTU)
|
||||
make_shim_source("${SRC_DIR}/modbus-rtu.c" "${SHIM_SRC_DIR}/modbus-rtu.c")
|
||||
list(APPEND MODBUS_SOURCES "${SHIM_SRC_DIR}/modbus-rtu.c")
|
||||
endif()
|
||||
|
||||
add_library(modbus STATIC ${MODBUS_SOURCES})
|
||||
|
||||
# --- MSVC: silence WinSock signature warning (setsockopt wants const char*) ---
|
||||
if (MSVC)
|
||||
target_compile_options(modbus PRIVATE /wd4133)
|
||||
endif()
|
||||
|
||||
# Use shim headers for build + consumers (PUBLIC), but we will INSTALL only public headers explicitly
|
||||
target_include_directories(modbus
|
||||
PUBLIC
|
||||
"${SHIM_INC_DIR}"
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(modbus PUBLIC ws2_32)
|
||||
endif()
|
||||
|
||||
# --- Install: only public headers (no config.h, no *-private.h) ---
|
||||
include(GNUInstallDirs)
|
||||
|
||||
install(TARGETS modbus
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
|
||||
set(PUBLIC_HEADERS
|
||||
"${SHIM_INC_DIR}/modbus.h"
|
||||
"${SHIM_INC_DIR}/modbus-version.h"
|
||||
)
|
||||
|
||||
if(MODBUS_ENABLE_TCP)
|
||||
list(APPEND PUBLIC_HEADERS "${SHIM_INC_DIR}/modbus-tcp.h")
|
||||
endif()
|
||||
|
||||
if(MODBUS_ENABLE_RTU)
|
||||
list(APPEND PUBLIC_HEADERS "${SHIM_INC_DIR}/modbus-rtu.h")
|
||||
endif()
|
||||
|
||||
install(FILES ${PUBLIC_HEADERS}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
|
||||
)
|
||||
@ -11,7 +11,7 @@ ARG PCRE2_VERSION=10.47
|
||||
ARG OPENSSL_VERSION=3.0.18
|
||||
ARG LIBMODBUS_VERSION=3.1.11
|
||||
ARG ZLIB_VERSION=1.3.1
|
||||
ARG CURL_VERSION=8.16.0
|
||||
ARG CURL_VERSION=8.17.0
|
||||
|
||||
ARG BUILD_ARCH=x64
|
||||
|
||||
@ -51,7 +51,7 @@ ADD --checksum=sha256:d74c183c86c77248ad50017c7f45bae8f88106a6cca5d87ad09917e1c6
|
||||
ADD --checksum=sha256:d80c34f5cf902dccf1f1b5df5ebb86d0392e37049e5d73df1b3abae72e4ffe8b $OPENSSL_URL build_src\openssl.tar.gz
|
||||
ADD --checksum=sha256:15b4b2e0f68122c2da9b195de5c330489a9c97d40b4a95d2822378dc14d780e7 $LIBMODBUS_URL build_src\libmodbus.tar.gz
|
||||
ADD --checksum=sha256:9A93B2B7DFDAC77CEBA5A558A580E74667DD6FEDE4585B91EEFB60F03B72DF23 $ZLIB_URL build_src\zlib.tar.gz
|
||||
ADD --checksum=sha256:a21e20476e39eca5a4fc5cfb00acf84bbc1f5d8443ec3853ad14c26b3c85b970 $CURL_URL build_src\curl.tar.gz
|
||||
ADD --checksum=sha256:e8e74cdeefe5fb78b3ae6e90cd542babf788fa9480029cfcee6fd9ced42b7910 $CURL_URL build_src\curl.tar.gz
|
||||
|
||||
ADD --checksum=sha256:b40d192ae95ba6ccc4cc362ff4e1b18ca6fb5055bebbcd3920684e12701fa8f6 $PWSH_URL build_deps\pwsh.zip
|
||||
ADD --checksum=sha256:f42a561840627747ad48e6ece05a14093292d31f3393a401a7f7c780ee7695c2 $GIT_URL build_deps\git.zip
|
||||
@ -59,11 +59,13 @@ ADD --checksum=sha256:a1cde185656cf307b51670eed69f648b9eff15b5c518cb136e027c628e
|
||||
ADD --checksum=sha256:e0ba5157007abc7b1a65118a96657a961ddf55f7e3f632ee035366dfce039ca4 $NASM_URL build_deps\nasm.zip
|
||||
ADD $VS_BUILDTOOLS_URL build_deps\vs_buildtools.exe
|
||||
|
||||
COPY modbus.vs16.* build_src\libmodbus_project\
|
||||
COPY CMakeLists.txt build_src\libmodbus_project\
|
||||
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); `
|
||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
`
|
||||
$env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); `
|
||||
[Environment]::SetEnvironmentVariable('BUILD_SRC', $env:BUILD_SRC, [EnvironmentVariableTarget]::Machine); `
|
||||
$env:BUILD_DEPS = [string]::Format('{0}\build_deps', $env:SystemDrive); `
|
||||
[Environment]::SetEnvironmentVariable('BUILD_DEPS', $env:BUILD_DEPS, [EnvironmentVariableTarget]::Machine); `
|
||||
@ -83,7 +85,7 @@ RUN $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); `
|
||||
Expand-Archive `
|
||||
-Path $env:BUILD_DEPS\nasm.zip `
|
||||
-DestinationPath $env:BUILD_DEPS\.; `
|
||||
Rename-Item -Path $env:BUILD_DEPS\nasm-$env:NASM_VERSION -NewName $env:BUILD_DEPS\nasm; `
|
||||
Rename-Item -Path $env:BUILD_DEPS\nasm-$env:NASM_VERSION -NewName $env:BUILD_DEPS\NASM; `
|
||||
`
|
||||
Write-Host 'Installing GIT...'; `
|
||||
Expand-Archive `
|
||||
@ -108,7 +110,7 @@ RUN $env:BUILD_SRC = [string]::Format('{0}\build_src', $env:SystemDrive); `
|
||||
Write-Host 'Extracting Libmodbus archive ...'; `
|
||||
tar -zxf $env:BUILD_SRC\libmodbus.tar.gz; `
|
||||
Move-Item -Path $env:BUILD_SRC\libmodbus-$env:LIBMODBUS_VERSION\ -Destination $env:BUILD_SRC\libmodbus; `
|
||||
Move-Item -Path $env:BUILD_SRC\libmodbus_project\* -Destination $env:BUILD_SRC\libmodbus\src\win32; `
|
||||
Copy-Item $env:BUILD_SRC\libmodbus_project\CMakeLists.txt -Destination $env:BUILD_SRC\libmodbus\CMakeLists.txt; `
|
||||
Remove-Item -Force -Recurse $env:BUILD_SRC\libmodbus_project\; `
|
||||
`
|
||||
Write-Host 'Extracting Zlib archive ...'; `
|
||||
@ -144,11 +146,8 @@ ARG ZBX_VERSION
|
||||
|
||||
ENV ZBX_VERSION=$ZBX_VERSION `
|
||||
BUILD_ARCH=$BUILD_ARCH `
|
||||
GIT_URL=$GIT_URL PERL_URL=$PERL_URL NASM_URL=$NASM_URL `
|
||||
VS_BUILDTOOLS_URL=$VS_BUILDTOOLS_URL VS_BUILDTOOLS_VERSION=$VS_BUILDTOOLS_VERSION `
|
||||
PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION LIBMODBUS_VERSION=$LIBMODBUS_VERSION `
|
||||
PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL LIBMODBUS_URL=$LIBMODBUS_URL `
|
||||
ZLIB_URL=$ZLIB_URL CURL_URL=$CURL_URL
|
||||
PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION LIBMODBUS_VERSION=$LIBMODBUS_VERSION
|
||||
|
||||
LABEL org.opencontainers.image.title="Zabbix agent build base for Windows" `
|
||||
org.opencontainers.image.authors="Alexey Pustovalov <alexey.pustovalov@zabbix.com>" `
|
||||
@ -165,7 +164,6 @@ COPY --from=src build_deps build_deps
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
||||
`
|
||||
$env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); `
|
||||
[Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); `
|
||||
@ -214,106 +212,124 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; `
|
||||
`
|
||||
Write-Host 'Build environment is ready...'; `
|
||||
Set-Location -Path $env:SystemDrive\.; `
|
||||
`
|
||||
Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
Set-Location -Path $env:SystemDrive\.;
|
||||
|
||||
RUN Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
Enter-VsDevShell -VsInstallPath $env:VS_PATH -SkipAutomaticLocation -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
`
|
||||
Write-Host 'Building Zlib library...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\zlib; `
|
||||
(Get-Content .\win32\Makefile.msc).replace('-MD', '-MT') | Set-Content .\win32\Makefile.msc; `
|
||||
set CL=/MP; `
|
||||
nmake /S -f .\win32\Makefile.msc; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\zlib | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\zlib\include | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\zlib\lib | Out-Null; `
|
||||
Copy-Item $env:BUILD_SRC\zlib\*.h -Destination $env:BUILD_OUTPUT\zlib\include; `
|
||||
Copy-Item $env:BUILD_SRC\zlib\zlib.lib -Destination $env:BUILD_OUTPUT\zlib\lib; `
|
||||
Copy-Item $env:BUILD_SRC\zlib\zlib.pdb -Destination $env:BUILD_OUTPUT\zlib\lib; `
|
||||
nmake /S -f .\win32\Makefile.msc clean | Out-Null; `
|
||||
Write-Host 'Zlib is ready...'; `
|
||||
Set-Location -Path $env:SystemDrive\.; `
|
||||
$env:CL = """$env:CL /MP"""; `
|
||||
cmake -S $env:BUILD_SRC\zlib -B $env:BUILD_SRC\zlib\build `
|
||||
-G """Visual Studio 17 2022""" `
|
||||
-A $env:BUILD_ARCH `
|
||||
-DBUILD_SHARED_LIBS=OFF `
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY="""MultiThreaded$<$<CONFIG:Debug>:Debug>""" `
|
||||
-DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\zlib"""; `
|
||||
cmake --build $env:BUILD_SRC\zlib\build --config Release --parallel; `
|
||||
cmake --install $env:BUILD_SRC\zlib\build --config Release; `
|
||||
Remove-Item -Path $env:BUILD_SRC\zlib\build -Force -Recurse; `
|
||||
Write-Host 'Zlib is ready...';
|
||||
|
||||
RUN Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
Enter-VsDevShell -VsInstallPath $env:VS_PATH -SkipAutomaticLocation -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
`
|
||||
Write-Host 'Building OpenSSL library...'; `
|
||||
Write-Host 'Building OpenSSL library...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\openssl; `
|
||||
$env:CL = """$env:CL /nologo /MP /MT /wd4267 /wd4244"""; `
|
||||
$env:NMAKEFLAGS = """/nologo"""; `
|
||||
perl $env:BUILD_SRC\openssl\Configure `
|
||||
VC-WIN64A `
|
||||
no-shared `
|
||||
no-ui-console `
|
||||
no-tests `
|
||||
no-unit-test `
|
||||
no-capieng `
|
||||
no-docs `
|
||||
no-dgram `
|
||||
no-dtls1-method `
|
||||
no-dtls1_2-method `
|
||||
no-gost `
|
||||
no-shared `
|
||||
no-srp `
|
||||
no-tests `
|
||||
no-ui-console `
|
||||
no-winstore `
|
||||
--api=1.1.0 `
|
||||
--prefix=$env:BUILD_OUTPUT\openssl `
|
||||
--openssldir=$env:BUILD_OUTPUT\openssl_ssl; `
|
||||
set CL=/MP; `
|
||||
nmake /S build_sw; `
|
||||
nmake /S install_dev; `
|
||||
nmake /S build_libs; `
|
||||
nmake /S INSTALLDOCS=0 INSTALLHTML=0 install_dev; `
|
||||
nmake /S clean | Out-Null; `
|
||||
Write-Host 'OpenSSL is ready...'; `
|
||||
Write-Host 'OpenSSL is ready...';
|
||||
|
||||
RUN Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
Enter-VsDevShell -VsInstallPath $env:VS_PATH -SkipAutomaticLocation -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
`
|
||||
Write-Host 'Building PCRE2 library ...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\pcre2\build; `
|
||||
cmake --log-level=ERROR `
|
||||
-G 'Visual Studio 17 2022' `
|
||||
Write-Host 'Building PCRE2 library ...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\pcre2; `
|
||||
$env:CL = """$env:CL /MP"""; `
|
||||
cmake -S $env:BUILD_SRC\pcre2 -B $env:BUILD_SRC\pcre2\build `
|
||||
-G """"Visual Studio 17 2022""" `
|
||||
-A $env:BUILD_ARCH `
|
||||
-DBUILD_SHARED_LIBS=OFF `
|
||||
-DPCRE2_BUILD_TESTS=OFF `
|
||||
-DCMAKE_C_FLAGS_RELEASE:string="""/MT""" ..; `
|
||||
msbuild PCRE2.sln `
|
||||
-maxcpucount:"""$env:NUMBER_OF_PROCESSORS""" `
|
||||
/verbosity:quiet `
|
||||
/property:Configuration=Release `
|
||||
/property:Platform=$env:BUILD_ARCH `
|
||||
/target:pcre2-8-static; `
|
||||
-DPCRE2_BUILD_PCRE2GREP=OFF `
|
||||
-DPCRE2_SUPPORT_JIT=OFF `
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY="""MultiThreaded$<$<CONFIG:Debug>:Debug>""" `
|
||||
-DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\pcre2"""; `
|
||||
`
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\pcre2 | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\pcre2\include | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\pcre2\lib | Out-Null; `
|
||||
Copy-Item $env:BUILD_SRC\pcre2\build\*.h -Destination $env:BUILD_OUTPUT\pcre2\include; `
|
||||
Copy-Item $env:BUILD_SRC\pcre2\build\Release\* -Destination $env:BUILD_OUTPUT\pcre2\lib; `
|
||||
Remove-Item -Path $env:BUILD_SRC\pcre2\build\* -Force -Recurse; `
|
||||
Write-Host 'PCRE2 is ready...'; `
|
||||
cmake --build $env:BUILD_SRC\pcre2\build --config Release --parallel; `
|
||||
cmake --install $env:BUILD_SRC\pcre2\build --config Release; `
|
||||
`
|
||||
Write-Host 'Building Libmodbus library...'; `
|
||||
Remove-Item -Recurse -Force -Path $env:BUILD_OUTPUT\pcre2\share -ErrorAction SilentlyContinue; `
|
||||
Remove-Item -Recurse -Force $env:BUILD_SRC\pcre2\build; `
|
||||
Write-Host 'PCRE2 is ready...';
|
||||
|
||||
RUN Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
Enter-VsDevShell -VsInstallPath $env:VS_PATH -SkipAutomaticLocation -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
`
|
||||
Set-Location -Path $env:BUILD_SRC\libmodbus\src\win32; `
|
||||
cscript .\configure.js; `
|
||||
msbuild modbus.vs16.sln `
|
||||
-maxcpucount:"""$env:NUMBER_OF_PROCESSORS""" `
|
||||
/verbosity:quiet `
|
||||
/property:Configuration=Release `
|
||||
/property:Platform=$env:BUILD_ARCH; `
|
||||
Write-Host 'Building Libmodbus library ...'; `
|
||||
$env:CL = """$env:CL /MP"""; `
|
||||
Set-Location -Path $env:BUILD_SRC\libmodbus\src\win32; `
|
||||
cscript //nologo .\configure.js; `
|
||||
Set-Location -Path $env:BUILD_SRC\libmodbus; `
|
||||
cmake -S $env:BUILD_SRC\libmodbus -B $env:BUILD_SRC\libmodbus\build `
|
||||
-G """"Visual Studio 17 2022""" `
|
||||
-A $env:BUILD_ARCH `
|
||||
-DBUILD_SHARED_LIBS=OFF `
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY="""MultiThreaded$<$<CONFIG:Debug>:Debug>""" `
|
||||
-DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\libmodbus"""; `
|
||||
`
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\libmodbus | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\libmodbus\include | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:BUILD_OUTPUT\libmodbus\lib | Out-Null; `
|
||||
Copy-Item $env:BUILD_SRC\libmodbus\src\*.h -Destination $env:BUILD_OUTPUT\libmodbus\include; `
|
||||
Copy-Item $env:BUILD_SRC\libmodbus\src\win32\$env:BUILD_ARCH\Release\*.lib -Destination $env:BUILD_OUTPUT\libmodbus\lib; `
|
||||
Copy-Item $env:BUILD_SRC\libmodbus\src\win32\$env:BUILD_ARCH\Release\*.pdb -Destination $env:BUILD_OUTPUT\libmodbus\lib; `
|
||||
Remove-Item -Path $env:BUILD_SRC\libmodbus\src\win32\$env:BUILD_ARCH -Force -Recurse; `
|
||||
Write-Host 'Libmodbus is ready...'; `
|
||||
`
|
||||
Write-Host 'Building Curl library...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\curl\winbuild; `
|
||||
(Get-Content MakefileBuild.vc).replace(' wldap32.lib', '') | Set-Content MakefileBuild.vc; `
|
||||
set CL=/MP; `
|
||||
nmake /S -f Makefile.vc `
|
||||
mode=static `
|
||||
VC=$env:VS_BUILDTOOLS_VERSION `
|
||||
DEBUG=no `
|
||||
CC="""cl.exe /DCURL_DISABLE_LDAP /DCURL_DISABLE_LDAPS""" `
|
||||
MACHINE=$env:BUILD_ARCH `
|
||||
USE_IPV6=yes `
|
||||
ENABLE_UNICODE=yes `
|
||||
USE_IDN=no `
|
||||
GEN_PDB=no `
|
||||
WITH_SSL=static `
|
||||
SSL_PATH=$env:BUILD_OUTPUT\openssl `
|
||||
WITH_ZLIB=static `
|
||||
ZLIB_PATH=$env:BUILD_OUTPUT\zlib `
|
||||
WINBUILD_ACKNOWLEDGE_DEPRECATED=yes `
|
||||
RTLIBCFG=static; `
|
||||
`
|
||||
Move-Item -Path $env:BUILD_SRC\curl\builds\libcurl-vc$env:VS_BUILDTOOLS_VERSION-$env:BUILD_ARCH-release-static-ssl-static-zlib-static-sspi\ -Destination $env:BUILD_OUTPUT\curl; `
|
||||
Remove-Item -Path $env:BUILD_SRC\curl\builds\* -Force -Recurse; `
|
||||
Write-Host 'Curl is ready...';
|
||||
cmake --build $env:BUILD_SRC\libmodbus\build --config Release --parallel; `
|
||||
cmake --install $env:BUILD_SRC\libmodbus\build --config Release; `
|
||||
Remove-Item -Recurse -Force $env:BUILD_SRC\libmodbus\build; `
|
||||
Write-Host 'Libmodbus is ready...';
|
||||
|
||||
RUN Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
Enter-VsDevShell -VsInstallPath $env:VS_PATH -SkipAutomaticLocation -DevCmdArguments """-arch=$env:BUILD_ARCH"""; `
|
||||
Write-Host 'Building Curl library...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\curl; `
|
||||
$env:CL = """$env:CL /MP"""; `
|
||||
cmake -S $env:BUILD_SRC\curl -B $env:BUILD_SRC\curl\build `
|
||||
-G """Visual Studio 17 2022""" `
|
||||
-A $env:BUILD_ARCH `
|
||||
-DCMAKE_MSVC_RUNTIME_LIBRARY="""MultiThreaded$<$<CONFIG:Debug>:Debug>""" `
|
||||
-DBUILD_CURL_EXE=OFF `
|
||||
-DBUILD_EXAMPLES=OFF `
|
||||
-DBUILD_LIBCURL_DOCS=OFF `
|
||||
-DBUILD_SHARED_LIBS=OFF `
|
||||
-DBUILD_STATIC_LIBS=ON `
|
||||
-DCURL_DISABLE_LDAP=ON `
|
||||
-DCURL_DISABLE_LDAPS=ON `
|
||||
-DCURL_STATIC_CRT=ON `
|
||||
-DCURL_USE_LIBPSL=OFF `
|
||||
-DCURL_USE_OPENSSL=ON `
|
||||
-DCURL_ZLIB=ON `
|
||||
-DENABLE_UNICODE=ON `
|
||||
-DOPENSSL_ROOT_DIR="""$env:BUILD_OUTPUT\openssl""" `
|
||||
-DOPENSSL_USE_STATIC_LIBS=ON `
|
||||
-DUSE_WIN32_IDN=OFF `
|
||||
-DZLIB_INCLUDE_DIR="""$env:BUILD_OUTPUT\zlib\include""" `
|
||||
-DZLIB_LIBRARY="""$env:BUILD_OUTPUT\zlib\lib\zlibstatic.lib""" `
|
||||
-DZLIB_USE_STATIC_LIBS=ON `
|
||||
-DCMAKE_INSTALL_PREFIX="""$env:BUILD_OUTPUT\curl"""; `
|
||||
cmake --build $env:BUILD_SRC\curl\build --config Release --parallel; `
|
||||
cmake --install $env:BUILD_SRC\curl\build --config Release; `
|
||||
Remove-Item -Path $env:BUILD_SRC\curl\build\ -Force -Recurse;
|
||||
|
||||
@ -120,9 +120,8 @@ ARG ZBX_VERSION
|
||||
|
||||
ENV ZBX_VERSION=$ZBX_VERSION `
|
||||
BUILD_ARCH=$BUILD_ARCH `
|
||||
MINGW_URL=$MINGW_URL VS_BUILDTOOLS_URL=$VS_BUILDTOOLS_URL VS_BUILDTOOLS_VERSION=$VS_BUILDTOOLS_VERSION GOLANG_VERSION=$GOLANG_VERSION MSYS2_URL=$MSYS2_URL `
|
||||
VS_BUILDTOOLS_VERSION=$VS_BUILDTOOLS_VERSION GOLANG_VERSION=$GOLANG_VERSION `
|
||||
PCRE2_VERSION=$PCRE2_VERSION OPENSSL_VERSION=$OPENSSL_VERSION `
|
||||
PCRE2_URL=$PCRE2_URL OPENSSL_URL=$OPENSSL_URL `
|
||||
CHERE_INVOKING=yes MSYSTEM=$MSYSTEM
|
||||
|
||||
LABEL org.opencontainers.image.title="Zabbix agent 2 build base for Windows" `
|
||||
@ -140,7 +139,6 @@ COPY --from=src build_deps build_deps
|
||||
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
|
||||
|
||||
RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; `
|
||||
`
|
||||
$env:BUILD_OUTPUT = [string]::Format('{0}\build_output', $env:SystemDrive); `
|
||||
[Environment]::SetEnvironmentVariable('BUILD_OUTPUT', $env:BUILD_OUTPUT, [EnvironmentVariableTarget]::Machine); `
|
||||
@ -187,16 +185,18 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
Write-Host 'Visual Studio components installation cleanup'; `
|
||||
Get-ChildItem -Path """${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer""" -Directory -Recurse | Remove-Item -Force -Recurse; `
|
||||
`
|
||||
Write-Host 'Build environment is ready...'; `
|
||||
`
|
||||
Write-Host 'Building PCRE2 library ...'; `
|
||||
Write-Host 'Build environment is ready...';
|
||||
|
||||
RUN Write-Host 'Building PCRE2 library ...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\pcre2; `
|
||||
cmake --log-level=ERROR `
|
||||
cmake -S $env:BUILD_SRC\pcre2 -B $env:BUILD_SRC\pcre2\build `
|
||||
-G 'MinGW Makefiles' `
|
||||
-DBUILD_SHARED_LIBS=OFF `
|
||||
-DBUILD_STATIC_LIBS=ON `
|
||||
-DPCRE2_DEBUG=OFF `
|
||||
-DPCRE2_BUILD_TESTS=OFF `
|
||||
-DPCRE2_BUILD_PCRE2GREP=OFF `
|
||||
-DPCRE2_SUPPORT_JIT=OFF `
|
||||
-DINSTALL_MSVC_PDB=OFF `
|
||||
-DCMAKE_C_COMPILER=gcc `
|
||||
-DCMAKE_C_FLAGS='-O2 -g' `
|
||||
@ -204,23 +204,30 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS"""; `
|
||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install; `
|
||||
mingw32-make -s clean | Out-Null; `
|
||||
Remove-Item -Path $env:BUILD_OUTPUT\pcre2\share -Force -Recurse; `
|
||||
Write-Host 'PCRE2 is ready...'; `
|
||||
`
|
||||
Write-Host 'Building OpenSSL library...'; `
|
||||
Remove-Item -Recurse -Force -Path $env:BUILD_OUTPUT\pcre2\share -ErrorAction SilentlyContinue; `
|
||||
Write-Host 'PCRE2 is ready...';
|
||||
|
||||
RUN Write-Host 'Building OpenSSL library...'; `
|
||||
Set-Location -Path $env:BUILD_SRC\openssl; `
|
||||
perl Configure `
|
||||
mingw64 `
|
||||
no-shared `
|
||||
no-ui-console `
|
||||
no-tests `
|
||||
no-unit-test `
|
||||
no-capieng `
|
||||
no-docs `
|
||||
no-dgram `
|
||||
no-dtls1-method `
|
||||
no-dtls1_2-method `
|
||||
no-gost `
|
||||
no-shared `
|
||||
no-srp `
|
||||
no-tests `
|
||||
no-ui-console `
|
||||
no-winstore `
|
||||
thread_scheme=winthreads `
|
||||
--api=1.1.0 `
|
||||
--libdir=lib `
|
||||
--prefix=$env:BUILD_OUTPUT/openssl `
|
||||
--openssldir=$env:BUILD_OUTPUT/openssl_ssl; `
|
||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" build_sw; `
|
||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" build_libs; `
|
||||
mingw32-make -s -j"""$env:NUMBER_OF_PROCESSORS""" install_dev; `
|
||||
mingw32-make -s clean | Out-Null; `
|
||||
Write-Host 'OpenSSL is ready...'; `
|
||||
|
||||
@ -1,31 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.29613.14
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "modbus", "modbus.vs16.vcxproj", "{498E0845-C7F4-438B-8EDE-EF7FC9A74430}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x64.Build.0 = Debug|x64
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Debug|x86.Build.0 = Debug|Win32
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x64.ActiveCfg = Release|x64
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x64.Build.0 = Release|x64
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x86.ActiveCfg = Release|Win32
|
||||
{498E0845-C7F4-438B-8EDE-EF7FC9A74430}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {6CF51673-664F-4C9F-B3FE-991FF423F3B6}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@ -1,265 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>modbus</ProjectName>
|
||||
<ProjectGuid>{498E0845-C7F4-438B-8EDE-EF7FC9A74430}</ProjectGuid>
|
||||
<RootNamespace>modbus</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>16.0.29511.113</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<EnableManagedIncrementalBuild>False</EnableManagedIncrementalBuild>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<EnableManagedIncrementalBuild>False</EnableManagedIncrementalBuild>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<GenerateManifest>true</GenerateManifest>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>$(Platform)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command />
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Message />
|
||||
<Command />
|
||||
</CustomBuildStep>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>W32DEBUG;HAVE_CONFIG_H;DLLBUILD;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NONSTDC_NO_DEPRECATE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling />
|
||||
<BasicRuntimeChecks>UninitializedLocalUsageCheck</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_MSC_VER;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ResourceOutputFileName>$(SolutionDir)/modbus.res</ResourceOutputFileName>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<Version>
|
||||
</Version>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateMapFile>true</GenerateMapFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress />
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PreBuildEvent>
|
||||
<Command />
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Message />
|
||||
<Command />
|
||||
</CustomBuildStep>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>HAVE_CONFIG_H;DLLBUILD;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NONSTDC_NO_DEPRECATE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling />
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>1048576</StackReserveSize>
|
||||
<StackCommitSize>524288</StackCommitSize>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<LinkTimeCodeGeneration />
|
||||
<EntryPointSymbol />
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention />
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command />
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Message />
|
||||
<Command />
|
||||
</CustomBuildStep>
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..</AdditionalIncludeDirectories>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>W32DEBUG;_WINDLL;HAVE_CONFIG_H;DLLBUILD;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NONSTDC_NO_DEPRECATE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>1048576</StackReserveSize>
|
||||
<StackCommitSize>524288</StackCommitSize>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PreBuildEvent>
|
||||
<Command />
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Message />
|
||||
<Command />
|
||||
</CustomBuildStep>
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>.;..</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>CompileAsC</CompileAs>
|
||||
<DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions>_WINDLL;HAVE_CONFIG_H;DLLBUILD;_CRT_SECURE_NO_DEPRECATE=1;_CRT_NONSTDC_NO_DEPRECATE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<StackReserveSize>1048576</StackReserveSize>
|
||||
<StackCommitSize>524288</StackCommitSize>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<LinkTimeCodeGeneration />
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\modbus-data.c" />
|
||||
<ClCompile Include="..\modbus-rtu.c" />
|
||||
<ClCompile Include="..\modbus-tcp.c" />
|
||||
<ClCompile Include="..\modbus.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\modbus-private.h" />
|
||||
<ClInclude Include="..\modbus-rtu-private.h" />
|
||||
<ClInclude Include="..\modbus-rtu.h" />
|
||||
<ClInclude Include="..\modbus-tcp-private.h" />
|
||||
<ClInclude Include="..\modbus-tcp.h" />
|
||||
<ClInclude Include="..\modbus.h" />
|
||||
<ClInclude Include="config.h" />
|
||||
<ClInclude Include="modbus-version.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="modbus.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@ -1,62 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\modbus-data.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\modbus-rtu.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\modbus-tcp.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\modbus.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\modbus-private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\modbus-rtu-private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\modbus-rtu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\modbus-tcp-private.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\modbus-tcp.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="modbus-version.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\modbus.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="modbus.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -34,7 +34,7 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
New-Item -ItemType directory -Path $env:SystemDrive\zabbix_src | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\sbin | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIRt\bin | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\bin | Out-Null; `
|
||||
New-Item -ItemType directory -Path $env:ZBX_OUTPUT_DIR\conf | Out-Null; `
|
||||
`
|
||||
Import-Module (Get-ChildItem $env:VS_PATH -Recurse -File -Filter Microsoft.VisualStudio.DevShell.dll).FullName; `
|
||||
@ -48,7 +48,7 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
$ZbxRevision=(git rev-parse --short HEAD); `
|
||||
(Get-Content include/version.h).replace('{ZABBIX_REVISION}', $ZbxRevision) | Set-Content include/version.h; `
|
||||
Set-Location -Path $env:ZBX_SOURCES_DIR\build\win32\project; `
|
||||
set CL=/MP; `
|
||||
$env:CL = """$env:CL /MP /MT"""; `
|
||||
nmake /S -f Makefile `
|
||||
CPU=$env:CPU_MODEL `
|
||||
CFLAGS="""/D CURL_STATICLIB /D HAVE_LIBCURL /I "$env:BUILD_OUTPUT\curl\include" /D ZABBIX_VERSION_REVISION=$ZbxRevision /D HAVE_LIBMODBUS_STATIC /D DEFAULT_CONFIG_FILE=$env:SystemDrive\zabbix\conf\zabbix_agentd.conf""" `
|
||||
@ -59,7 +59,7 @@ RUN Set-Location -Path $env:SystemDrive\.; `
|
||||
TLSLIBDIR=$env:BUILD_OUTPUT\openssl\lib `
|
||||
MODBINCDIR=$env:BUILD_OUTPUT\libmodbus\include `
|
||||
MODBLIBDIR=$env:BUILD_OUTPUT\libmodbus\lib `
|
||||
LIBS="""$env:LIBS Crypt32.lib $env:BUILD_OUTPUT\curl\lib\libcurl_a.lib $env:BUILD_OUTPUT\zlib\lib\zlib.lib""" `
|
||||
LIBS="""$env:LIBS Crypt32.lib $env:BUILD_OUTPUT\curl\lib\libcurl.lib $env:BUILD_OUTPUT\zlib\lib\zlibstatic.lib""" `
|
||||
all; `
|
||||
`
|
||||
Write-Host 'Verifying build ("zabbix_agentd.exe -V") ...'; `
|
||||
|
||||
Loading…
Reference in New Issue
Block a user