Skip to content

Commit

Permalink
#36 = fix compile errors on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-modelist-dev committed Oct 26, 2018
1 parent c8c621c commit bc1f4ff
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 19 deletions.
5 changes: 4 additions & 1 deletion keychain_cmd_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ set(BOOST_ALL_DYN_LINK OFF)
FIND_PACKAGE(Boost 1.65 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
SET(Boost_LIBRARIES ${Boost_LIBRARIES})

find_library(LIB_OPENSSL NAME crypto HINTS "${OPENSSL_ROOT_DIR}/lib")

if( NOT MSVC )
find_library(LIB_OPENSSL NAME crypto HINTS "${OPENSSL_ROOT_DIR}/lib")
find_library(LIB_PTHREAD NAME pthread HINTS "/usr/lib/x86_64-linux-gnu")
else()
find_library(LIB_OPENSSL NAME libcrypto.lib HINTS "${OPENSSL_ROOT_DIR}/lib")
endif( NOT MSVC )


Expand Down
2 changes: 1 addition & 1 deletion keychain_service_win/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ add_definitions(-DUNICODE -D_UNICODE)

include_directories(
"./include"
"../keychain_lib/include"
"../keychain_lib/include"
"../array-io-core/libraries/utilities/include"
"../array-io-core/libraries/db/include"
"../array-io-core/libraries/chain/include"
Expand Down
2 changes: 2 additions & 0 deletions keychain_service_win/pass_ent_app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,7 @@ file(GLOB KEYCHAIN_PASS_ENT_INCLUDES "./*.h")
file(GLOB KEYCHAIN_PASS_ENT_RESOURCES "./*.rc")

add_executable(keychain_pass_entry_app ${KEYCHAIN_PASS_ENT_SOURCES} ${KEYCHAIN_PASS_ENT_INCLUDES} ${KEYCHAIN_PASS_ENT_RESOURCES} ${KEYCHAIN_PASS_ENT_APPS})
target_include_directories( keychain_pass_entry_app PRIVATE "./include/")

target_link_libraries(keychain_pass_entry_app Crypt32.lib)

2 changes: 1 addition & 1 deletion libraries/eth-crypto
10 changes: 5 additions & 5 deletions libraries/fc_light/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace fc_light {
{
std::wstring path = generic_wstring();

#ifdef WIN32
#ifdef _WIN32
const size_t maxPath = 32*1024;
std::vector<wchar_t> short_path;
short_path.resize(maxPath + 1);
Expand Down Expand Up @@ -276,7 +276,7 @@ namespace fc_light {
// no-op on Windows.
void chmod( const path& p, int perm )
{
#ifndef WIN32
#ifndef _WIN32
mode_t actual_perm =
((perm & 0400) ? S_IRUSR : 0)
| ((perm & 0200) ? S_IWUSR : 0)
Expand Down Expand Up @@ -447,7 +447,7 @@ namespace fc_light {
{
static fc_light::path p = []()
{
#ifdef WIN32
#ifdef _WIN32
HANDLE access_token;
if (!OpenProcessToken(GetCurrentProcess(), TOKEN_READ, &access_token))
FC_LIGHT_ASSERT(false, "Unable to open an access token for the current process");
Expand Down Expand Up @@ -479,7 +479,7 @@ namespace fc_light {
{
#ifdef __APPLE__
static fc_light::path appdir = [](){ return home_path() / "Library" / "Application Support"; }();
#elif defined( WIN32 )
#elif defined( _WIN32 )
static fc_light::path appdir = [](){
wchar_t app_data_dir[MAX_PATH];

Expand Down Expand Up @@ -563,7 +563,7 @@ namespace fc_light {

void simple_lock_file::impl::unlock()
{
#ifdef WIN32
#ifdef _WIN32
CloseHandle(file_handle);
file_handle = INVALID_HANDLE_VALUE;
is_locked = false;
Expand Down
6 changes: 3 additions & 3 deletions libraries/fc_light/src/io/console.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace fc_light {

#ifdef WIN32
#ifdef _WIN32
#include <windows.h>

void set_console_echo( bool enable_echo )
Expand All @@ -21,7 +21,7 @@ void set_console_echo( bool enable_echo )
}
}

#else // NOT WIN32
#else // NOT _WIN32
#include <termios.h>
#include <unistd.h>

Expand All @@ -41,6 +41,6 @@ void set_console_echo( bool enable_echo )
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
}

#endif // WIN32
#endif // _WIN32

} // namespace fc_light
17 changes: 10 additions & 7 deletions libraries/fc_light/src/log/console_appender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <fc_light/string.hpp>
#include <fc_light/variant.hpp>
#include <fc_light/reflect/variant.hpp>
#ifndef WIN32
#ifndef _WIN32
#include <unistd.h>
#endif
#include <boost/thread/mutex.hpp>
Expand All @@ -16,14 +16,17 @@
#include <sstream>
#include <mutex>

#ifdef _WIN32
#include <windows.h>
#endif

namespace fc_light {

class console_appender::impl {
public:
config cfg;
color::type lc[log_level::off+1];
#ifdef WIN32
#ifdef _WIN32
HANDLE console_handle;
#endif
};
Expand All @@ -45,11 +48,11 @@ namespace fc_light {

void console_appender::configure( const config& console_appender_config )
{ try {
#ifdef WIN32
#ifdef _WIN32
my->console_handle = INVALID_HANDLE_VALUE;
#endif
my->cfg = console_appender_config;
#ifdef WIN32
#ifdef _WIN32
if (my->cfg.stream = stream::std_error)
my->console_handle = GetStdHandle(STD_ERROR_HANDLE);
else if (my->cfg.stream = stream::std_out)
Expand All @@ -64,7 +67,7 @@ namespace fc_light {

console_appender::~console_appender() {}

#ifdef WIN32
#ifdef _WIN32
static WORD
#else
static const char*
Expand Down Expand Up @@ -133,7 +136,7 @@ namespace fc_light {
{
FILE* out = stream::std_error ? stderr : stdout;

#ifdef WIN32
#ifdef _WIN32
if (my->console_handle != INVALID_HANDLE_VALUE)
SetConsoleTextAttribute(my->console_handle, get_console_color(text_color));
#else
Expand All @@ -143,7 +146,7 @@ namespace fc_light {
if( text.size() )
fprintf( out, "%s", text.c_str() ); //fmt_str.c_str() );

#ifdef WIN32
#ifdef _WIN32
if (my->console_handle != INVALID_HANDLE_VALUE)
SetConsoleTextAttribute(my->console_handle, CONSOLE_DEFAULT);
#else
Expand Down
2 changes: 1 addition & 1 deletion libraries/fc_light/src/log/console_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
#if COLOR_CONSOLE

#ifndef WIN32
#ifndef _WIN32

/**
@def CONSOLE_DEFAULT
Expand Down

0 comments on commit bc1f4ff

Please sign in to comment.