mirror of
https://github.com/fedapo/vb6-parser.git
synced 2025-12-17 08:44:34 +03:00
First commit
This commit is contained in:
116
CMakeLists.txt
Normal file
116
CMakeLists.txt
Normal file
@@ -0,0 +1,116 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
project(vb6_parser)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# see https://google.github.io/googletest/quickstart-cmake.html
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip
|
||||
)
|
||||
# for Windows: prevent overriding the parent project's compiler/linker settings
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
FetchContent_MakeAvailable(googletest)
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
add_compile_options($<$<CXX_COMPILER_ID:GNU,Clang>:-Wall> $<$<CXX_COMPILER_ID:GNU,Clang>:-Wextra>)
|
||||
|
||||
enable_testing()
|
||||
|
||||
#find_package(GTest CONFIG REQUIRED) # GoogleTest with vcpkg
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Boost REQUIRED QUIET COMPONENTS system)
|
||||
|
||||
add_library(vb6_parser_lib
|
||||
src/raw_ast_printer.cpp
|
||||
src/raw_ast_printer.hpp
|
||||
src/color_console.cpp
|
||||
src/color_console.hpp
|
||||
src/cpp_ast_printer.cpp
|
||||
src/cpp_ast_printer.hpp
|
||||
src/vb6_ast.hpp
|
||||
src/vb6_ast_adapt.hpp
|
||||
src/vb6_config.hpp
|
||||
src/vb6_error_handler.hpp
|
||||
src/vb6_parser.cpp
|
||||
src/vb6_parser.hpp
|
||||
src/vb6_parser_def.hpp
|
||||
src/vb6_parser_functions.cpp
|
||||
src/vb6_parser_helper.cpp
|
||||
src/vb6_parser_keywords.hpp
|
||||
src/vb6_parser_operators.hpp
|
||||
src/vb6_parser_statements.cpp
|
||||
src/vb6_parser_statements_def.hpp
|
||||
src/vb6_ast_printer.cpp
|
||||
src/vb6_ast_printer.hpp
|
||||
src/visual_basic_x3.hpp
|
||||
)
|
||||
|
||||
target_compile_definitions(vb6_parser_lib
|
||||
PRIVATE
|
||||
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
-DBOOST_MPL_LIMIT_LIST_SIZE=30
|
||||
)
|
||||
|
||||
add_executable(vb6_parser
|
||||
src/vb6_parser_main.cpp
|
||||
src/vb6_test1.cpp
|
||||
src/vb6_test2.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(vb6_parser
|
||||
PRIVATE
|
||||
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
-DBOOST_MPL_LIMIT_LIST_SIZE=30
|
||||
)
|
||||
|
||||
target_link_libraries(vb6_parser
|
||||
PRIVATE
|
||||
vb6_parser_lib
|
||||
Boost::system
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
# ---- test
|
||||
|
||||
add_executable(vb6_parser_test
|
||||
src/test_gosub.cpp
|
||||
src/test_grammar_helper.hpp
|
||||
src/vb6_parser_statements_test.cpp
|
||||
src/vb6_parser_test.cpp
|
||||
src/vb6_parser_test_main.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(vb6_parser_test
|
||||
PRIVATE
|
||||
-DBOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
|
||||
-DBOOST_MPL_LIMIT_LIST_SIZE=30
|
||||
)
|
||||
|
||||
target_link_libraries(vb6_parser_test
|
||||
PRIVATE
|
||||
vb6_parser_lib
|
||||
gtest_main
|
||||
Boost::system
|
||||
Threads::Threads
|
||||
)
|
||||
#[[
|
||||
# GoogleTest with vcpkg, probably not a good idea
|
||||
target_link_libraries(vb6_parser_test
|
||||
PRIVATE
|
||||
vb6_parser_lib
|
||||
GTest::gtest
|
||||
GTest::gtest_main
|
||||
GTest::gmock
|
||||
GTest::gmock_main
|
||||
Boost::system
|
||||
Threads::Threads
|
||||
)
|
||||
#]]
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(vb6_parser_test)
|
||||
#add_test(AllTestsInMain vb6_parser_test)
|
||||
Reference in New Issue
Block a user