This is an automated email from the ASF dual-hosted git repository.

szaszm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git

commit ab20656da8c39c2b7f16b25d2eb21d0c8fad9a80
Author: Ferenc Gerlits <[email protected]>
AuthorDate: Mon Apr 15 18:25:33 2024 +0200

    MINIFICPP-2325 Add missing compiler flags
    
    These flags are on by default when we use msbuild, but they need to be
    added manually when we build using ninja. Without these flags, the
    resulting dlls were roughly twice as large when using ninja compared to
    using msbuild. After adding the flags, the sizes are back to normal.
    
    Additionally, on Windows, always copy minifi.exe to the minifi_main 
directory
    
    This was previously done in prep_for_win_package, but the location of
    minifi.exe depends on the generator (Ninja or Msbuild) and the build
    type, and this info is not easily available at packaging time.
    
    Closes #1755
    
    Signed-off-by: Marton Szasz <[email protected]>
---
 CMakeLists.txt                   | 7 +++++--
 cmake/prep_for_win_package.cmake | 1 -
 minifi_main/CMakeLists.txt       | 8 ++------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d68cac75..42d47ba49 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -97,7 +97,11 @@ endif()
 # Enable usage of the VERSION specifier
 if (WIN32)
     add_compile_definitions(WIN32_LEAN_AND_MEAN _CRT_SECURE_NO_WARNINGS 
NOMINMAX)
-    add_compile_options(/W3 /utf-8 /bigobj /MP)
+    add_compile_options(/W3 /utf-8 /bigobj /MP /diagnostics:caret)
+    if (CMAKE_GENERATOR STREQUAL "Ninja")
+        # these flags are default on msbuild, but not on ninja
+        add_compile_options(/MD /GS /fp:precise /Zc:wchar_t /Zc:forScope 
/Zc:inline)
+    endif()
 endif()
 
 if (NOT PORTABLE)
@@ -418,7 +422,6 @@ endif()
 # Generate source assembly
 set(ASSEMBLY_BASE_NAME 
"${CMAKE_PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
 if(WIN32)
-    set(CPACK_PRE_BUILD_SCRIPTS 
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/prep_for_win_package.cmake")
     set(CPACK_ALL_INSTALL_TYPES Full Developer)
     set(CPACK_COMPONENT_LIBRARIES_INSTALL_TYPES Developer Full)
     set(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
diff --git a/cmake/prep_for_win_package.cmake b/cmake/prep_for_win_package.cmake
deleted file mode 100644
index 7bafff193..000000000
--- a/cmake/prep_for_win_package.cmake
+++ /dev/null
@@ -1 +0,0 @@
-file(COPY "${CPACK_PACKAGE_DIRECTORY}/bin/minifi.exe" DESTINATION 
"${CPACK_PACKAGE_DIRECTORY}/minifi_main")
diff --git a/minifi_main/CMakeLists.txt b/minifi_main/CMakeLists.txt
index 337b472ea..62eb234f6 100644
--- a/minifi_main/CMakeLists.txt
+++ b/minifi_main/CMakeLists.txt
@@ -74,12 +74,8 @@ if (WIN32)
     target_compile_definitions(minifiexe PUBLIC SERVICE_NAME="Apache NiFi 
MINiFi")
 endif()
 
-if (NOT WIN32)
-add_custom_command(TARGET minifiexe POST_BUILD
-    COMMAND cat ${CMAKE_BINARY_DIR}/all.log)
-else()
-#add_custom_command(TARGET minifiexe POST_BUILD
-#           COMMAND type ${CMAKE_BINARY_DIR}/all.log)
+if (WIN32)
+    add_custom_command(TARGET minifiexe POST_BUILD COMMAND ${CMAKE_COMMAND} -E 
copy $<TARGET_FILE:minifiexe> ${CMAKE_BINARY_DIR}/minifi_main/)
 endif()
 
 if (NOT WIN32)

Reply via email to