Add tool infrastructure
This commit is contained in:
parent
a8e2676f36
commit
d66d6d26af
6 changed files with 51 additions and 2 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -4,3 +4,6 @@
|
|||
[submodule "external/tiny-process-library"]
|
||||
path = external/tiny-process-library
|
||||
url = https://github.com/eidheim/tiny-process-library
|
||||
[submodule "external/cxxopts"]
|
||||
path = external/cxxopts
|
||||
url = https://github.com/jarro2783/cxxopts
|
||||
|
|
|
|||
|
|
@ -15,11 +15,28 @@ option(CPPAST_ENABLE_ASSERTIONS "whether or not to enable internal assertions fo
|
|||
option(CPPAST_ENABLE_PRECONDITION_CHECKS "whether or not to enable precondition checks" ON)
|
||||
|
||||
option(CPPAST_BUILD_TEST "whether or not to build the tests" ON)
|
||||
option(CPPAST_BUILD_TOOL "whether or not to build the tool" ON)
|
||||
option(BUILD_TESTING "build test" OFF) # The ctest variable for building tests
|
||||
|
||||
if(${CPPAST_BUILD_TEST} OR ${BUILD_TESTING} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
set(build_test ON)
|
||||
else()
|
||||
set(build_test OFF)
|
||||
endif()
|
||||
|
||||
if(${CPPAST_BUILD_TOOL} OR (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR))
|
||||
set(build_tool ON)
|
||||
else()
|
||||
set(build_tool OFF)
|
||||
endif()
|
||||
|
||||
include(external/external.cmake)
|
||||
|
||||
add_subdirectory(src)
|
||||
if(CPPAST_BUILD_TEST)
|
||||
|
||||
if(${build_test})
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
||||
if(${build_tool})
|
||||
add_subdirectory(tool)
|
||||
endif()
|
||||
|
|
|
|||
1
external/cxxopts
vendored
Submodule
1
external/cxxopts
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 1be5f10daf6f08296eff399e82aa94d16800ef4e
|
||||
11
external/external.cmake
vendored
11
external/external.cmake
vendored
|
|
@ -38,6 +38,17 @@ target_include_directories(_cppast_tiny_process PUBLIC ${tiny_process_dir})
|
|||
target_link_libraries(_cppast_tiny_process PUBLIC Threads::Threads)
|
||||
set_target_properties(_cppast_tiny_process PROPERTIES CXX_STANDARD 11)
|
||||
|
||||
#
|
||||
# install cxxopts, if needed
|
||||
#
|
||||
if(build_tool)
|
||||
message(STATUS "Installing cxxopts via submodule")
|
||||
execute_process(COMMAND git submodule update --init -- external/cxxopts
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/external/cxxopts EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
#
|
||||
# install libclang
|
||||
#
|
||||
|
|
|
|||
8
tool/CMakeLists.txt
Normal file
8
tool/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Copyright (C) 2017 Jonathan Müller <jonathanmueller.dev@gmail.com>
|
||||
# This file is subject to the license terms in the LICENSE file
|
||||
# found in the top-level directory of this distribution.
|
||||
|
||||
add_executable(cppast_tool main.cpp)
|
||||
target_link_libraries(cppast_tool PUBLIC cppast cxxopts)
|
||||
set_target_properties(cppast_tool PROPERTIES CXX_STANDARD 11
|
||||
OUTPUT_NAME cppast)
|
||||
9
tool/main.cpp
Normal file
9
tool/main.cpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (C) 2017 Jonathan Müller <jonathanmueller.dev@gmail.com>
|
||||
// This file is subject to the license terms in the LICENSE file
|
||||
// found in the top-level directory of this distribution.
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue