Skip to content

Commit

Permalink
<fix>(build): fix windows8 link boost log error.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay committed Nov 27, 2023
1 parent ed2f1d4 commit 6f6e526
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ jobs:
run: export CFLAGS="${CFLAGS} -fPIC";export CXXFLAGS="${CXXFLAGS} -fPIC"; cd build && make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: print link.txt
run: cat build/CMakeFiles/bcos-c-sdk*.dir/link.txt
- uses: actions/upload-artifact@v2
with:
name: libbcos-c-sdk.dylib.zip
Expand Down Expand Up @@ -97,6 +99,8 @@ jobs:
run: cd build && make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: print link.txt
run: cat build/CMakeFiles/bcos-c-sdk*.dir/link.txt
- name: run coverage
run: cd build && make cov
- name: upload coverage report
Expand All @@ -107,7 +111,7 @@ jobs:
version: "v0.1.15"
flags: unittests
name: c sdk coverage
fail_ci_if_error: true
fail_ci_if_error: false
verbose: true
build_with_centos:
name: build_with_centos
Expand Down Expand Up @@ -165,6 +169,8 @@ jobs:
make -j4
- name: run test
run: cd build && CTEST_OUTPUT_ON_FAILURE=TRUE make test
- name: print link.txt
run: cat build/CMakeFiles/bcos-c-sdk*.dir/link.txt
- uses: actions/upload-artifact@v2
with:
name: libbcos-c-sdk.so.zip
Expand Down Expand Up @@ -202,7 +208,7 @@ jobs:
if: runner.os == 'Windows'
run: |
mkdir -p build && cd build
cmake -G "Visual Studio 16 2019" -A x64 ../ -DCMAKE_BUILD_TYPE=Release -DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN7 -D_WIN32_WINNT=0x0601 -DTESTS=ON -DBUILD_JNI=ON -DVCPKG_TARGET_TRIPLET='x64-windows-static' -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
cmake -G "Visual Studio 16 2019" -A x64 ../ -DCMAKE_BUILD_TYPE=Release -DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN7 -D_WIN32_WINNT=0x0601 -DTESTS=ON -DBUILD_JNI=ON -DVCPKG_TARGET_TRIPLET='x64-windows-static' -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake || cat C:\vcpkg\buildtrees\fisco-bcos-cpp-sdk\build-x64-windows-static-dbg-out.log
- name: compile
run: cd build && MSBuild bcos-c-sdk.sln /p:Configuration=Release /p:Platform=x64
- uses: actions/upload-artifact@v2
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if (NOT DEFINED URL_BASE)
endif ()

if (WIN32)
set(VCPKG_C_FLAGS -D_WIN32_WINNT=0x0601 -DWINVER=0x0601)
set(VCPKG_CXX_FLAGS -D_WIN32_WINNT=0x0601 -DWINVER=0x0601)
add_definitions(-D_WIN32_WINNT=0x0601)
add_definitions(-DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN7)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "ON")
Expand All @@ -46,6 +48,7 @@ if ("${ARCHITECTURE}" MATCHES "aarch64")
set(ARCH_NATIVE ON)
endif ()

set(VCPKG_BUILD_TYPE "Release")
if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive -- vcpkg WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Expand All @@ -58,7 +61,7 @@ project(bcos-c-sdk VERSION "3.6.0")

# Debug, Release, RelWithDebInfo, MinSizeRel
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_BUILD_TYPE MinSizeRel)
endif ()

# basic settings
Expand Down
8 changes: 8 additions & 0 deletions bindings/java/jni/src/main/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0601)
add_definitions(-DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN7)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "ON")
set(VCPKG_C_FLAGS -D_WIN32_WINNT=0x0601 -DWINVER=0x0601)
set(VCPKG_CXX_FLAGS -D_WIN32_WINNT=0x0601 -DWINVER=0x0601)
endif ()

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")

Expand Down
2 changes: 1 addition & 1 deletion vcpkg-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"kind": "git",
"repository": "https://github.com/kyonRay/registry",
"baseline": "8d37c1d05935bc5d5796c6e73da7b15d19da2e3f",
"baseline": "554008a297da920eb658d562a525340220cbc5bb",
"packages": [
"openssl",
"hsm-crypto",
Expand Down

0 comments on commit 6f6e526

Please sign in to comment.