Skip to content

Commit

Permalink
fix for precompiled header msvc build
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22034 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
niklwors committed Aug 28, 2014
1 parent cbaeb87 commit 47ae17a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 2 additions & 1 deletion Compiler/Template/CodegenCpp.tpl
Expand Up @@ -7,6 +7,7 @@ import CodegenUtil.*;




template translateModel(SimCode simCode, Boolean useFlatArrayNotation) ::=
match simCode
case SIMCODE(modelInfo = MODELINFO(__)) then
Expand Down Expand Up @@ -1362,7 +1363,7 @@ case SIMCODE(modelInfo=MODELINFO(__), makefileParams=MAKEFILE_PARAMS(__), simula
!IF "$(PCH_FILE)" == ""
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/Core/" /I"<%makefileParams.omhome%>/include/omc/cpp/" -I. <%makefileParams.includes%> -I"$(BOOST_INCLUDE)" /I. /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY
!ELSE
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/Core/" /I"<%makefileParams.omhome%>/include/omc/cpp/" -I. <%makefileParams.includes%> -I"$(BOOST_INCLUDE)" /I. /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY /Fp<%makefileParams.omhome%>/include/omc/cpp/$(PCH_FILE) /Yu$(H_FILE)
CFLAGS= $(SYSTEM_CFLAGS) /I"<%makefileParams.omhome%>/include/omc/cpp/Core/" /I"<%makefileParams.omhome%>/include/omc/cpp/" -I. <%makefileParams.includes%> -I"$(BOOST_INCLUDE)" /I. /DNOMINMAX /TP /DNO_INTERACTIVE_DEPENDENCY /Fp<%makefileParams.omhome%>/include/omc/cpp/Core/$(PCH_FILE) /YuCore/$(H_FILE)
!ENDIF
CPPFLAGS =
# /ZI enable Edit and Continue debug info
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/CMakeLists.txt
Expand Up @@ -17,10 +17,10 @@
cmake_minimum_required (VERSION 2.6)
project(CppSolverInterface)

IF(NOT ANALYZATION_MODE AND NOT MSVC)
IF(NOT ANALYZATION_MODE)
#Precompiled header produces problems if the compiler is not "g++" but "scorep g++"
include(${CMAKE_SOURCE_DIR}/PrecompiledHeader.cmake)
ENDIF(NOT ANALYZATION_MODE AND NOT MSVC)
ENDIF(NOT ANALYZATION_MODE )
#set(CMAKE_VERBOSE_MAKEFILE ON)

option(ANALYZATION_MODE "ANALYZATION_MODE" OFF)
Expand Down
4 changes: 2 additions & 2 deletions SimulationRuntime/cpp/Core/Modelica/CMakeLists.txt
Expand Up @@ -117,9 +117,9 @@ foreach(lib ${LAPACK_LIBRARIES})
endforeach(lib ${LAPACK_LIBRARIES})
#end Fix

IF(NOT ANALYZATION_MODE AND NOT MSVC)
IF(NOT ANALYZATION_MODE)
add_precompiled_header(${ModelicaName} Include/Core/Modelica.h )
ENDIF(NOT ANALYZATION_MODE AND NOT MSVC)
ENDIF(NOT ANALYZATION_MODE )

configure_file (
"ModelicaConfig.inc.in"
Expand Down
10 changes: 7 additions & 3 deletions SimulationRuntime/cpp/PrecompiledHeader.cmake
Expand Up @@ -64,15 +64,19 @@ SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_compiler_FLAGS}")

#only generate precompiled header in relase mode in debug mode precompiled header can not generated because of different pdb files
IF(CMAKE_BUILD_TYPE MATCHES RELEASE)
SET(PrecompiledBinary "${CMAKE_BINARY_DIR}/Core/Modelica.pch")
FOREACH(_source ${sources})
SET(PCH_COMPILE_FLAGS "")
IF(_source MATCHES \\.\(cc|cxx|cpp\)$)
GET_FILENAME_COMPONENT(_sourceWe ${_source} NAME_WE)
IF(_sourceWe STREQUAL ${_inputWe})
SET(PCH_COMPILE_FLAGS "${PCH_COMPILE_FLAGS} /Yc${_name}")
#SET(PCH_COMPILE_FLAGS "${PCH_COMPILE_FLAGS} /Yc ")
SET(PCH_COMPILE_FLAGS "${PCH_COMPILE_FLAGS} /Fp\"${PrecompiledBinary}\" /Yc")
SET(_sourceFound TRUE)
MESSAGE(STATUS "create pch: ${PCH_COMPILE_FLAGS}" )
ELSE(_sourceWe STREQUAL ${_inputWe})
SET(PCH_COMPILE_FLAGS "${PCH_COMPILE_FLAGS} /Yu${_name}")
SET(PCH_COMPILE_FLAGS "${PCH_COMPILE_FLAGS} /Fp\"${PrecompiledBinary}\" /YuCore/${_name}")
MESSAGE(STATUS "use pch: /FPCore/${_inputWe}.pch /Yu${_name}" )
IF(FORCEINCLUDE)
SET(PCH_COMPILE_FLAGS "${PCH_COMPILE_FLAGS} /FI${_name}")
ENDIF(FORCEINCLUDE)
Expand All @@ -85,7 +89,7 @@ MESSAGE(FATAL_ERROR "A source file for ${_inputWe} was not found. Required for M
ENDIF(NOT _sourceFound)
#copy pre compiled header file in installation directory
MESSAGE(STATUS "install pch: ${CMAKE_BINARY_DIR}/${_inputWe}.pch" )
install (FILES "${CMAKE_BINARY_DIR}/Core/Modelica/${_inputWe}.pch" DESTINATION include/omc/cpp/Core)
install (FILES "${CMAKE_BINARY_DIR}/Core/${_inputWe}.pch" DESTINATION include/omc/cpp/Core)
SET(PCH_FILE "${_inputWe}.pch")
SET(H_FILE "${_name}")
ENDIF(CMAKE_BUILD_TYPE MATCHES RELEASE)
Expand Down

0 comments on commit 47ae17a

Please sign in to comment.