Skip to content

Commit

Permalink
Merge pull request #168 from solarispika/remove-legacy-option
Browse files Browse the repository at this point in the history
Remove LEGACY option
  • Loading branch information
SpartanJ authored Nov 10, 2023
2 parents 2445f55 + a292ed9 commit 9f6caa0
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 45 deletions.
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ include(GNUInstallDirs)
find_package(Threads REQUIRED)

option(VERBOSE "Build efsw with verbose mode.")
option(LEGACY "Build efsw with cpp legacy support (before C++11).")
option(BUILD_SHARED_LIBS "Build efsw as a shared library" ON)
option(BUILD_STATIC_LIBS "Build efsw as a static library" ON)
option(BUILD_TEST_APP "Build the test app" ${ESFW_MAIN_PROJECT})
Expand Down Expand Up @@ -68,11 +67,7 @@ if(VERBOSE)
target_compile_definitions(efsw PRIVATE EFSW_VERBOSE)
endif()

if(NOT LEGACY)
target_compile_features(efsw PRIVATE cxx_std_11)
else()
target_compile_definitions(efsw PRIVATE EFSW_LEGACY_CPP)
endif()
target_compile_features(efsw PRIVATE cxx_std_11)

if(BUILD_SHARED_LIBS)
target_compile_definitions(efsw PRIVATE EFSW_DYNAMIC EFSW_EXPORTS)
Expand Down
9 changes: 2 additions & 7 deletions premake4.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
newoption { trigger = "verbose", description = "Build efsw with verbose mode." }
newoption { trigger = "strip-symbols", description = "Strip debugging symbols in other file ( only for relwithdbginfo configuration )." }
newoption { trigger = "legacy", description = "Build efsw with cpp legacy support (before C++11)." }
newoption { trigger = "thread-sanitizer", description ="Compile with ThreadSanitizer." }

efsw_major_version = "1"
Expand Down Expand Up @@ -133,12 +132,8 @@ solution "efsw"
defines { "EFSW_VERBOSE" }
end

if not _OPTIONS["legacy"] then
if not is_vs() then
buildoptions { "-std=c++11" }
end
else
defines { "EFSW_LEGACY_CPP" }
if not is_vs() then
buildoptions { "-std=c++11" }
end

if os.is("macosx") then
Expand Down
7 changes: 1 addition & 6 deletions premake5.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
newoption { trigger = "verbose", description = "Build efsw with verbose mode." }
newoption { trigger = "strip-symbols", description = "Strip debugging symbols in other file ( only for relwithdbginfo configuration )." }
newoption { trigger = "legacy", description = "Build efsw with cpp legacy support (before C++11)." }
newoption { trigger = "thread-sanitizer", description ="Compile with ThreadSanitizer" }

efsw_major_version = "1"
Expand Down Expand Up @@ -134,11 +133,7 @@ workspace "efsw"
defines { "EFSW_VERBOSE" }
end

if not _OPTIONS["legacy"] then
cppdialect "C++11"
else
defines { "EFSW_LEGACY_CPP" }
end
cppdialect "C++11"

objdir("obj/" .. os.target() .. "/")

Expand Down
18 changes: 0 additions & 18 deletions src/efsw/Atomic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

#include <efsw/base.hpp>

#ifndef EFSW_LEGACY_CPP
#include <atomic>
#endif

namespace efsw {

Expand All @@ -14,36 +12,20 @@ template <typename T> class Atomic {
explicit Atomic( T set = false ) : set_( set ) {}

Atomic& operator=( T set ) {
#ifndef EFSW_LEGACY_CPP
set_.store( set, std::memory_order_release );
#else
set_ = set;
#endif
return *this;
}

explicit operator T() const {
#ifndef EFSW_LEGACY_CPP
return set_.load( std::memory_order_acquire );
#else
return set_;
#endif
}

T load() const {
#ifndef EFSW_LEGACY_CPP
return set_.load( std::memory_order_acquire );
#else
return set_;
#endif
}

private:
#ifndef EFSW_LEGACY_CPP
std::atomic<T> set_;
#else
volatile T set_;
#endif
};

} // namespace efsw
Expand Down
4 changes: 0 additions & 4 deletions src/efsw/FileWatcherFSEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ FileWatcherFSEvents::FileWatcherFSEvents( FileWatcher* parent ) :
FileWatcherFSEvents::~FileWatcherFSEvents() {
mInitOK = false;

#ifndef EFSW_LEGACY_CPP
mWatchCond.notify_all();
#endif

WatchMap::iterator iter = mWatches.begin();

Expand Down Expand Up @@ -135,9 +133,7 @@ WatchID FileWatcherFSEvents::addWatch( const std::string& directory, FileWatchLi
mWatches.insert( std::make_pair( mLastWatchID, pWatch ) );
}

#ifndef EFSW_LEGACY_CPP
mWatchCond.notify_all();
#endif
return pWatch->ID;
}

Expand Down
4 changes: 0 additions & 4 deletions src/efsw/FileWatcherFSEvents.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
#include <efsw/WatcherFSEvents.hpp>
#include <map>
#include <vector>
#ifndef EFSW_LEGACY_CPP
#include <condition_variable>
#include <mutex>
#endif

namespace efsw {

Expand Down Expand Up @@ -91,10 +89,8 @@ class FileWatcherFSEvents : public FileWatcherImpl {

bool pathInWatches( const std::string& path );

#ifndef EFSW_LEGACY_CPP
std::mutex mWatchesMutex;
std::condition_variable mWatchCond;
#endif

};

Expand Down

0 comments on commit 9f6caa0

Please sign in to comment.