Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: build using CMake Ninja generator and the tests build failure with -DDISABLE_PARCHECK=yes #481

Merged
merged 1 commit into from
Dec 26, 2024
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
23 changes: 13 additions & 10 deletions cmake/boost.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
set(ROOT ${CMAKE_BINARY_DIR}/boost/)
set(BOOST_ROOT ${CMAKE_BINARY_DIR}/boost/src)
set(BOOST_LIBS ${BOOST_ROOT}/boost/stage/lib/libboost_json.a)

ExternalProject_add(
boost
PREFIX boost
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
TLS_VERIFY TRUE
TLS_VERIFY TRUE
BUILD_IN_SOURCE TRUE
GIT_SHALLOW TRUE
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
CONFIGURE_COMMAND ${ROOT}src/boost/bootstrap.sh
--with-libraries=json
--prefix=${ROOT}build
BUILD_COMMAND ${ROOT}src/boost/b2 link=static
INSTALL_COMMAND ${ROOT}src/boost/b2 install
BUILD_BYPRODUCTS ${BOOST_LIBS}
CONFIGURE_COMMAND ${BOOST_ROOT}/boost/bootstrap.sh
--with-libraries=json
--prefix=${BOOST_ROOT}/build
BUILD_COMMAND ${BOOST_ROOT}/boost/b2 link=static
INSTALL_COMMAND ""
)

set(LIBS ${LIBS} ${ROOT}build/lib/libboost_json.a)
set(INCLUDES ${INCLUDES} ${ROOT}build/include/)
set(LIBS ${LIBS} ${BOOST_LIBS})
set(INCLUDES ${INCLUDES} ${BOOST_ROOT}/boost)
31 changes: 16 additions & 15 deletions cmake/par2-turbo.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
set(PAR2_ROOT ${CMAKE_BINARY_DIR}/par2-turbo/src)
if(WIN32)
set(PAR2_LIBS
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/par2-turbo.lib
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/gf16.lib
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/hasher.lib
)
else()
set(PAR2_LIBS
${PAR2_ROOT}/par2-turbo-build/libpar2-turbo.a
${PAR2_ROOT}/par2-turbo-build/libgf16.a
${PAR2_ROOT}/par2-turbo-build/libhasher.a
)
endif()

add_compile_definitions(HAVE_CONFIG_H PARPAR_ENABLE_HASHER_MD5CRC)

Expand Down Expand Up @@ -33,22 +46,10 @@ ExternalProject_add(
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
CMAKE_ARGS ${CMAKE_ARGS}
BUILD_BYPRODUCTS ${PAR2_LIBS}
CMAKE_ARGS ${CMAKE_ARGS}
INSTALL_COMMAND ""
)

if(WIN32)
set(LIBS ${LIBS}
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/par2-turbo.lib
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/gf16.lib
${PAR2_ROOT}/par2-turbo-build/${CMAKE_BUILD_TYPE}/hasher.lib
)
else()
set(LIBS ${LIBS}
${PAR2_ROOT}/par2-turbo-build/libpar2-turbo.a
${PAR2_ROOT}/par2-turbo-build/libgf16.a
${PAR2_ROOT}/par2-turbo-build/libhasher.a
)
endif()

set(LIBS ${LIBS} ${PAR2_LIBS})
set(INCLUDES ${INCLUDES} ${PAR2_ROOT}/par2-turbo/include)
15 changes: 10 additions & 5 deletions tests/postprocess/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,11 @@ set(PostprocessTestsSrc
main.cpp
# DirectUnpackTest.cpp
# DupeMatcherTest.cpp
ParCheckerTest.cpp
ParRenamerTest.cpp
RarReaderTest.cpp
RarRenamerTest.cpp
../suite/TestUtil.cpp
# ${CMAKE_SOURCE_DIR}/daemon/postprocess/DirectUnpack.cpp
# ${CMAKE_SOURCE_DIR}/daemon/postprocess/DupeMatcher.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/ParChecker.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/ParParser.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/ParRenamer.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/RarReader.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/RarRenamer.cpp
${CMAKE_SOURCE_DIR}/daemon/main/Options.cpp
Expand All @@ -25,6 +20,16 @@ set(PostprocessTestsSrc
${CMAKE_SOURCE_DIR}/daemon/queue/DiskState.cpp
)

if(NOT DISABLE_PARCHECK)
set(PostprocessTestsSrc ${PostprocessTestsSrc}
ParCheckerTest.cpp
ParRenamerTest.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/ParChecker.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/ParParser.cpp
${CMAKE_SOURCE_DIR}/daemon/postprocess/ParRenamer.cpp
)
endif()

if(WIN32)
set(PostprocessTestsSrc ${PostprocessTestsSrc} ${CMAKE_SOURCE_DIR}/daemon/util/Utf8.cpp)
endif()
Expand Down