Skip to content

Commit

Permalink
<fix>(build): fix windows compile error.
Browse files Browse the repository at this point in the history
  • Loading branch information
kyonRay committed Nov 24, 2023
1 parent ed2f1d4 commit 819ae62
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
8 changes: 7 additions & 1 deletion .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 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_WIN8 -D_WIN32_WINNT=0x0602 -DTESTS=ON -DBUILD_JNI=ON -DVCPKG_TARGET_TRIPLET='x64-windows-static' -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake
- name: compile
run: cd build && MSBuild bcos-c-sdk.sln /p:Configuration=Release /p:Platform=x64
- uses: actions/upload-artifact@v2
Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ if (NOT DEFINED URL_BASE)
endif ()

if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0601)
add_definitions(-DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN7)
add_definitions(-D_WIN32_WINNT=0x0602)
add_definitions(-DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN8)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "ON")
endif ()

Expand All @@ -46,6 +46,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 +59,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
6 changes: 6 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,12 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()

if (WIN32)
add_definitions(-D_WIN32_WINNT=0x0602)
add_definitions(-DBOOST_USE_WINAPI_VERSION=BOOST_WINAPI_VERSION_WIN8)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "ON")
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": "9e1640cf7e8f58d8026e31c82e0ab8c79fab1093",
"packages": [
"openssl",
"hsm-crypto",
Expand Down

0 comments on commit 819ae62

Please sign in to comment.