Skip to content

Commit 689edb2

Browse files
committed
Remove ENABLE_APK_LOADING=NO option
1 parent 70a6dfb commit 689edb2

File tree

3 files changed

+17
-36
lines changed

3 files changed

+17
-36
lines changed

CMakeLists.txt

+16-19
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cmake_minimum_required(VERSION 2.8.11)
22

33
project(axmldec C CXX)
4-
option(ENABLE_APK_LOADING "enable loading from an APK file" ON)
54
set(AXMLDEC_VERSION_MAJOR 1)
65
set(AXMLDEC_VERSION_MINOR 2)
76
set(AXMLDEC_VERSION_PATCH 0)
@@ -50,6 +49,7 @@ add_executable(axmldec
5049
lib/jitana/util/axml_parser.cpp
5150
)
5251

52+
# Boost.
5353
set(BOOST_MIN_VERSION "1.53.0")
5454
find_package(Boost ${BOOST_MIN_VERSION}
5555
COMPONENTS system iostreams program_options locale REQUIRED)
@@ -60,25 +60,22 @@ add_definitions(
6060
)
6161
target_link_libraries(axmldec ${Boost_LIBRARIES})
6262

63-
if(ENABLE_APK_LOADING)
64-
find_package(ZLIB REQUIRED)
65-
include_directories(${ZLIB_INCLUDE_DIR})
63+
# Zlib.
64+
find_package(ZLIB REQUIRED)
65+
include_directories(${ZLIB_INCLUDE_DIR})
6666

67-
add_definitions(
68-
-DENABLE_APK_LOADING=1
69-
)
70-
add_library(minizip STATIC
71-
${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/unzip.c
72-
${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/ioapi.c
73-
)
74-
set_target_properties(minizip PROPERTIES
75-
COMPILE_DEFINITIONS "NOUNCRYPT;NOCRYPT")
76-
target_link_libraries(minizip ${ZLIB_LIBRARIES})
77-
set(MINIZIP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external/minizip)
78-
set(MINIZIP_LIBRARIES minizip)
79-
include_directories(SYSTEM ${MINIZIP_INCLUDE_DIR})
80-
target_link_libraries(axmldec ${MINIZIP_LIBRARIES})
81-
endif()
67+
# MiniZip.
68+
add_library(minizip STATIC
69+
${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/unzip.c
70+
${CMAKE_CURRENT_SOURCE_DIR}/external/minizip/ioapi.c
71+
)
72+
set_target_properties(minizip PROPERTIES
73+
COMPILE_DEFINITIONS "NOUNCRYPT;NOCRYPT")
74+
target_link_libraries(minizip ${ZLIB_LIBRARIES})
75+
set(MINIZIP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/external/minizip)
76+
set(MINIZIP_LIBRARIES minizip)
77+
include_directories(SYSTEM ${MINIZIP_INCLUDE_DIR})
78+
target_link_libraries(axmldec ${MINIZIP_LIBRARIES})
8279

8380
#-------------------------------------------------------------------------------
8481
# Install

README.md

+1-4
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@ axmldec com.example.app.apk | xmllint --xpath 'string(/manifest/@package)' -
8484

8585
3. Compile axmldec:
8686
```sh
87-
cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_APK_LOADING=YES . && make
87+
cmake -DCMAKE_BUILD_TYPE=Release . && make
8888
```
8989

90-
You can specify `-DENABLE_APK_LOADING=NO` to disable APK loading. In this
91-
case, zlib is not required.
92-
9390
## 5 Developer
9491

9592
- [Yutaka Tsutano] at University of Nebraska-Lincoln.

main.cpp

-13
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@
2525
#include <boost/property_tree/xml_parser.hpp>
2626
#include <boost/program_options.hpp>
2727

28-
#ifdef ENABLE_APK_LOADING
2928
#include <unzip.h>
30-
#endif
3129

3230
namespace boost_pt = boost::property_tree;
3331

@@ -49,7 +47,6 @@ struct imemstream : virtual membuf, std::istream {
4947

5048
std::vector<char> extract_manifest(const std::string& input_filename)
5149
{
52-
#ifdef ENABLE_APK_LOADING
5350
auto* apk = unzOpen(input_filename.c_str());
5451
if (apk == nullptr) {
5552
throw std::runtime_error("not an APK file");
@@ -92,10 +89,6 @@ std::vector<char> extract_manifest(const std::string& input_filename)
9289
unzClose(apk);
9390

9491
return content;
95-
#else
96-
(void)input_filename;
97-
throw std::runtime_error("axmldec is compiled without APK loading support");
98-
#endif
9992
}
10093

10194
void write_xml(const std::string& output_filename, const boost_pt::ptree& pt)
@@ -173,12 +166,6 @@ int main(int argc, char** argv)
173166
std::cout << "." << AXMLDEC_VERSION_MINOR;
174167
std::cout << "." << AXMLDEC_VERSION_PATCH;
175168
std::cout << " (" << AXMLDEC_BUILD_TIMESTAMP << ")\n";
176-
std::cout << "APK loading support: ";
177-
#ifdef ENABLE_APK_LOADING
178-
std::cout << "enabled\n";
179-
#else
180-
std::cout << "disabled\n";
181-
#endif
182169
std::cout << "Copyright (C) 2017 Yutaka Tsutano.\n";
183170
return 0;
184171
}

0 commit comments

Comments
 (0)