Skip to content
Snippets Groups Projects
Commit a06019d3 authored by Boman Romain's avatar Boman Romain
Browse files

fix mingw build

parent 626f55d9
No related branches found
No related tags found
No related merge requests found
Pipeline #7190 passed
......@@ -59,7 +59,7 @@ IF(FEM_USE_MKL)
MESSAGE(STATUS "MKL_INCLUDE_DIRS=${MKL_INCLUDE_DIRS}")
# library (mkl_rt.so) searched using LIBRARY_PATH (Linux/macOS) or LIB (windows)
FIND_LIBRARY(MKL_LIBRARIES mkl_rt PATHS ENV LIBRARY_PATH)
IF(MSVC)
IF(MSVC OR MINGW)
# with MSVC+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
FIND_LIBRARY(INTEL_OPENMP libiomp5md)
MESSAGE(STATUS "INTEL_OPENMP=${INTEL_OPENMP}")
......
......@@ -8,9 +8,12 @@ ENDIF()
IF(FEM_USE_MKL)
TARGET_LINK_LIBRARIES(fem PUBLIC ${MKL_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(fem PUBLIC ${MKL_INCLUDE_DIRS})
# with MSVC+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
# with MSVC+MKL or MinGW+MKL, we must link to intel OpenMP so that we have only 1 OpenMP lib
IF(MSVC)
TARGET_LINK_OPTIONS(fem PUBLIC -NODEFAULTLIB:"vcomp" -NODEFAULTLIB:"vcompd")
TARGET_LINK_LIBRARIES(fem PUBLIC ${INTEL_OPENMP})
ENDIF()
IF(MINGW)
TARGET_LINK_LIBRARIES(fem PUBLIC ${INTEL_OPENMP})
ENDIF()
ENDIF()
\ No newline at end of file
@echo off
:: This file opens a terminal which allows you to compile the code with
:: a 64-bit mingw compiler
:: https://mingw-w64.org/
:: https://www.msys2.org/
::
:: HOW TO USE THIS FILE?
:: [check the PATHs below]
:: [run this file]
:: mkdir build
:: cd build
:: cmake ..
:: make
:: ctest
::
:: How to clean the "build" folder using cmd line?
:: cd build
:: rd /q /s .
:: MinGW on Windows
echo setting MinGW64 environment...
:: set the location of gmsh SDK / mingw compiler
set GMSHSDK=%~dp0..\lib\gmsh-sdk
set EIGEN=%~dp0..\lib\eigen
set COMPILERPATHS=C:\msys64\mingw64\bin;C:\mingw-w64\mingw64\bin
:: perform some tests...
IF NOT EXIST %GMSHSDK% (
ECHO - gmsh-sdk NOT found in %GMSHSDK%!!
PAUSE
EXIT /B
) ELSE (
ECHO - gmsh-sdk found in %GMSHSDK%.
)
IF NOT EXIST %EIGEN% (
ECHO - eigen NOT found in %EIGEN%!!
PAUSE
EXIT /B
) ELSE (
ECHO - eigen found in %EIGEN%.
)
FOR %%a IN (%COMPILERPATHS%) DO (
IF EXIST %%a (
ECHO - compiler found in %%a.
SET COMPILERPATH=%%a
) ELSE (
IF NOT DEFINED COMPILERPATH (
ECHO - compiler not found in %%a.
)
)
)
IF NOT DEFINED COMPILERPATH (
ECHO =^> compiler NOT found!
PAUSE
EXIT /B
)
set COMPILERPATH="C:\mingw-w64"
:: Intel MKL
set "INTELPATH=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.5.281\windows"
set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB%
set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE%
:: does not always work
@REM call %INTELPATH%\mkl\bin\mklvars.bat intel64 vs2019
:: where is gmsh.exe and gmsh-**.dll ?
set PATH=%GMSHSDK%\bin;%GMSHSDK%\lib;%PATH%
:: where is gmsh.h ?
set INCLUDE=%EIGEN%;%GMSHSDK%\include;%INCLUDE%
:: where is gmsh.lib ?
set LIB=%GMSHSDK%\lib;%LIB%
:: where is gmsh.py ? (required only if you want to use the python API)
set PYTHONPATH=%GMSHSDK%\lib;%PYTHONPATH%
:: add path to the compiler to the PATH
set PATH=%COMPILERPATH%;%PATH%
:: add current folder to PATH for cmake/make aliases
set PATH=%~dp0;%PATH%
:: clear local vars
set GMSHSDK=
set EIGEN=
set COMPILERPATHS=
set COMPILERPATH=
@REM set LIB=%INTELPATH%\mkl\lib\intel64_win;%INTELPATH%\compiler\lib\intel64_win;%LIB%
@REM set INCLUDE=%INTELPATH%\mkl\include;%INCLUDE%
call "%INTELPATH%\mkl\bin\mklvars.bat" intel64 vs2019
:: open terminal
:: set the environment of the MinGW compiler
CD /d "%~dp0"
CD ..
%comspec% /K
%comspec% /k "%COMPILERPATH%\mingw-w64.bat"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment