Skip to content

Commit

Permalink
Merge pull request steemit#63 from arhag/mingw-build
Browse files Browse the repository at this point in the history
Changes to Steem to get MinGW cross-compilation to work
  • Loading branch information
bytemaster committed May 23, 2016
2 parents c9ec28a + cdb5615 commit d247df8
Show file tree
Hide file tree
Showing 16 changed files with 277 additions and 4,037 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "libraries/fc"]
path = libraries/fc
url = https://github.com/steemit/fc.git
url = https://github.com/arhag/fc.git
57 changes: 35 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,36 +88,49 @@ ENDIF()

if( WIN32 )

message( STATUS "Configuring Steem on WIN32")
set( DB_VERSION 60 )
set( BDB_STATIC_LIBS 1 )
message( STATUS "Configuring Steem on WIN32")
set( DB_VERSION 60 )
set( BDB_STATIC_LIBS 1 )

set( ZLIB_LIBRARIES "" )
SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ )
set( ZLIB_LIBRARIES "" )
SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ )

set(CRYPTO_LIB)
set(CRYPTO_LIB)

#looks like this flag can have different default on some machines.
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")
if( MSVC )

# Probably cmake has a bug and vcxproj generated for executable in Debug conf. has disabled debug info
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG")
#looks like this flag can have different default on some machines.
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO")

# On windows tcl should be installed to the directory pointed by setenv.bat script
SET(TCL_INCLUDE_PATH $ENV{TCL_ROOT}/include)
MESSAGE(STATUS "tcl INCLUDE PATH: ${TCL_INCLUDE_PATH}")
# Probably cmake has a bug and vcxproj generated for executable in Debug conf. has disabled debug info
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /DEBUG")

FIND_PACKAGE(TCL)
MESSAGE(STATUS "tcl_library: ${TCL_LIBRARY}")
# On windows tcl should be installed to the directory pointed by setenv.bat script
SET(TCL_INCLUDE_PATH $ENV{TCL_ROOT}/include)
MESSAGE(STATUS "tcl INCLUDE PATH: ${TCL_INCLUDE_PATH}")

SET(TCL_LIBS "optimized;${TCL_LIBRARY};debug;")
get_filename_component(TCL_LIB_PATH "${TCL_LIBRARY}" PATH)
get_filename_component(TCL_LIB_NAME "${TCL_LIBRARY}" NAME_WE)
get_filename_component(TCL_LIB_EXT "${TCL_LIBRARY}" EXT)
FIND_PACKAGE(TCL)
MESSAGE(STATUS "tcl_library: ${TCL_LIBRARY}")

SET(TCL_LIBS "${TCL_LIBS}${TCL_LIB_PATH}/${TCL_LIB_NAME}g${TCL_LIB_EXT}")
SET(TCL_LIBRARY ${TCL_LIBS})
SET(TCL_LIBS "optimized;${TCL_LIBRARY};debug;")
get_filename_component(TCL_LIB_PATH "${TCL_LIBRARY}" PATH)
get_filename_component(TCL_LIB_NAME "${TCL_LIBRARY}" NAME_WE)
get_filename_component(TCL_LIB_EXT "${TCL_LIBRARY}" EXT)

SET(TCL_LIBS "${TCL_LIBS}${TCL_LIB_PATH}/${TCL_LIB_NAME}g${TCL_LIB_EXT}")
SET(TCL_LIBRARY ${TCL_LIBS})

elseif( MINGW )
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive -msse4.2 -Wa,-mbig-obj")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
# Optimization flag apparently needed to get rid of "File too big" assembler errors when compiling in Debug mode
# See: https://stackoverflow.com/questions/14125007/gcc-string-table-overflow-error-during-compilation/14601779#29479701
SET(CMAKE_CXX_FLAGS_DEBUG "-O2")
if ( FULL_STATIC_BUILD )
set( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc")
endif ( FULL_STATIC_BUILD )
endif( MSVC )

else( WIN32 ) # Apple AND Linux

Expand Down
13 changes: 0 additions & 13 deletions libraries/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@

## This feature depends upon Qt 5.5 but is not required for consensus
IF( ENABLE_CONTENT_PATCHING )
find_package(Qt5Core REQUIRED)
MESSAGE( STATUS " CONFIGURING WITH DIFF MATCH PATCH " )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTEEM_DIFF_MATCH_PATCH" )
add_subdirectory( google-diff-match-patch/cpp )

SET( PATCH_MERGE_LIB google_patch_diff_merge Qt5::Core)
ELSE()
MESSAGE( STATUS " CONFIGURING WITHOUT DIFF MATCH PATCH " )
ENDIF( ENABLE_CONTENT_PATCHING )

add_subdirectory( fc )
add_subdirectory( db )
add_subdirectory( deterministic_openssl_rand )
Expand Down
4 changes: 1 addition & 3 deletions libraries/chain/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
file(GLOB HEADERS "include/steemit/chain/*.hpp")

add_custom_target( build_hardfork_hpp
COMMAND cat-parts "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d" "${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp" )
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/../../programs/build_helpers/cat_parts.py" "${CMAKE_CURRENT_SOURCE_DIR}/hardfork.d" "${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp" )
set_source_files_properties( "${CMAKE_CURRENT_BINARY_DIR}/include/steemit/chain/hardfork.hpp" PROPERTIES GENERATED TRUE )

add_dependencies( build_hardfork_hpp cat-parts )

## SORT .cpp by most likely to change / break compile
add_library( steemit_chain

Expand Down
18 changes: 5 additions & 13 deletions libraries/chain/steem_evaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <steemit/chain/steem_evaluator.hpp>
#include <steemit/chain/steem_objects.hpp>

#ifdef STEEM_DIFF_MATCH_PATCH
#ifndef IS_LOW_MEM
#include <diff_match_patch.h>
#endif

Expand Down Expand Up @@ -270,27 +270,19 @@ void comment_evaluator::do_apply( const comment_operation& o )
if( o.json_metadata.size() ) com.json_metadata = o.json_metadata;

if( o.body.size() ) {
#ifdef STEEM_DIFF_MATCH_PATCH
try {
diff_match_patch dmp;
auto patch = dmp.patch_fromText( QString::fromStdString(o.body) );
diff_match_patch<string> dmp;
auto patch = dmp.patch_fromText( o.body );
if( patch.size() ) {
auto first = QString::fromStdString( com.body );
auto result = dmp.patch_apply( patch, first );
com.body = result.first.toStdString();
auto result = dmp.patch_apply( patch, com.body );
com.body = result.first;
}
else { // replace
com.body = o.body;
}
} catch ( const QString& err ) {
//wlog( "exception thrown while applying patch: \n ${e}", ("e",err.toStdString()) );
com.body = o.body;
} catch ( ... ) {
com.body = o.body;
}
#else
com.body = o.body;
#endif
}
#endif

Expand Down
7 changes: 0 additions & 7 deletions libraries/google-diff-match-patch/cpp/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit d247df8

Please sign in to comment.