Watcom: Cleanup Windows-wcl386 configuration

* Remove Watcom linker caseexact options already defined in system
  definition.
* Use win_dll system for SHARED_LIBRARY and SHARED_MODULE.
* Use explicit target definition -bt=.. option for proper initialization
  of compiler Windows environment (predefined macros)
* Reorganize compiler options to global options and configuration
  specific options
* Use option to optimize out stack checking code for release version
This commit is contained in:
Jiri Malak 2014-04-01 21:20:41 +02:00 committed by Brad King
parent 5ada4be81b
commit 1e22b23c81
1 changed files with 27 additions and 23 deletions

View File

@ -12,13 +12,15 @@ else()
set(CMAKE_LIB_QUIET "-q") set(CMAKE_LIB_QUIET "-q")
endif() endif()
set(CMAKE_EXE_LINKER_FLAGS_INIT)
set(CMAKE_CREATE_WIN32_EXE "system nt_win" ) set(CMAKE_CREATE_WIN32_EXE "system nt_win" )
set(CMAKE_CREATE_CONSOLE_EXE "system nt" ) set(CMAKE_CREATE_CONSOLE_EXE "system nt" )
set(CMAKE_SHARED_LINKER_FLAGS_INIT "system nt_dll")
set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "debug all" ) set(CMAKE_MODULE_LINKER_FLAGS_INIT "system nt_dll")
set (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT "debug all" ) foreach(type SHARED MODULE EXE)
set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) set(CMAKE_${type}_LINKER_FLAGS_DEBUG_INIT "debug all opt map, symfile")
set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all" ) set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO_INIT "debug all opt map, symfile")
endforeach()
set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list set(CMAKE_C_COMPILE_OPTIONS_DLL "-bd") # Note: This variable is a ';' separated list
set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string. set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated string.
@ -26,18 +28,18 @@ set(CMAKE_SHARED_LIBRARY_C_FLAGS "-bd") # ... while this is a space separated st
set(CMAKE_RC_COMPILER "rc" ) set(CMAKE_RC_COMPILER "rc" )
set(CMAKE_BUILD_TYPE_INIT Debug) set(CMAKE_BUILD_TYPE_INIT Debug)
set (CMAKE_CXX_FLAGS_INIT "-w=3 -xs")
set (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") # single/multi-threaded /-bm
set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") # static/DLL run-time libraries /-br
set (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") # default is setup for multi-threaded + DLL run-time libraries
set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") set (CMAKE_C_FLAGS_INIT "-bt=nt -w3 -dWIN32 -br -bm")
set (CMAKE_C_FLAGS_INIT "-w=3 ") set (CMAKE_CXX_FLAGS_INIT "-bt=nt -xs -w3 -dWIN32 -br -bm")
set (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -d2 -od") foreach(lang C CXX)
set (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") set (CMAKE_${lang}_FLAGS_DEBUG_INIT "-d2")
set (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") set (CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-s -os -d0 -dNDEBUG")
set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") set (CMAKE_${lang}_FLAGS_RELEASE_INIT "-s -ot -d0 -dNDEBUG")
set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib") set (CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-s -ot -d1 -dNDEBUG")
set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") endforeach()
foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE) foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1) set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1)
@ -49,29 +51,29 @@ set(CMAKE_C_CREATE_IMPORT_LIBRARY
set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY}) set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
set(CMAKE_C_LINK_EXECUTABLE set(CMAKE_C_LINK_EXECUTABLE
"wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) set(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE})
# compile a C++ file into an object file # compile a C++ file into an object file
set(CMAKE_CXX_COMPILE_OBJECT set(CMAKE_CXX_COMPILE_OBJECT
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
# compile a C file into an object file # compile a C file into an object file
set(CMAKE_C_COMPILE_OBJECT set(CMAKE_C_COMPILE_OBJECT
"<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
# preprocess a C source file # preprocess a C source file
set(CMAKE_C_CREATE_PREPROCESSED_SOURCE set(CMAKE_C_CREATE_PREPROCESSED_SOURCE
"<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc <SOURCE>${CMAKE_END_TEMP_FILE}")
# preprocess a C++ source file # preprocess a C++ source file
set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE
"<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -d+ <DEFINES> -fo<PREPROCESSED_SOURCE> -pl -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_CREATE_SHARED_LIBRARY set(CMAKE_CXX_CREATE_SHARED_LIBRARY
"wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name '<TARGET_UNQUOTED>' <LINK_FLAGS> option implib=<TARGET_IMPLIB> file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
string(REPLACE " option implib=<TARGET_IMPLIB>" "" string(REPLACE " option implib=<TARGET_IMPLIB>" ""
CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") CMAKE_CXX_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_LIBRARY}")
@ -91,8 +93,10 @@ if(NOT _CMAKE_WATCOM_VERSION)
set(_CMAKE_WATCOM_VERSION 1) set(_CMAKE_WATCOM_VERSION 1)
if(CMAKE_C_COMPILER_VERSION) if(CMAKE_C_COMPILER_VERSION)
set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) set(_compiler_version ${CMAKE_C_COMPILER_VERSION})
set(_compiler_id ${CMAKE_C_COMPILER_ID})
else() else()
set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION})
set(_compiler_id ${CMAKE_CXX_COMPILER_ID})
endif() endif()
set(WATCOM16) set(WATCOM16)
set(WATCOM17) set(WATCOM17)