• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision9519 (tree)
Time2021-11-10 22:01:59
Authorzmatsuo

Log Message

cygwin/CMakeLists.txt を整理

- cygterm

- cygwin 64bit, 32bit, msys2 用の3種類をビルドできるようにした
- ただし msys2(MinGW) でビルド時、msys2term がうまくビルドできない
- 全体のビルド時は cygterm_build/CMakeLists.txt からビルドするようにした

- cygtool

- 全体のビルド時は cygtool_build/CMakeLists.txt からビルドするようにした
- 常に32bitバイナリを作成するため

Change Summary

Incremental Difference

--- trunk/cygwin/CMakeLists.txt (revision 9518)
+++ trunk/cygwin/CMakeLists.txt (revision 9519)
@@ -8,15 +8,12 @@
88 cyglib
99 PROPERTIES FOLDER cygwin)
1010
11-add_subdirectory(cygtool)
11+add_subdirectory(cygtool_build)
1212 set_target_properties(
13- cygtool_dll
13+ cygtool_build
1414 PROPERTIES FOLDER cygwin)
1515
16-if(false)
17- add_subdirectory(cygterm)
18- set_target_properties(
19- cygterm
20- PROPERTIES FOLDER cygwin)
21-endif()
22-
16+add_subdirectory(cygterm_build)
17+set_target_properties(
18+ cygterm_build
19+ PROPERTIES FOLDER cygwin)
--- trunk/cygwin/README.md (revision 9518)
+++ trunk/cygwin/README.md (revision 9519)
@@ -3,8 +3,16 @@
33 - cyglaunch
44 - cygterm を実行するプログラム
55 - cygterm
6- - cygwin を起動するプログラム
6+ - cygwin(msys2)のシェルとTera Termの橋渡しをするプログラム
7+ - cygwin用64bit, 32bit, msys2用(msys2term) をビルド可能
8+ - cygwinのとき、コンパイラパッケージをインストールしておく
9+ - cygwin 64bit環境時は cygwin32-gcc-core と cygwin32-gcc-g++
10+ - cygwin 32bit環境時は cygwin64-gcc-core と cygwin64-gcc-g++
11+- cygterm_build
12+ - cmakeビルド用 cygterm(とmsys2term) をビルドするためのフォルダ
713 - cygtool
814 - インストーラから使用するdll
15+- cygtool_build
16+ - cmakeビルド用 cygtool をビルドするためのフォルダ
917 - cyglib
1018 - ttermpro, cyglaunch, cygtool から使用するライブラリ
--- trunk/cygwin/cyglib/cyglib.c (revision 9518)
+++ trunk/cygwin/cyglib/cyglib.c (revision 9519)
@@ -39,6 +39,13 @@
3939
4040 #include "cyglib.h"
4141
42+//#define CYGWIN 1
43+//#define MSYS2 1
44+
45+#if !defined(CYGWIN) && !defined(MSYS2)
46+#define CYGWIN 1
47+#endif
48+
4249 /**
4350 * cygwin1.dllを探す
4451 *
@@ -54,7 +61,7 @@
5461 wchar_t file[MAX_PATH];
5562 wchar_t *filename;
5663 wchar_t c;
57-#if 1
64+#if CYGWIN
5865 const wchar_t *dll_base = L"cygwin1";
5966 const wchar_t *search_paths[] = {
6067 L"%c:\\cygwin\\bin",
@@ -62,7 +69,7 @@
6269 NULL,
6370 };
6471 #endif
65-#if 0
72+#if MSYS2
6673 const wchar_t *dll_base = L"msys-2.0";
6774 const wchar_t *search_paths[] = {
6875 L"%c:\\msys\\usr\\bin",
@@ -212,10 +219,13 @@
212219 wchar_t *ExeDirW;
213220 wchar_t *cygterm_cmd;
214221 DWORD e;
222+#if CYGWIN
215223 const wchar_t *cygterm_exe = L"cygterm.exe";
216-// const wchar_t *cygterm_exe = L"msys2term.exe";
224+#endif
225+#if MSYS2
226+ const wchar_t *cygterm_exe = L"msys2term.exe";
227+#endif
217228
218-// CygwinDirectory = NULL;
219229 find_cygwin = CygwinSearchDLL(CygwinDirectory, &find_dir, &find_in_path);
220230 if (find_cygwin == FALSE) {
221231 return ERROR_FILE_NOT_FOUND;
--- trunk/cygwin/cygterm/CMakeLists.txt (revision 9518)
+++ trunk/cygwin/cygterm/CMakeLists.txt (revision 9519)
@@ -1,12 +1,21 @@
1-option(MSYS2TERM "msys2term" OFF)
1+cmake_minimum_required(VERSION 3.11)
22
3+message("CMAKE_COMMAND=${CMAKE_COMMAND}")
4+message("CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
5+message("CMAKE_HOST_SYSTEM_NAME=${CMAKE_HOST_SYSTEM_NAME}")
6+if(${CMAKE_HOST_SYSTEM_NAME} MATCHES "MSYS")
7+ message("MSYS2TERM=ON")
8+ set(MSYS2TERM ON)
9+endif()
10+
311 if (MSYS2TERM)
412 set(PACKAGE_NAME "msys2term")
513 else()
614 set(PACKAGE_NAME "cygterm")
715 endif()
16+
17+project(${PACKAGE_NAME})
818 ENABLE_LANGUAGE(RC)
9-project(${PACKAGE_NAME})
1019
1120 add_executable(
1221 ${PACKAGE_NAME}
@@ -14,7 +23,38 @@
1423 cygterm.rc
1524 )
1625
17-set_source_files_properties(
18- cygterm.cc
19- PROPERTIES COMPILE_FLAGS "-D_GNU_SOURCE -fno-exceptions"
20-)
26+if (MSYS2TERM)
27+ target_compile_definitions(
28+ ${PACKAGE_NAME}
29+ PRIVATE
30+ MSYS2=1
31+ )
32+else()
33+ target_compile_definitions(
34+ ${PACKAGE_NAME}
35+ PRIVATE
36+ CYGWIN=1
37+ )
38+endif()
39+
40+target_compile_options(
41+ ${PACKAGE_NAME}
42+ PRIVATE
43+ -D_GNU_SOURCE
44+ -fno-exceptions
45+ )
46+
47+target_link_options(
48+ ${PACKAGE_NAME}
49+ PRIVATE
50+ -mwindows
51+ )
52+
53+install(
54+ TARGETS ${PACKAGE_NAME}
55+ DESTINATION .
56+ )
57+install(
58+ FILES ${PACKAGE_NAME}.cfg
59+ DESTINATION .
60+ )
--- trunk/cygwin/cygterm_build/CMakeLists.txt (nonexistent)
+++ trunk/cygwin/cygterm_build/CMakeLists.txt (revision 9519)
@@ -0,0 +1,44 @@
1+
2+add_custom_target(
3+ cygterm_build ALL
4+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/build_mark.txt
5+ )
6+
7+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygterm_build)
8+
9+add_custom_command(
10+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build_mark.txt
11+ COMMAND ${CMAKE_COMMAND} -E echo ${CMAKE_BINARY_DIR}/$<CONFIG>
12+ COMMAND ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/$<CONFIG> -P ${CMAKE_CURRENT_LIST_DIR}/../cygterm/build_cygterm.cmake
13+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/build_mark.txt
14+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygterm_build
15+ )
16+
17+install(
18+ FILES
19+ ${CMAKE_BINARY_DIR}/$<CONFIG>/cygterm_x86_64/cygterm.exe
20+ ${CMAKE_BINARY_DIR}/$<CONFIG>/cygterm_x86_64/cygterm.cfg
21+ DESTINATION cygterm_x86_64
22+ OPTIONAL
23+ )
24+install(
25+ FILES
26+ ${CMAKE_BINARY_DIR}/$<CONFIG>/cygterm_x86_64/cygterm.exe
27+ ${CMAKE_BINARY_DIR}/$<CONFIG>/cygterm_x86_64/cygterm.cfg
28+ DESTINATION .
29+ OPTIONAL
30+ )
31+install(
32+ FILES
33+ ${CMAKE_BINARY_DIR}/$<CONFIG>/cygterm_i686/cygterm.exe
34+ ${CMAKE_BINARY_DIR}/$<CONFIG>/cygterm_i686/cygterm.cfg
35+ DESTINATION cygterm_i686
36+ OPTIONAL
37+ )
38+install(
39+ FILES
40+ ${CMAKE_BINARY_DIR}/$<CONFIG>/msys2term.exe
41+ ${CMAKE_BINARY_DIR}/$<CONFIG>/msys2term.cfg
42+ DESTINATION .
43+ OPTIONAL
44+ )
--- trunk/cygwin/cygtool_build/CMakeLists.txt (nonexistent)
+++ trunk/cygwin/cygtool_build/CMakeLists.txt (revision 9519)
@@ -0,0 +1,20 @@
1+
2+add_custom_target(
3+ cygtool_build ALL
4+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/build_mark.txt
5+ )
6+
7+file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygtool_build)
8+
9+add_custom_command(
10+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build_mark.txt
11+ COMMAND ${CMAKE_COMMAND} -DCMAKE_GENERATOR=${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/$<CONFIG> -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE} -P ${CMAKE_CURRENT_LIST_DIR}/../cygtool/build_cygtool.cmake
12+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/build_mark.txt
13+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cygtool_build
14+ COMMENT Generate "${CMAKE_CURRENT_BINARY_DIR}/cygtool.dll"
15+ )
16+
17+install(
18+ FILES ${CMAKE_BINARY_DIR}/$<CONFIG>/cygtool.dll
19+ DESTINATION .
20+ )
Show on old repository browser