tomlplusplus: compile header once

This commit is contained in:
Jake Hillion 2023-05-25 03:42:20 -07:00 committed by Jake Hillion
parent bd919ae4e4
commit 008e519cd7
7 changed files with 46 additions and 6 deletions

View File

@ -1,3 +1,8 @@
add_library(toml
support/Toml.cpp
)
target_link_libraries(toml PUBLIC tomlplusplus::tomlplusplus)
add_library(drgn_utils DrgnUtils.cpp)
target_link_libraries(drgn_utils
glog::glog
@ -28,7 +33,7 @@ target_link_libraries(container_info
drgn_utils # This shouldn't be needed! Clean up Commoh.h!
glog::glog
tomlplusplus::tomlplusplus
toml
)
add_library(codegen

View File

@ -16,10 +16,11 @@
#include "oi/ContainerInfo.h"
#include <glog/logging.h>
#include <toml++/toml.h>
#include <map>
#include "oi/support/Toml.h"
namespace fs = std::filesystem;
ContainerTypeEnum containerTypeEnumFromStr(std::string& str) {

View File

@ -16,7 +16,6 @@
#include "oi/OIUtils.h"
#include <glog/logging.h>
#include <toml++/toml.h>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
@ -24,6 +23,8 @@
#include <boost/property_tree/ptree.hpp>
#include <filesystem>
#include "oi/support/Toml.h"
namespace fs = std::filesystem;
namespace OIUtils {

17
oi/support/Toml.cpp Normal file
View File

@ -0,0 +1,17 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define TOML_IMPLEMENTATION
#include "oi/support/Toml.h"

17
oi/support/Toml.h Normal file
View File

@ -0,0 +1,17 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#define TOML_HEADER_ONLY 0
#include <toml++/toml.h>

View File

@ -104,7 +104,7 @@ target_link_libraries(integration_test_runner PRIVATE
${GMOCK_MAIN_LIBS}
Boost::headers
${Boost_LIBRARIES}
tomlplusplus::tomlplusplus
toml
)
target_compile_definitions(integration_test_runner PRIVATE
TARGET_EXE_PATH="${CMAKE_CURRENT_BINARY_DIR}/integration_test_target"

View File

@ -1,7 +1,5 @@
#include "runner_common.h"
#include <toml++/toml.h>
#include <algorithm>
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
@ -15,6 +13,7 @@
#include <utility>
#include "oi/OIOpts.h"
#include "oi/support/Toml.h"
using namespace std::literals;