From dc44e922d07c1e1e750918a92d544dd75cd2e951 Mon Sep 17 00:00:00 2001 From: "cwyyprog(Qi Xing)" Date: Thu, 23 Aug 2018 08:23:20 -0700 Subject: [PATCH 1/4] fix build error about curl on windows --- CMakeLists.txt | 4 ++-- libraries/fc | 2 +- libraries/plugins/elasticsearch/CMakeLists.txt | 18 ++++++++++++------ libraries/plugins/es_objects/CMakeLists.txt | 14 ++++++++++---- libraries/utilities/CMakeLists.txt | 9 +++++++-- tests/CMakeLists.txt | 1 + 6 files changed, 33 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf16db8d91..44306e6d30 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,14 +81,14 @@ if( WIN32 ) SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ ) set(CRYPTO_LIB) - + if( MSVC ) #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") # 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") - + endif ( MSVC ) # 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}") diff --git a/libraries/fc b/libraries/fc index 2405081a18..32910f6115 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 2405081a18a3fa23e06e1e751cd020de835b182e +Subproject commit 32910f6115195c3d40dda4ce24adb6747ca74126 diff --git a/libraries/plugins/elasticsearch/CMakeLists.txt b/libraries/plugins/elasticsearch/CMakeLists.txt index f4815576d2..2777cbb1a1 100644 --- a/libraries/plugins/elasticsearch/CMakeLists.txt +++ b/libraries/plugins/elasticsearch/CMakeLists.txt @@ -3,14 +3,20 @@ file(GLOB HEADERS "include/graphene/elasticsearch/*.hpp") add_library( graphene_elasticsearch elasticsearch_plugin.cpp ) - -target_link_libraries( graphene_elasticsearch graphene_chain graphene_app curl ) -target_include_directories( graphene_elasticsearch - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) - +find_package(CURL REQUIRED) +include_directories(${CURL_INCLUDE_DIRS}) if(MSVC) - set_source_files_properties(elasticsearch_plugin.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) + set_source_files_properties(elasticsearch_plugin.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) endif(MSVC) +if(CURL_STATICLIB) + SET_TARGET_PROPERTIES(graphene_elasticsearch PROPERTIES + COMPILE_DEFINITIONS "CURL_STATICLIB") +endif(CURL_STATICLIB) +target_link_libraries( graphene_elasticsearch graphene_chain graphene_app ${CURL_LIBRARIES} ) +target_include_directories( graphene_elasticsearch + PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" + PUBLIC "${CURL_INCLUDE_DIR}" ) + install( TARGETS graphene_elasticsearch diff --git a/libraries/plugins/es_objects/CMakeLists.txt b/libraries/plugins/es_objects/CMakeLists.txt index 92e3d15020..42d18a6580 100644 --- a/libraries/plugins/es_objects/CMakeLists.txt +++ b/libraries/plugins/es_objects/CMakeLists.txt @@ -3,14 +3,20 @@ file(GLOB HEADERS "include/graphene/es_objects/*.hpp") add_library( graphene_es_objects es_objects.cpp ) +find_package(CURL REQUIRED) +include_directories(${CURL_INCLUDE_DIRS}) +if(CURL_STATICLIB) + SET_TARGET_PROPERTIES(graphene_es_objects PROPERTIES + COMPILE_DEFINITIONS "CURL_STATICLIB") +endif(CURL_STATICLIB) +if(MSVC) + set_source_files_properties(es_objects.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) +endif(MSVC) -target_link_libraries( graphene_es_objects graphene_chain graphene_app curl ) +target_link_libraries( graphene_es_objects graphene_chain graphene_app ${CURL_LIBRARIES} ) target_include_directories( graphene_es_objects PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) -if(MSVC) - set_source_files_properties(es_objects.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) -endif(MSVC) install( TARGETS graphene_es_objects diff --git a/libraries/utilities/CMakeLists.txt b/libraries/utilities/CMakeLists.txt index 98086b1059..4311ef46cb 100644 --- a/libraries/utilities/CMakeLists.txt +++ b/libraries/utilities/CMakeLists.txt @@ -19,11 +19,16 @@ set(sources configure_file("${CMAKE_CURRENT_SOURCE_DIR}/git_revision.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp" @ONLY) list(APPEND sources "${CMAKE_CURRENT_BINARY_DIR}/git_revision.cpp") - +find_package(CURL REQUIRED) +include_directories(${CURL_INCLUDE_DIRS}) add_library( graphene_utilities ${sources} ${HEADERS} ) -target_link_libraries( graphene_utilities fc ) +if(CURL_STATICLIB) + SET_TARGET_PROPERTIES(graphene_utilities PROPERTIES + COMPILE_DEFINITIONS "CURL_STATICLIB") +endif(CURL_STATICLIB) +target_link_libraries( graphene_utilities fc ${CURL_LIBRARIES}) target_include_directories( graphene_utilities PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ) if (USE_PCH) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4f3476448d..b863c6347e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,7 @@ add_executable( chain_test ${COMMON_SOURCES} ${UNIT_TESTS} ) target_link_libraries( chain_test graphene_chain graphene_app graphene_witness graphene_account_history graphene_elasticsearch graphene_es_objects graphene_egenesis_none fc graphene_wallet ${PLATFORM_SPECIFIC_LIBS} ) if(MSVC) set_source_files_properties( tests/serialization_tests.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) + set_source_files_properties( tests/common/database_fixture.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) endif(MSVC) file(GLOB PERFORMANCE_TESTS "performance/*.cpp") From af64d86da878dbbf3dc1cb58734e175b45df4ba4 Mon Sep 17 00:00:00 2001 From: cwyyprog Date: Sun, 16 Sep 2018 10:32:15 +0800 Subject: [PATCH 2/4] document windows development environment setup with cURL integrated --- docs | 2 +- libraries/fc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs b/docs index 00bd507e22..bd7209e96d 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 00bd507e227e8b145bb75a1f13f22d9126281cbb +Subproject commit bd7209e96d962681c51084ba50d52b0d3dccbf30 diff --git a/libraries/fc b/libraries/fc index 32910f6115..2405081a18 160000 --- a/libraries/fc +++ b/libraries/fc @@ -1 +1 @@ -Subproject commit 32910f6115195c3d40dda4ce24adb6747ca74126 +Subproject commit 2405081a18a3fa23e06e1e751cd020de835b182e From 1bc2268840187c2926ccbfd1bceb55ac0fd0477a Mon Sep 17 00:00:00 2001 From: abitmore Date: Thu, 20 Sep 2018 11:44:52 -0400 Subject: [PATCH 3/4] Reverted changes on docs --- docs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs b/docs index bd7209e96d..00bd507e22 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit bd7209e96d962681c51084ba50d52b0d3dccbf30 +Subproject commit 00bd507e227e8b145bb75a1f13f22d9126281cbb From fe1422dd7ab0f5bdad8b3e10a50ac593da25a5ab Mon Sep 17 00:00:00 2001 From: abitmore Date: Thu, 20 Sep 2018 11:48:09 -0400 Subject: [PATCH 4/4] Updated coding style --- CMakeLists.txt | 12 +++++++----- libraries/plugins/elasticsearch/CMakeLists.txt | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 44306e6d30..faf3a59f6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,14 +81,16 @@ if( WIN32 ) SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ ) set(CRYPTO_LIB) + if( MSVC ) - #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") + #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") - # 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") + # 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") endif ( MSVC ) + # 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}") diff --git a/libraries/plugins/elasticsearch/CMakeLists.txt b/libraries/plugins/elasticsearch/CMakeLists.txt index 2777cbb1a1..ce9c7c1d1d 100644 --- a/libraries/plugins/elasticsearch/CMakeLists.txt +++ b/libraries/plugins/elasticsearch/CMakeLists.txt @@ -6,7 +6,7 @@ add_library( graphene_elasticsearch find_package(CURL REQUIRED) include_directories(${CURL_INCLUDE_DIRS}) if(MSVC) - set_source_files_properties(elasticsearch_plugin.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) + set_source_files_properties(elasticsearch_plugin.cpp PROPERTIES COMPILE_FLAGS "/bigobj" ) endif(MSVC) if(CURL_STATICLIB) SET_TARGET_PROPERTIES(graphene_elasticsearch PROPERTIES