Now coding tests compile and pass.

This commit is contained in:
Timofey 2016-09-12 17:45:15 +03:00
parent 7ae88a7e7a
commit 22427594e5
8 changed files with 114 additions and 75 deletions

View file

@ -0,0 +1,23 @@
cmake_minimum_required(VERSION 3.2)
project(minizip C CXX)
add_compile_options(
"-Wall"
"-pedantic"
)
add_definitions(-DUSE_FILE32ZPI -DNOCRYPT)
set(
SRC
ioapi.c
ioapi.h
unzip.c
unzip.h
zip.c
zip.h
)
add_library(minizip ${SRC})
set_target_properties(minizip PROPERTIES ENABLE_EXPORTS ON)

View file

@ -1,68 +1,43 @@
cmake_minimum_required(VERSION 2.6)
project(SUCCINCT)
cmake_minimum_required(VERSION 3.2)
configure_file(
${SUCCINCT_SOURCE_DIR}/succinct_config.hpp.in
${SUCCINCT_SOURCE_DIR}/succinct_config.hpp)
project(succinct C CXX)
option(SUCCINCT_USE_LIBCXX
"Use libc++ with Clang instead of libstdc++ (must be same as that used to compile Boost)"
OFF)
option(SUCCINCT_USE_INTRINSICS
"Use a set of intrinsics available on all x86-64 architectures"
ON)
option(SUCCINCT_USE_POPCNT
"Use popcount intrinsic. Available on x86-64 since SSE4.2."
OFF)
add_compile_options(
"-Wall"
"-pedantic"
"-std=c++11"
)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if (SUCCINCT_USE_LIBCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif ()
endif ()
add_definitions(-DLTC_NO_ROLC)
if (SUCCINCT_USE_POPCNT)
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2")
endif ()
# XXX(ot): what to do for MSVC?
endif ()
include_directories(src/headers)
set(
SRC
bit_vector.hpp
bp_vector.cpp
bp_vector.hpp
broadword.hpp
cartesian_tree.hpp
darray.hpp
darray64.hpp
elias_fano_compressed_list.hpp
elias_fano_list.hpp
elias_fano.hpp
forward_enumerator.hpp
gamma_bit_vector.hpp
gamma_vector.hpp
intrinsics.hpp
mappable_vector.hpp
mapper.hpp
nibble_vector.hpp
rs_bit_vector.cpp
rs_bit_vector.hpp
tables.hpp
topk_vector.hpp
util.hpp
vbyte.hpp
)
# XXX(ot): enable this on all compilers
if (UNIX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-missing-braces")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion")
endif ()
find_package(Boost 1.42.0 COMPONENTS
unit_test_framework iostreams system filesystem REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
link_directories (${Boost_LIBRARY_DIRS})
include_directories(${PROJECT_SOURCE_DIR})
set(SUCCINCT_SOURCES
rs_bit_vector.cpp
bp_vector.cpp
)
add_library(succinct STATIC ${SUCCINCT_SOURCES})
add_subdirectory(perftest)
# make and run tests only if library is compiled stand-alone
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
enable_testing()
file(GLOB SUCCINCT_TEST_SOURCES test_*.cpp)
foreach(TEST_SRC ${SUCCINCT_TEST_SOURCES})
get_filename_component (TEST_SRC_NAME ${TEST_SRC} NAME_WE)
add_executable(${TEST_SRC_NAME} ${TEST_SRC})
target_link_libraries(${TEST_SRC_NAME}
succinct
${Boost_LIBRARIES}
)
add_test(${TEST_SRC_NAME} ${TEST_SRC_NAME})
endforeach(TEST_SRC)
endif ()
add_library(succinct ${SRC})
set_target_properties(succinct PROPERTIES ENABLE_EXPORTS ON)

View file

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.2)
project(tomcrypt C CXX)
add_compile_options(
"-Wall"
"-pedantic"
)
add_definitions(-DLTC_NO_ROLC)
include_directories(src/headers)
set(
SRC
src/hashes/sha2/sha256.c
src/headers/tomcrypt.h
src/headers/tomcrypt_misc.h
src/misc/base64/base64_decode.c
src/misc/base64/base64_encode.c
src/misc/crypt/crypt_argchk.c
)
add_library(tomcrypt ${SRC})
set_target_properties(tomcrypt PROPERTIES ENABLE_EXPORTS ON)

View file

@ -2,13 +2,21 @@ cmake_minimum_required(VERSION 3.2)
project(omim C CXX)
add_subdirectory(3party/minizip)
add_subdirectory(3party/succinct)
add_subdirectory(3party/tomcrypt)
add_compile_options(
"-Wall"
"-pedantic"
"-std=c++11"
)
find_package(Threads)
find_library(LIBZ NAMES z)
if(LIBZ STREQUAL "LIBZ-NOTFOUND")
message(FATAL_ERROR "Failed to find libz library.")
endif()
get_filename_component(PROJECT_SOURCE_DIR . ABSOLUTE)
@ -29,20 +37,24 @@ if ("${NO_TESTS}" STREQUAL "")
set(NO_TESTS FALSE)
endif()
function(omim_add_library library)
add_library(${library} ${ARGN})
endfunction()
function(omim_add_executable executable)
add_executable(${executable} ${ARGN})
endfunction()
function(omim_add_test executable)
if (NOT ${NO_TESTS})
omim_add_executable(${executable} ${PROJECT_SOURCE_DIR}/testing/testingmain.cpp ${ARGN})
endif()
endfunction()
function(omim_link_libraries target)
if (TARGET ${target})
target_link_libraries(${target} ${ARGN} ${CMAKE_THREAD_LIBS_INIT})
@ -54,6 +66,6 @@ endfunction()
add_subdirectory(base)
add_subdirectory(coding)
add_subdirectory(editor)
add_subdirectory(geometry)
add_subdirectory(storage)
#add_subdirectory(editor)
#add_subdirectory(geometry)
#add_subdirectory(storage)

View file

@ -14,9 +14,9 @@ set(
collection_cast.hpp
condition.cpp
condition.hpp
condition_bada.cpp
# condition_bada.cpp
condition_posix.cpp
condition_windows_native.cpp
# condition_windows_native.cpp
const_helper.hpp
deferred_task.cpp
deferred_task.hpp

View file

@ -1,4 +1,4 @@
include_directories(${PROJECT_SOURCE_DIR}/3party/tomcrypt/src/headers)
include_directories(${PROJECT_SOURCE_DIR}/3party/tomcrypt/src/headers ${PROJECT_SOURCE_DIR}/coding)
set(
SRC
@ -31,6 +31,10 @@ set(
hex.hpp
huffman.cpp
huffman.hpp
internal/file64_api.hpp
internal/file_data.cpp
internal/file_data.hpp
internal/xmlparser.hpp
matrix_traversal.hpp
memory_region.hpp
mmap_reader.cpp
@ -78,4 +82,4 @@ set(
omim_add_library(coding ${SRC})
#add_subdirectory(coding_tests)
add_subdirectory(coding_tests)

View file

@ -1,4 +1,4 @@
#add_definitions(-DOMIM_UNIT_TEST_DISABLE_PLATFORM_INIT)
add_definitions(-DOMIM_UNIT_TEST_DISABLE_PLATFORM_INIT)
set(
SRC
@ -40,8 +40,8 @@ set(
writer_test.cpp
zip_creator_test.cpp
zip_reader_test.cpp
${PROJECT_SOURCE_DIR}/testing/testingmain.cpp
)
omim_add_test(coding_tests ${SRC})
omim_link_libraries(coding_test coding)
omim_link_libraries(coding_tests coding base minizip tomcrypt succinct ${LIBZ})

View file

@ -1,5 +1,3 @@
#add_subdirectory(storage_tests)
include_directories(${PROJECT_SOURCE_DIR}/3party/jansson/src)
set(
@ -34,3 +32,5 @@ set(
)
omim_add_library(storage ${SRC})
#add_subdirectory(storage_tests)