Skip to content

Commit

Permalink
Also release the win-x86 DLL
Browse files Browse the repository at this point in the history
  • Loading branch information
vossjannik committed Dec 19, 2023
1 parent 9684a81 commit 89b8dc7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 30 deletions.
23 changes: 18 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,24 @@ jobs:
CALL bootstrap.bat
- name: 'Compress documentation for release'
if: github.ref == 'refs/heads/main'
shell: pwsh
run: |
Compress-Archive -Path dist\doc\* -DestinationPath dist\documentation.zip
- name: 'Compress .jar files for release'
if: github.ref == 'refs/heads/main'
shell: pwsh
run: |
Compress-Archive -Path dist\*.jar -DestinationPath dist\java.zip
- name: 'Compress .dll files for release'
if: github.ref == 'refs/heads/main'
- name: 'Compress win-x64 DLL file for release'
shell: pwsh
run: |
Compress-Archive -Path dist\*.dll -DestinationPath dist\win-x64.zip
Compress-Archive -Path build_x64\Release\AdsToJava-3.dll -DestinationPath dist\win-x64.zip
- name: 'Compress win-x86 DLL file for release'
shell: pwsh
run: |
Compress-Archive -Path build_win32\Release\AdsToJava-3.dll -DestinationPath dist\win-x86.zip
- name: Create release
if: github.ref == 'refs/heads/main'
Expand Down Expand Up @@ -101,3 +103,14 @@ jobs:
asset_path: ./dist/win-x64.zip
asset_name: win-x64.zip
asset_content_type: application/zip

- name: 'Upload release asset: win-x86.zip'
if: github.ref == 'refs/heads/main'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./dist/win-x86.zip
asset_name: win-x86.zip
asset_content_type: application/zip
30 changes: 15 additions & 15 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.18.0)
project(AdsToJava VERSION 3.0.0)
project(AdsToJava-3 VERSION 3.0.0)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -29,17 +29,17 @@ if(MSVC)
${CMAKE_CURRENT_SOURCE_DIR}/version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/version.rc
@ONLY)
add_library(AdsToJava SHARED ${SOURCES}
add_library(AdsToJava-3 SHARED ${SOURCES}
${CMAKE_CURRENT_BINARY_DIR}/version.rc)

if (STRICT_WARNINGS)
target_compile_options(AdsToJava PRIVATE /W4 /WX)
target_compile_options(AdsToJava-3 PRIVATE /W4 /WX)
endif()
else()
add_library(AdsToJava SHARED ${SOURCES})
add_library(AdsToJava-3 SHARED ${SOURCES})

if (STRICT_WARNINGS)
target_compile_options(AdsToJava PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_compile_options(AdsToJava-3 PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
endif()

Expand All @@ -48,17 +48,17 @@ if (NOT WIN32)
add_compile_definitions(POSIX)
endif()

target_include_directories(AdsToJava PRIVATE "$ENV{JAVA_HOME}/include/")
target_include_directories(AdsToJava-3 PRIVATE "$ENV{JAVA_HOME}/include/")
if (WIN32)
target_include_directories(AdsToJava PRIVATE "$ENV{JAVA_HOME}/include/win32/")
target_include_directories(AdsToJava-3 PRIVATE "$ENV{JAVA_HOME}/include/win32/")
elseif (EXISTS "$ENV{JAVA_HOME}/include/freebsd")
target_include_directories(AdsToJava PRIVATE "$ENV{JAVA_HOME}/include/freebsd/")
target_include_directories(AdsToJava-3 PRIVATE "$ENV{JAVA_HOME}/include/freebsd/")
else()
target_include_directories(AdsToJava PRIVATE "$ENV{JAVA_HOME}/include/unix/")
target_include_directories(AdsToJava-3 PRIVATE "$ENV{JAVA_HOME}/include/unix/")
endif()

if (EXISTS "dependencies")
target_include_directories(AdsToJava PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/AdsApi/TcAdsDll/Include/")
target_include_directories(AdsToJava-3 PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/AdsApi/TcAdsDll/Include/")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" "libTcAdsDll" HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../dependencies/AdsApi/TcAdsDll/Lib/" REQUIRED)
else()
Expand All @@ -78,9 +78,9 @@ elseif (WIN32)

if(EXISTS "${TWINCAT_INSTALL_DIR}/sdk/Include")
# preferring the sdk/Include directory because the header files from ../AdsApi/TcAdsDll/Include/ might be too old
target_include_directories(AdsToJava PRIVATE "${TWINCAT_INSTALL_DIR}/sdk/Include/")
target_include_directories(AdsToJava-3 PRIVATE "${TWINCAT_INSTALL_DIR}/sdk/Include/")
else()
target_include_directories(AdsToJava PRIVATE "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Include")
target_include_directories(AdsToJava-3 PRIVATE "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Include")
endif()

if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
Expand All @@ -89,14 +89,14 @@ elseif (WIN32)
find_library(TC_ADS_DLL_LIBRARY NAMES "TcAdsDll" HINTS "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/Lib/x64/" "${TWINCAT_INSTALL_DIR}/../AdsApi/TcAdsDll/x64/lib/" REQUIRED)
endif()
else()
target_include_directories(AdsToJava PRIVATE "/usr/local/include/")
target_include_directories(AdsToJava-3 PRIVATE "/usr/local/include/")
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
find_library(TC_ADS_DLL_LIBRARY NAMES "libTcAdsDll" HINTS "/usr/local/lib32/" REQUIRED)
else()
find_library(TC_ADS_DLL_LIBRARY NAMES "libTcAdsDll" HINTS "/usr/local/lib/" REQUIRED)
endif()
endif()
target_link_libraries(AdsToJava "${TC_ADS_DLL_LIBRARY}")
target_link_libraries(AdsToJava-3 "${TC_ADS_DLL_LIBRARY}")

if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
get_filename_component(SDK_DIR "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" REALPATH)
Expand All @@ -113,7 +113,7 @@ if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")

list(GET EXISTING_KIT_VER_BIND_DIRS 0 LATEST_EXISTING_KIT_VER_BIND_DIR)
find_library(VERSION_LIBRARY NAMES "Version" HINTS "${LATEST_EXISTING_KIT_VER_BIND_DIR}" REQUIRED)
target_link_libraries(AdsToJava "${VERSION_LIBRARY}")
target_link_libraries(AdsToJava-3 "${VERSION_LIBRARY}")
endif()

set(CPACK_PROJECT_NAME ${PROJECT_NAME})
Expand Down
3 changes: 0 additions & 3 deletions run/copy_to_dist.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@ IF EXIST build_x64 (
)
)
)
IF EXIST dist\AdsToJava.dll (
move dist\AdsToJava.dll dist\AdsToJava-3.dll || exit /b %errorlevel%
)
7 changes: 0 additions & 7 deletions run/copy_to_dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,3 @@ elif [ -d "./build" ]; then
cp ./build/Release/*.dll ./dist/
fi
fi

if [ -f "./dist/AdsToJava.dll" ]; then
mv ./dist/AdsToJava.dll ./dist/AdsToJava-3.dll
fi
if [ -f "./dist/libAdsToJava.so" ]; then
mv ./dist/libAdsToJava.so ./dist/libAdsToJava-3.so
fi

0 comments on commit 89b8dc7

Please sign in to comment.