Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 47 additions & 2 deletions .github/workflows/Test_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ on:

env:
BUILD_TYPE: Release
VERSION_NAME: 1.1

jobs:
Test_windows:
Build_exec:
runs-on: windows-latest
steps:
- name: Checkout repository
Expand All @@ -34,4 +35,48 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: SWPacker
path: ${{github.workspace}}\out\1.1\Release\
path: ${{github.workspace}}\out\${{env.VERSION_NAME}}\Release\

Build_Unpack_Shared:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Config executables
run: |
mkdir build && cd build
cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_UNPACK_LIB_SHARED=ON ..

- name: Build executables
run: |
cd ${{github.workspace}}\build
cmake --build ${{github.workspace}}\build --target SWEngine-unpacker_${{env.VERSION_NAME}} --config ${{env.BUILD_TYPE}}

- name: Archive Library
uses: actions/upload-artifact@v3
with:
name: SWPacker
path: ${{github.workspace}}\out\${{env.VERSION_NAME}}\Release\

Build_Unpack_Static:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Config executables
run: |
mkdir build && cd build
cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_UNPACK_LIB_STATIC=ON ..

- name: Build executables
run: |
cd ${{github.workspace}}\build
cmake --build ${{github.workspace}}\build --target SWEngine-unpacker_${{env.VERSION_NAME}} --config ${{env.BUILD_TYPE}}

- name: Archive library
uses: actions/upload-artifact@v3
with:
name: SWPacker
path: ${{github.workspace}}\out\${{env.VERSION_NAME}}\Release\
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ message(${PREFIX_MESSAGE} "Project location: " ${CMAKE_SOURCE_DIR})
message(${PREFIX_MESSAGE} "Project system: " ${CMAKE_SYSTEM_NAME})

option(SWFP_COMP "Define if the packer will enable compact process" )
option(BUILD_UNPACK_LIB_SHARED "Define if Unpacker is build as a library as shared" )
option(BUILD_UNPACK_LIB_STATIC "Define if Unpacker is build as a library as static" )

## IMPORTED STATIC LIBRARY NAME
set( STATIC_LIB_NAME
Expand All @@ -45,7 +47,6 @@ list(LENGTH STATIC_LIB_NAME list_len)
math(EXPR LIST_LEN "${list_len} - 1")

if (${LIST_LEN} GREATER_EQUAL 0)

foreach(ctr RANGE ${LIST_LEN})
list(GET STATIC_LIB_NAME ${ctr} lib)
list(GET STATIC_LIB ${ctr} filelib)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ cmake --build . --target SWEngine-[packer/unpacker]_1.1 --config [Debug/Release]
You can define an option by using : `-D[option]=[value]`
- CMAKE_BUILD_TYPE: Debug/Release
- SWFP_COMP: ON/OFF
- BUILD_UNPACK_LIB_SHARED: ON/OFF
- BUILD_UNPACK_LIB_STATIC: ON/OFF

## Usage
### Packer
Expand Down
10 changes: 0 additions & 10 deletions cmake/Packer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,6 @@ if(MSVC)
endif()
## <=====================================>

## IMPORTED STATIC LIBRARY NAME
set( STATIC_LIB_NAME
zstd_static
)

## IMPORTED STATIC LIBRARY .lib file
set( STATIC_LIB
${CMAKE_SOURCE_DIR}/libraries/zstd_static.lib
)

## STATIC LIBRARY LINKING
## <=====================================>
if (${STATIC_LIB_NAME})
Expand Down
19 changes: 16 additions & 3 deletions cmake/UnPacker.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,21 @@ file(GLOB SRC ${TMP})

## OUTPUT
## <=====================================>
## EXECUTABLE
add_executable(${EXEC} ${SRC})

if (NOT ${BUILD_UNPACK_LIB_SHARED} AND NOT ${BUILD_UNPACK_LIB_STATIC})
## EXECUTABLE
add_executable(${EXEC} ${SRC})
message(${PREFIX_MESSAGE} "Unpacker build as executable")
elseif (${BUILD_UNPACK_LIB_SHARED})
## SHARED LIB
add_library(${EXEC} SHARED ${SRC})
message(${PREFIX_MESSAGE} "Unpacker build as Shared library")
elseif (${BUILD_UNPACK_LIB_STATIC})
## STATIC LIB
add_library(${EXEC} STATIC ${SRC})
message(${PREFIX_MESSAGE} "Unpacker build as Static library")
endif ()

## <=====================================>

target_compile_definitions(${EXEC} PUBLIC "SWFP_UNPACKER")
Expand All @@ -58,7 +71,7 @@ endif()

## STATIC LIBRARY LINKING
## <=====================================>
if (${STATIC_LIB_NAME})
if (NOT ${STATIC_LIB_NAME} STREQUAL "")
target_link_libraries(${EXEC}
PUBLIC
${STATIC_LIB_NAME}
Expand Down