diff --git a/CMakeLists.txt b/CMakeLists.txt index 6202e00..a11d7c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,23 @@ cmake_minimum_required(VERSION 3.5) project(zero-epwing) -include_directories(eb) -link_directories(eb/eb/.libs jansson/lib) + +include(ExternalProject) +ExternalProject_Add( + eb + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/eb + CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/eb/configure --disable-shared --disable-ebnet --disable-nls + PREFIX ${CMAKE_CURRENT_SOURCE_DIR}/eb + BUILD_COMMAND make + BUILD_IN_SOURCE 1 + ) +include_directories(eb ${CMAKE_BINARY_DIR}) +option(JANSSON_EXAMPLES "" OFF) +option(JANSSON_BUILD_DOCS "" OFF) +option(JANSSON_WITHOUT_TESTS "" ON) +add_subdirectory(jansson) +link_directories(eb/eb/.libs ${CMAKE_BINARY_DIR}/jansson/lib) add_executable(zero-epwing main.c book.c convert.c hooks.c) +add_dependencies(zero-epwing eb jansson) target_link_libraries(zero-epwing libeb.a libz.a libjansson.a) if (WIN32 OR APPLE) target_link_libraries(zero-epwing libiconv.a) diff --git a/README.md b/README.md index b299ada..a128933 100644 --- a/README.md +++ b/README.md @@ -38,13 +38,15 @@ Prepare your development environment by making sure the following tools are set Once your system is configured, follow the steps below to create builds: -1. Clone the repository by executing `git clone https://github.com/FooSoft/zero-epwing`. -2. Initialize the git submodules by executing `git submodule init`. -3. Pull down the submodule data by executing `git submodule update`. -4. Switch to the `eb` directory and execute `./configure --disable-shared --disable-ebnet --disable-nls`. -5. While still in the `eb` directory, build the modified library by executing `make`. -6. Switch to the `jansson` directory then execute `cmake .` and `make`. -7. From the project root directory, execute `cmake .` and `make`. +1. Clone the repository by executing + ``` + git clone --recurse-submodules https://github.com/FooSoft/zero-epwing + ``` +2. Prepare the project. From the project root directory, execute + ``` + cmake . -Bbuild && cmake --build build -- + ``` +3. Find the executable in the `build` directory. ## Usage ## @@ -108,4 +110,3 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . -