123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- function(eclipse_cdt4_generator_amendment _param_defs)
- message(" Eclipse CDT4 generator amendment mode:")
- if (${_param_defs} EQUAL 1)
- set(_work_mode "C and CXX includes, defines in .cproject without __cplusplus")
- message(" ${_work_mode}")
- message(" with project includes and defines")
- elseif (${_param_defs} EQUAL 2)
- set(_work_mode "C and CXX includes, defines in .cproject with __cplusplus")
- message(" ${_work_mode}")
- message(" with project includes and defines")
- elseif (${_param_defs} EQUAL 5)
- set(_work_mode "C and CXX includes, defines in Eclipse with project defines")
- message(" ${_work_mode}")
- else(${_param_defs} EQUAL 1)
- set(_work_mode "C and CXX includes, defines setting in Eclipse is the user task")
- message(" ${_work_mode}")
- endif(${_param_defs} EQUAL 1)
- set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/zephyr/include/generated/cmake_intdef.h)
- file(WRITE ${OUTPUT_FILE} "/* Generated by eclipse_cd4_generator_amendment.cmake */\n")
- file(APPEND ${OUTPUT_FILE} "/* The header contains the defines collected from the */\n")
- file(APPEND ${OUTPUT_FILE} "/* INTERFACE_COMPILE_DEFINITIONS target property */\n")
- file(APPEND ${OUTPUT_FILE} "/* corresponding to zephyr_interface */\n")
- get_target_property(_int_comp_def zephyr_interface INTERFACE_COMPILE_DEFINITIONS)
- foreach( d ${_int_comp_def} )
- string(REGEX MATCH "([A-Za-z_][A-Za-z0-9_]*) *=* *(.*) *$" _dummy "${d}")
- file(APPEND ${OUTPUT_FILE} "#define ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}\n")
- endforeach()
- if (${_work_mode} STREQUAL "C and CXX includes, defines in Eclipse with project defines")
- message("")
- message(" -------------------------------------------------------------------------")
- message(" Add the following two command line parameters:")
- message("")
- message(" -imacros ${CMAKE_BINARY_DIR}/zephyr/include/generated/cmake_intdef.h")
- message(" -imacros ${AUTOCONF_H}")
- message("")
- message(" to 'CDT cross GCC Built-in Compiler Settings' provider command definition")
- message(" -------------------------------------------------------------------------")
- message("")
- endif()
- if ( (${_work_mode} STREQUAL "C and CXX includes, defines in .settings - [EXPERIMENTAL]") OR
- (${_work_mode} STREQUAL "C and CXX includes, defines in .settings with project defines - [EXPERIMENTAL]") )
- set(OUTPUT_FILE ${CMAKE_BINARY_DIR}/.settings/language.settings.xml)
- file(WRITE ${OUTPUT_FILE} "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n")
- file(APPEND ${OUTPUT_FILE} "<project>\n")
- file(APPEND ${OUTPUT_FILE} "\t<configuration id=\"org.eclipse.cdt.core.default.config.1\" name=\"Configuration\">\n")
- file(APPEND ${OUTPUT_FILE} "\t\t<extension point=\"org.eclipse.cdt.core.LanguageSettingsProvider\">\n")
- file(APPEND ${OUTPUT_FILE} "\t\t\t<provider copy-of=\"extension\" id=\"org.eclipse.cdt.ui.UserLanguageSettingsProvider\"/>\n")
- file(APPEND ${OUTPUT_FILE} "\t\t\t<provider-reference id=\"org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider\" ref=\"shared-provider\"/>\n")
- file(APPEND ${OUTPUT_FILE} "\t\t\t<provider-reference id=\"org.eclipse.cdt.core.PathEntryScannerInfoLanguageSettingsProvider\" ref=\"shared-provider\"/>\n")
- if (${_work_mode} STREQUAL "C and CXX includes, defines in .settings with project defines - [EXPERIMENTAL]")
- file(APPEND ${OUTPUT_FILE} "\t\t\t<provider class=\"org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector\" console=\"false\" id=\"org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector\" keep-relative-paths=\"false\" name=\"Zephyr autoconf and SDK Compiler Settings\" parameter=\"${CROSS_COMPILE}\${COMMAND} \${FLAGS} -imacros ${CMAKE_BINARY_DIR}/zephyr/include/generated/cmake_intdef.h -imacros ${AUTOCONF_H} -E -P -v -dD "\${INPUTS}"\" store-entries-with-project=\"true\">\n")
- else ()
- file(APPEND ${OUTPUT_FILE} "\t\t\t<provider class=\"org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector\" console=\"false\" id=\"org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector\" keep-relative-paths=\"false\" name=\"Zephyr autoconf and SDK Compiler Settings\" parameter=\"${CROSS_COMPILE}\${COMMAND} \${FLAGS} -E -P -v -dD "\${INPUTS}"\" store-entries-with-project=\"true\">\n")
- endif ()
- file(APPEND ${OUTPUT_FILE} "\t\t\t\t<language-scope id=\"org.eclipse.cdt.core.gcc\"/>\n")
- file(APPEND ${OUTPUT_FILE} "\t\t\t\t<language-scope id=\"org.eclipse.cdt.core.g++\"/>\n")
- file(APPEND ${OUTPUT_FILE} "\t\t\t</provider>\n")
- file(APPEND ${OUTPUT_FILE} "\t\t</extension>\n")
- file(APPEND ${OUTPUT_FILE} "\t</configuration>\n")
- file(APPEND ${OUTPUT_FILE} "</project>\n")
- endif ()
- if ( (${_work_mode} STREQUAL "C and CXX includes, defines in .cproject without __cplusplus") OR
- (${_work_mode} STREQUAL "C and CXX includes, defines in .cproject with __cplusplus") OR
- (${_work_mode} STREQUAL "C and CXX includes, defines in .settings - [EXPERIMENTAL]") )
- if ( (${_work_mode} STREQUAL "C and CXX includes, defines in .cproject without __cplusplus") OR
- (${_work_mode} STREQUAL "C and CXX includes, defines in .cproject with __cplusplus") )
- if (${_work_mode} STREQUAL "C and CXX includes, defines in .cproject without __cplusplus")
-
- set(TEMP_VAR "${CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS}")
- STRING(REGEX REPLACE "__cplusplus;.*;" "" TEMP_VAR "${TEMP_VAR}")
- set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "${TEMP_VAR}" CACHE INTERNAL "CXX compiler system defined macros")
- endif()
- else()
-
- if (CMAKE_C_COMPILER_ID MATCHES GNU)
- set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_INCLUDE_DIRS "" CACHE INTERNAL "C compiler system include directories")
- set(CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "" CACHE INTERNAL "C compiler system defined macros")
- endif ()
-
- if ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU)
- set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_INCLUDE_DIRS "" CACHE INTERNAL "CXX compiler system include directories")
- set(CMAKE_EXTRA_GENERATOR_CXX_SYSTEM_DEFINED_MACROS "" CACHE INTERNAL "CXX compiler system defined macros")
- endif ()
- endif()
- file(STRINGS ${CMAKE_BINARY_DIR}/zephyr/include/generated/cmake_intdef.h _int_comp_def)
- set (_resultDefines "${CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS}")
- foreach( d ${_int_comp_def} )
- string(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*) *(.*) *$" _dummy "${d}")
- if (NOT ("${CMAKE_MATCH_1}" STREQUAL "") )
- list(APPEND _resultDefines "${CMAKE_MATCH_1}")
- if ("${CMAKE_MATCH_2}" STREQUAL "")
- list(APPEND _resultDefines "")
- else()
- list(APPEND _resultDefines "${CMAKE_MATCH_2}")
- endif()
- endif()
- endforeach()
- set (CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_resultDefines}" CACHE INTERNAL "C compiler system defined macros")
- file(STRINGS ${AUTOCONF_H} _auto_conf)
- set (_resultDefines "${CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS}")
- foreach( d ${_auto_conf} )
- string(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*) *(.*) *$" _dummy "${d}")
- if (NOT ("${CMAKE_MATCH_1}" STREQUAL "") )
- list(APPEND _resultDefines "${CMAKE_MATCH_1}")
- if ("${CMAKE_MATCH_2}" STREQUAL "")
- list(APPEND _resultDefines " ")
- else()
- list(APPEND _resultDefines "${CMAKE_MATCH_2}")
- endif()
- endif()
- endforeach()
- set (CMAKE_EXTRA_GENERATOR_C_SYSTEM_DEFINED_MACROS "${_resultDefines}" CACHE INTERNAL "C compiler system defined macros")
- endif()
- endfunction(eclipse_cdt4_generator_amendment _param_defs)
|