File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ message(${PREFIX_MESSAGE} "Project location: " ${CMAKE_SOURCE_DIR})
3232message (${PREFIX_MESSAGE} "Project system: " ${CMAKE_SYSTEM_NAME} )
3333
3434option (SWFP_COMP "Define if the packer will enable compact process" )
35+ option (BUILD_UNPACK_LIB_SHARED "Define if Unpacker is build as a library as shared" )
36+ option (BUILD_UNPACK_LIB_STATIC "Define if Unpacker is build as a library as static" )
3537
3638## IMPORTED STATIC LIBRARY NAME
3739set ( STATIC_LIB_NAME
Original file line number Diff line number Diff line change @@ -14,6 +14,8 @@ cmake --build . --target SWEngine-[packer/unpacker]_1.1 --config [Debug/Release]
1414You can define an option by using : ` -D[option]=[value] `
1515- CMAKE_BUILD_TYPE: Debug/Release
1616- SWFP_COMP: ON/OFF
17+ - BUILD_UNPACK_LIB_SHARED: ON/OFF
18+ - BUILD_UNPACK_LIB_STATIC: ON/OFF
1719
1820## Usage
1921### Packer
Original file line number Diff line number Diff line change @@ -36,8 +36,21 @@ file(GLOB SRC ${TMP})
3636
3737## OUTPUT
3838## <=====================================>
39- ## EXECUTABLE
40- add_executable (${EXEC} ${SRC} )
39+
40+ if (NOT ${BUILD_UNPACK_LIB_SHARED} AND NOT ${BUILD_UNPACK_LIB_STATIC} )
41+ ## EXECUTABLE
42+ add_executable (${EXEC} ${SRC} )
43+ message (${PREFIX_MESSAGE} "Unpacker build as executable" )
44+ elseif (${BUILD_UNPACK_LIB_SHARED} )
45+ ## SHARED LIB
46+ add_library (${EXEC} SHARED ${SRC} )
47+ message (${PREFIX_MESSAGE} "Unpacker build as Shared library" )
48+ elseif (${BUILD_UNPACK_LIB_STATIC} )
49+ ## STATIC LIB
50+ add_library (${EXEC} STATIC ${SRC} )
51+ message (${PREFIX_MESSAGE} "Unpacker build as Static library" )
52+ endif ()
53+
4154## <=====================================>
4255
4356target_compile_definitions (${EXEC} PUBLIC "SWFP_UNPACKER" )
@@ -58,7 +71,7 @@ endif()
5871
5972## STATIC LIBRARY LINKING
6073## <=====================================>
61- if (${STATIC_LIB_NAME} )
74+ if (NOT ${STATIC_LIB_NAME} STREQUAL "" )
6275 target_link_libraries (${EXEC}
6376 PUBLIC
6477 ${STATIC_LIB_NAME}
You can’t perform that action at this time.
0 commit comments