set up CMakeLists.txt

This commit is contained in:
2024-04-15 03:38:32 +00:00
parent bfec8b0842
commit 05735a7ae3
7 changed files with 28 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/.vscode /.vscode
/.devcontainer /.devcontainer
/.github /.github
/.cache
/build /build
/.clang-format /.clang-format

View File

@ -4,11 +4,23 @@ include(CTest)
set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -fsanitize=address -fsanitize=undefined -fsanitize=leak") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -fsanitize=address -fsanitize=undefined -fsanitize=leak")
option(TEST_BPT_ONLY "Only build BPT tests" ON)
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
googletest googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.zip URL_HASH SHA256=1f357c27ca988c3f7c6b4bf68a9395005ac6761f034046e9dde0896e3aba00e4
URL ${CMAKE_SOURCE_DIR}/deps/googletest-v1.14.0-mirror.zip
) )
FetchContent_MakeAvailable(googletest) FetchContent_MakeAvailable(googletest)
include(GoogleTest) include(GoogleTest)
enable_testing() FetchContent_Declare(
argparse
URL_HASH SHA256=674e724c2702f0bfef1619161815257a407e1babce30d908327729fba6ce4124
URL ${CMAKE_SOURCE_DIR}/deps/argparse-v3.0-mirror.zip
)
FetchContent_MakeAvailable(argparse)
include_directories(${CMAKE_SOURCE_DIR}/include)
include_directories(${CMAKE_SOURCE_DIR}/bpt/include)
include_directories(${CMAKE_SOURCE_DIR}/stlite)
enable_testing()
add_subdirectory(test)

BIN
deps/argparse-v3.0-mirror.zip vendored Normal file

Binary file not shown.

BIN
deps/googletest-v1.14.0-mirror.zip vendored Normal file

Binary file not shown.

0
src/main.cpp Normal file
View File

8
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
if(TEST_BPT_ONLY)
add_executable(code oj_test_interface_for_bpt.cpp)
target_link_libraries(code argparse)
set_target_properties(code PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
else()
add_executable(oj_test_interface_for_bpt oj_test_interface_for_bpt.cpp)
target_link_libraries(oj_test_interface_for_bpt argparse)
endif()

View File

@ -0,0 +1,5 @@
#include <argparse/argparse.hpp>
int main()
{
return 0;
}