Skip to content
Snippets Groups Projects
Commit 0d178945 authored by Martin Marinov's avatar Martin Marinov Committed by GitHub Enterprise
Browse files

REFORM-1185 Enable Preprocess Mac build (#71)

* Fix the check preventing Filesystem builds on APPLE w/o Boost
* Remove obsolete definitions from CMake
* Fix build error with OptionT<> when TEST_ON is undefined
* Add missing includes when TEST_ON is undefined
* Remove the error message if JOURNAL_USE_BOOST is undefined
parent d343dddf
No related branches found
No related tags found
1 merge request!14Merge latest changes to Base from ReForm
cmake_minimum_required(VERSION 3.14)
# This is used by ASM for ASM compatibility. Include a file that the parent
# project can pass to set specific compilation flags
if (DEFINED COMMONCOMPILERFLAGFILE)
include(${COMMONCOMPILERFLAGFILE})
endif(DEFINED COMMONCOMPILERFLAGFILE)
set(output_lib "Base")
add_library(${output_lib} STATIC)
# Add option to enable extra parsing of the CTest log
option(BASE_TEST_CTEST_NAMES_ARE_OUTPUT_PATHS "Declare that CTest test names are the same as the test output paths to enable extra CTest log parsing." OFF)
option(BASE_TEST_CTEST_NAMES_ARE_OUTPUT_PATHS
"Declare that CTest test names are the same as the test output paths to enable extra CTest log parsing."
OFF)
if(BASE_TEST_CTEST_NAMES_ARE_OUTPUT_PATHS)
target_compile_definitions(${output_lib} PRIVATE TEST_REPORT_CTEST_NAMES_ARE_OUTPUT_PATHS)
target_compile_definitions(${output_lib} PRIVATE
TEST_REPORT_CTEST_NAMES_ARE_OUTPUT_PATHS)
endif()
function(base_add_subdir subdir)
......@@ -51,17 +49,8 @@ target_include_directories(${output_lib} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/.."
set_target_properties(${output_lib} PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties(${output_lib} PROPERTIES C_VISIBILITY_PRESET hidden)
set_target_properties(${output_lib} PROPERTIES VISIBILITY_INLINES_HIDDEN ON)
set_target_properties(${output_lib} PROPERTIES C_STANDARD 99)
set_target_properties(${output_lib} PROPERTIES POSITION_INDEPENDENT_CODE ON)
# Set C++ version to 14 if on macOS (as XCode10 does not support enough of C++17)
# and 17 otherwise.
if (APPLE)
set_target_properties(${output_lib} PROPERTIES CXX_STANDARD 14)
else (APPLE)
set_target_properties(${output_lib} PROPERTIES CXX_STANDARD 17)
endif (APPLE)
if (MSVC)
add_definitions(/W4) # warnings at level 4
endif (MSVC)
// Copyright 2020 Autodesk, Inc. All rights reserved.
// Copyright 2021 Autodesk, Inc. All rights reserved.
//
// This computer source code and related instructions and comments are the
// unpublished confidential and proprietary information of Autodesk, Inc.
......@@ -21,11 +21,9 @@
#include <algorithm>
namespace fs = Base::filesystem;
#if defined(__APPLE__) && !defined(JOURNAL_USE_BOOST)
#error Boost is required for journaling on macOS.
#endif // defined(__APPLE__) && !defined(JOURNAL_USE_BOOST)
namespace Journal {
namespace Journal
{
bool environment_base_path(const char* const _cmpn_name, String& _base_path)
{
......
......@@ -5,15 +5,20 @@
#include <Base/Security/Mandatory.hh>
#ifdef __APPLE__
// NOTE: Boost required for old versions of MacOS due to lack of std::filesystem
#if defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
#include <boost/filesystem.hpp>
namespace Base
{
namespace filesystem = boost::filesystem;
typedef boost::filesystem::path Path;
typedef boost::system::error_code error_code;
} // namespace Base
#else // __APPLE__
#else // defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
// Include <filesystem> but silence resulting C4995 warnings
INSECURE_INCLUDE_SECTION_BEGIN
#include <filesystem>
......@@ -24,6 +29,7 @@ namespace Base
namespace filesystem = std::filesystem;
typedef std::error_code error_code;
} // namespace Base
#endif // __APPLE__
#endif // defined(__APPLE__) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500
#endif // BASE_FILESYSTEM_HH_INCLUDE
......@@ -3,6 +3,9 @@
#include "Base/Security/Mandatory.hh"
#include "OptionT.hh"
#include <string>
#include <stddef.h>
#ifdef TEST_ON
#include <Base/Test/TestArgs.hh>
......
......@@ -3,6 +3,8 @@
#ifndef BASE_OPTIONT_HH_INCLUDED
#define BASE_OPTIONT_HH_INCLUDED
#include <Base/Code/Quality.hh>
namespace Base
{
/*!
......@@ -25,6 +27,8 @@ public:
{
#ifdef TEST_ON
bind(_name);
#else
LOW_CODE_QUALITY_VARIABLE_ALLOW(_name);
#endif//TEST_ON
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment