From 166fe96b0bbe39046a15f3e81648e8ea1b39c77c Mon Sep 17 00:00:00 2001 From: Dnomd343 Date: Sun, 24 Sep 2023 17:28:45 +0800 Subject: [PATCH] build: update cmake configure --- CMakeLists.txt | 2 +- src/core_test/CMakeLists.txt | 28 +++++++++++++++++++--------- src/core_test/cases/all_cases.cc | 7 +++++-- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index efab024..c95354d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") -get_filename_component(KLOTSKI_ROOT_PATH "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) +get_filename_component(KLOTSKI_ROOT "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE) ################################################################################ diff --git a/src/core_test/CMakeLists.txt b/src/core_test/CMakeLists.txt index 7aa340e..166b835 100644 --- a/src/core_test/CMakeLists.txt +++ b/src/core_test/CMakeLists.txt @@ -2,19 +2,29 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_CXX_STANDARD 20) -include_directories(${KLOTSKI_ROOT_PATH}/third_party/googletest/googletest/include) -add_subdirectory(${KLOTSKI_ROOT_PATH}/third_party/googletest googletest EXCLUDE_FROM_ALL) +############################################################################################### -#unset(CMAKE_ARCHIVE_OUTPUT_DIRECTORY) -include_directories(${KLOTSKI_ROOT_PATH}/third_party/md5sum) -#add_library(md5 STATIC ${KLOTSKI_ROOT_PATH}/third_party/md5/md5.cpp) -add_subdirectory(${KLOTSKI_ROOT_PATH}/third_party/md5sum md5sum EXCLUDE_FROM_ALL) +include_directories(${KLOTSKI_ROOT}/third_party/md5sum) +add_subdirectory(${KLOTSKI_ROOT}/third_party/md5sum md5sum EXCLUDE_FROM_ALL) + +include_directories(${KLOTSKI_ROOT}/third_party/googletest/googletest/include) +add_subdirectory(${KLOTSKI_ROOT}/third_party/googletest googletest EXCLUDE_FROM_ALL) set(KLOTSKI_TEST_DEPS klotski-core gtest gtest_main md5sum) -include_directories(${KLOTSKI_ROOT_PATH}/src/core/all_cases) -include_directories(${KLOTSKI_ROOT_PATH}/src/core/utils) +############################################################################################### + +include_directories(${KLOTSKI_ROOT}/src/core/utils) +include_directories(${KLOTSKI_ROOT}/src/core/all_cases) + +############################################################################################### -add_executable(test_klotski_cases cases/all_cases.cc) +set(KLOTSKI_TEST_CASES_SRC + cases/all_cases.cc +) + +add_executable(test_klotski_cases ${KLOTSKI_TEST_CASES_SRC}) target_link_libraries(test_klotski_cases PRIVATE ${KLOTSKI_TEST_DEPS}) add_test(NAME klotski_cases COMMAND test_klotski_cases) + +############################################################################################### diff --git a/src/core_test/cases/all_cases.cc b/src/core_test/cases/all_cases.cc index c231396..61be112 100644 --- a/src/core_test/cases/all_cases.cc +++ b/src/core_test/cases/all_cases.cc @@ -1,9 +1,10 @@ #include #include #include -#include "gtest/gtest.h" -#include "all_cases.h" + #include "md5sum.h" +#include "all_cases.h" +#include "gtest/gtest.h" using md5::md5sum; @@ -89,3 +90,5 @@ TEST(Cases, all_cases_data) { } EXPECT_EQ(md5sum(all_cases_str), ALL_CASES_MD5); } + +// TODO: test all_cases_parallel_build