Skip to content
53 changes: 8 additions & 45 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ project(core)

set(CORE_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}")

add_custom_target(tests)
get_property(all_tests GLOBAL PROPERTY TEST_TARGETS)

include(${CORE_ROOT_DIR}/common.cmake)

# platform-specific compile flags
if(EMSCRIPTEN)

add_subdirectory( "${CORE_ROOT_DIR}/OfficeUtils/js" zlib )
Expand All @@ -15,6 +17,7 @@ if(EMSCRIPTEN)
add_subdirectory( "${CORE_ROOT_DIR}/Common/3dParty/hunspell" spell )
add_subdirectory( "${CORE_ROOT_DIR}/DesktopEditor/fontengine/js" fonts )
add_subdirectory( "${CORE_ROOT_DIR}/DesktopEditor/graphics/pro/js/" drawingfile )

else()

add_compile_options(-march=native)
Expand All @@ -26,50 +29,10 @@ else()
add_subdirectory( "${CORE_ROOT_DIR}/DesktopEditor/doctrenderer/app_builder" docbuilder )
add_subdirectory( "${CORE_ROOT_DIR}/PdfFile/Resources/CMapMemory" cmapbin )

#[[
set( ALL_ARTIFACTS
UnicodeConverter
kernel
kernel_network
Fb2File
PdfFile
HtmlFile2
EpubFile
XpsFile
OFDFile
DjVuFile
DocxRenderer
doctrenderer
IWorkFile
HWPFile
graphics
x2tlib
allfontsgen
allthemesgen
pluginsmanager
docbuilder
x2t
)

add_custom_target(copy_artifacts ALL
COMMENT "Copying all artifacts into ${EO_CORE_OUTPUT_DIR}"
)

add_dependencies(copy_artifacts ${ALL_ARTIFACTS})

foreach(artifact ${ALL_ARTIFACTS})
add_custom_command(TARGET copy_artifacts POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${EO_CORE_OUTPUT_DIR}"
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${artifact}> "${EO_CORE_OUTPUT_DIR}/"
COMMENT "Copying ${artifact} to ${EO_CORE_OUTPUT_DIR}"
)
endforeach()
add_subdirectory( "${CORE_ROOT_DIR}/Common/3dParty/openssl/test" )

add_custom_command(TARGET copy_artifacts POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "${EO_CORE_OUTPUT_DIR}"
COMMAND /bin/sh -c "cp -P \"${EO_CORE_3RD_PARTY_INSTALL_DIR}/icu/lib\"/*.so* \"${EO_CORE_OUTPUT_DIR}/\""
COMMENT "Copying ICU libs to ${EO_CORE_OUTPUT_DIR}"
)
]]
if(all_tests)
add_dependencies(tests ${all_tests})
endif()

endif()
9 changes: 3 additions & 6 deletions Common/3dParty/brotli/nc-fetch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

install_dir="$1"
git_tag="v1.2.0"

abort_op()
{
Expand All @@ -25,11 +26,7 @@ fi

echo "Fetching Brotli"

mkdir -p "$install_dir" || abort_op "Failed to create brotli directory."
cd "$install_dir"
git init || abort_op "Git init failed (brotli)"
git remote add origin https://github.com/google/brotli.git || abort_op "Failed to add brotli remote"
git fetch --depth 1 origin a47d7475063eb223c87632eed806c0070e70da29 || abort_op "Failed to fetch a47d7475063eb223c87632eed806c0070e70da29"
git checkout FETCH_HEAD || abort_op "Check-out failed (brotli)"
git clone --depth=1 --branch $git_tag https://github.com/google/brotli.git "$install_dir" \
|| abort_op "Failed to clone brotli repo"

echo "Brotli ready!"
57 changes: 57 additions & 0 deletions Common/3dParty/cryptopp/nc-fetch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

work_dir="$1"
install_dir="$2"
keep_work=${3:-""}

package_name="CryptoPP"
repo_url="https://github.com/weidai11/cryptopp"
git_tag="CRYPTOPP_8_9_0"

abort_op()
{
rm -rf "$work_dir"
rm -rf "$install_dir"
echo "$package_name aborted: $1" >&2
exit 1
}

if [ $# -lt 2 ]
then
echo "Needs 2 arguments: work_dir_path install_dir_path" >&2
exit 1
fi

if [ -d $install_dir ]
then
echo "Skipping $package_name (done already)."
exit 0
else
mkdir -p "$install_dir" || abort_op "Failed to create install dir: [$install_dir]"
fi

if [ -d "$work_dir" ]
then
rm -rf $work_dir
fi
mkdir -p "$work_dir" || abort_op "Failed to create work dir: [$work_dir]"

echo "Fetching $package_name"
git clone --depth=1 --branch $git_tag $repo_url "$work_dir" \
|| abort_op "Failed to clone $package_name repo"

echo "Building $package_name"
cd "$work_dir"
make -j10 || abort_op "Build failed!"

echo "Installing $package_name to [$install_dir]"
make install-lib PREFIX="$install_dir" || abort_op "Install failed!"

echo "$package_name ready!"
if [ "$keep_work" != "keep-work-dir" ]
then
echo "(work dir will be removed)"
rm -rf "$work_dir"
fi

exit 0
Loading