Revision: 9446 https://osdn.net/projects/ttssh2/scm/svn/commits/9446 Author: zmatsuo Date: 2021-09-23 20:25:29 +0900 (Thu, 23 Sep 2021) Log Message: ----------- cmakeビルドでcygtoolを常に32bit dllとしてビルドするようにした - 従来 Visual Studioで64bitビルドしたとき, cygtool.dll も64bit dllとしてビルドしていた - MinGW(msys2)は未調整 - Inno setup で cygtool.dll を利用していた - Inno setup は 32bit で、cygtool.dll も32bitである必要があった - Inno setup 実行中 Runtime error が出ていた Modified Paths: -------------- trunk/installer/CMakeLists.txt trunk/installer/cygtool/CMakeLists.txt Added Paths: ----------- trunk/installer/cygtool/build_cygtool.cmake -------------- next part -------------- Modified: trunk/installer/CMakeLists.txt =================================================================== --- trunk/installer/CMakeLists.txt 2021-09-23 11:25:18 UTC (rev 9445) +++ trunk/installer/CMakeLists.txt 2021-09-23 11:25:29 UTC (rev 9446) @@ -316,8 +316,24 @@ COMMAND "${CMAKE_COMMAND}" -E echo "inno setup not found" ) else() - add_subdirectory(cygtool) + add_custom_target( + cygtool + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll + ) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll + COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR} -P build_cygtool.cmake + COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_GENERATOR} + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/cygtool + COMMENT Generate "${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll" + ) + + install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll + DESTINATION . + ) + configure_file( teraterm_cmake.iss.in teraterm_cmake.iss NEWLINE_STYLE CRLF @@ -338,6 +354,10 @@ inno_setup PROPERTIES FOLDER installer ) +set_target_properties( + cygtool + PROPERTIES FOLDER installer + ) # zip add_custom_target( Modified: trunk/installer/cygtool/CMakeLists.txt =================================================================== --- trunk/installer/cygtool/CMakeLists.txt 2021-09-23 11:25:18 UTC (rev 9445) +++ trunk/installer/cygtool/CMakeLists.txt 2021-09-23 11:25:29 UTC (rev 9446) @@ -1,5 +1,9 @@ -set(PACKAGE_NAME "cygtool_dll") +cmake_minimum_required(VERSION 3.11) +set(PACKAGE_NAME "cygtool_dll") + +project(${PACKAGE_NAME}) + add_library( ${PACKAGE_NAME} SHARED cygtool.c @@ -24,19 +28,20 @@ endif(SUPPORT_OLD_WINDOWS) target_link_libraries( - cygtool_dll + ${PACKAGE_NAME} PRIVATE version ) set_target_properties( - cygtool_dll + ${PACKAGE_NAME} PROPERTIES + PREFIX "" OUTPUT_NAME "cygtool" ) set_target_properties( - cygtool_dll + ${PACKAGE_NAME} PROPERTIES FOLDER installer ) @@ -48,7 +53,7 @@ ) install( - TARGETS cygtool_dll + TARGETS ${PACKAGE_NAME} DESTINATION . ) @@ -66,7 +71,7 @@ ) target_link_libraries( - cygtool_dll + cygtool_exe PRIVATE version ) Added: trunk/installer/cygtool/build_cygtool.cmake =================================================================== --- trunk/installer/cygtool/build_cygtool.cmake (rev 0) +++ trunk/installer/cygtool/build_cygtool.cmake 2021-09-23 11:25:29 UTC (rev 9446) @@ -0,0 +1,39 @@ +# +if(NOT DEFINED CMAKE_GENERATOR) + if(${CMAKE_COMMAND} MATCHES "mingw") + # meybe mingw + set(CMAKE_GENERATOR "Unix Makefiles") + elseif(CMAKE_HOST_WIN32) + set(CMAKE_GENERATOR "Visual Studio 16 2019") + else() + set(CMAKE_GENERATOR "Unix Makefiles") + endif() +endif() +if((${CMAKE_GENERATOR} MATCHES "Visual Studio 16 2019") OR + (${CMAKE_GENERATOR} MATCHES "Visual Studio 17 2022")) + # 32bit build for inno setup + set(GENERATE_OPTION "-A;Win32") +endif() + +message("CMAKE_GENERATOR=${CMAKE_GENERATOR}") +message("CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}") + +file(REMOVE_RECURSE build) +file(MAKE_DIRECTORY build) + +execute_process( + COMMAND ${CMAKE_COMMAND} .. -G ${CMAKE_GENERATOR} ${GENERATE_OPTION} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} + WORKING_DIRECTORY "build" + ) + +execute_process( + COMMAND ${CMAKE_COMMAND} --build . --config release + WORKING_DIRECTORY "build" + ) + +if(DEFINED CMAKE_INSTALL_PREFIX) + execute_process( + COMMAND ${CMAKE_COMMAND} --build . --config release --target install + WORKING_DIRECTORY "build" + ) +endif()