Skip to content

Commit

Permalink
minor fixups
Browse files Browse the repository at this point in the history
  • Loading branch information
djmott committed Jul 28, 2016
1 parent 2bc9ef1 commit 403ad3e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
11 changes: 10 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ include(ExternalProject)

check_library_exists(uuid uuid_generate "" XTD_HAS_LIBUUID)


check_cxx_source_compiles("
#include <codecvt>
int main(){return 0;}
Expand Down Expand Up @@ -81,6 +82,7 @@ option(XTD_LOG_TARGET_WINDBG "write log output to attached debugger" NO)
option(BUILD_EXAMPLES "Build examples" YES)
option(BUILD_TESTS "Build tests" YES)

option(XTD_LINK_TO_FS_TS "link to the c++ filesystem TS" NO)

### detect OS
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
Expand Down Expand Up @@ -208,6 +210,9 @@ else()
add_definitions(-DUNICODE)
endif()

if(XTD_LINK_TO_FS_TS)
link_libraries(stdc++fs)
endif()

### link libraries
if(XTD_OS MATCHES "XTD_OS_CYGWIN")
Expand All @@ -216,6 +221,9 @@ elseif(XTD_OS MATCHES "XTD_OS_MINGW")
link_libraries(rpcrt4 ws2_32 pthread stdc++ psapi)
elseif(XTD_OS MATCHES "XTD_OS_LINUX")
link_libraries(dl pthread stdc++)
if(XTD_LINK_TO_FS_TS)
link_libraries(stdc++fs)
endif()
elseif(XTD_OS MATCHES "XTD_OS_WINDOWS")
link_libraries(rpcrt4 psapi)
endif()
Expand All @@ -237,7 +245,8 @@ if(NOT GTEST_FOUND)
# lifted from https://crascit.com/2015/07/25/cmake-gtest/
# Download and unpack googletest at configure time
configure_file(CMakeLists.txt.gtest googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -DBUILD_GTEST:BOOLEAN=ON . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
set(BUILD_GTEST ON CACHE BOOLEAN "")
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -D BUILD_GTEST:BOOLEAN=${BUILD_GTEST} . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)
execute_process(COMMAND ${CMAKE_COMMAND} --build . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/googletest-download)

# Prevent GoogleTest from overriding our compiler/linker options
Expand Down
5 changes: 2 additions & 3 deletions include/xtd/executable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ namespace xtd {
#elif ((XTD_OS_LINUX | XTD_OS_CYGWIN | XTD_OS_MSYS) & XTD_OS)

static inline xtd::filesystem::path get_path() {
static xtd::filesystem::path sRet = "";
if (0 == sRet.size()) {
sRet.resize(PATH_MAX);
static std::string sRet(PATH_MAX, 0);
if (!sRet[0]) {
sRet.resize(xtd::crt_exception::throw_if(::readlink("/proc/self/exe", &sRet[0], sRet.size()), [](int i) { return (-1 == i); }));
}
return sRet;
Expand Down
6 changes: 2 additions & 4 deletions include/xtd/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace xtd{
#endif
}

#if (XTD_HAS_FILESYSTEM)
#if (XTD_HAS_EXP_FILESYSTEM || XTD_HAS_FILESYSTEM)
namespace filesystem{
class path_base : public std::experimental::filesystem::path{
using _super_t = std::experimental::filesystem::path;
Expand All @@ -27,9 +27,7 @@ namespace xtd{
template <typename ... _ArgTs> path_base(_ArgTs...oArgs) : _super_t(std::forward<_ArgTs>(oArgs)...){}
};
}
#endif

#if (!XTD_HAS_EXP_FILESYSTEM && !XTD_HAS_FILESYSTEM)
#else

namespace filesystem {
/** base path class
Expand Down
4 changes: 3 additions & 1 deletion include/xtd/mapped_file.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ memory mapped files
@copyright David Mott (c) 2016. Distributed under the Boost Software License Version 1.0. See LICENSE.md or http://boost.org/LICENSE_1_0.txt for details.
*/

#if 0
namespace xtd{
class mapped_file{
int _FileNum;
Expand All @@ -17,4 +18,5 @@ namespace xtd{

template <typename _Ty> mapped_page<_Ty> read(size_t offset){}
};
}
}
#endif

0 comments on commit 403ad3e

Please sign in to comment.