Closed limska closed 1 month ago
A potential fix would be to replace HiGHS/CMakeLists.txt:355:
if(NOT MSVC)
install(FILES ${HIGHS_BINARY_DIR}/modules/highs_fortran_api.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/highs/fortran)
else()
install(FILES ${HIGHS_BINARY_DIR}/modules/${CMAKE_BUILD_TYPE}/highs_fortran_api.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/highs/fortran)
endif()
with just:
install(FILES ${HIGHS_BINARY_DIR}/modules/highs_fortran_api.mod DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/highs/fortran)
Thank you @limska, I will give it a go
When I try to build on my Windows mahcine, I get similar results with powershell and the newly installed intel oneAPI shell. However, the intel oneAPI shell on my machine also starts with PS, and yours does not, which shell are you using?
By default, with MSVC, the Debug config is built. To get release code, the config must be specified with
cmake --build build --config Release
or
cmake --build build --config Release --parallel
for parallel build.
It is curious why in your build the path to the Highs lib and exe is not in a Debug or Release subdir.
The reason we have separated the cases is that MSVC specifies the build type on cmake --build
, rather than on the CMake generation step with -DCMAKE_BUILD_TYPE
, like on unix.
I did get a couple of errors, the first one saying
CMake Error: CMake can not determine linker language for target: fortrantest
which is fixed by specifying the linker language in cmake: see branch fortran-win
and
CMake Error at C:/Users/galab/code/HiGHS/build/cmake_install.cmake:60 (file): file INSTALL cannot find "C:/Users/galab/code/HiGHS/build/bin/Release/highs.dll": File exists.
which is fixed by adding the --config Release
flag, because the default config is Debug.
So, using cpack, after installing NSIS which we had not used so far and was missing, I get
PS C:\Users\galab\code\HiGHS> cmake -S . -B build -DFORTRAN=ON
...
PS C:\Users\galab\code\HiGHS> cpack --config build/CPackConfig.cmake
CPack: Create package using NSIS
CPack: Install projects
CPack: - Install project: HIGHS []
CPack: Create package
CPack: - package: C:/Users/galab/code/HiGHS/HIGHS-1.7.2-win64.exe generated.
Do you use any custom settings anywhere? Is your oneAPI integrated with Visual Studio? Are you using MSVC to build? Perhaps you need to specify the generator for CMake, depending on your configuration.
What happens if you try to specify --config Release
at cmake --build
?
Could you share a CMake log, so I can see more details about your setup, possibly the file generated at
build\CMakeFiles\CMakeConfigureLog.yaml
@galabovaa I used Windows command prompt because I had issues with oneAPI and PowerShell. I tried again but this time I specified Release at all 3 stages and the packaging worked as follows:
C:\Users\sava.slijepcevic\repos\public\HiGHS>cmake --build build --config Release
...
cmake --build build --config Release
...
C:\Users\sava.slijepcevic\repos\public\HiGHS>cpack --config build/CPackConfig.cmake -C Release
...
Sorry, looks like this is not a bug after all.
Description
The packaging is looking for file in build/modules/Debug/highs_fortran_api.mod instead of build/modules/highs_fortran_api.mod. The fix is to treat installation the same for MSVC and non MSVC in src/CMakeLists.txt:355.
Steps to reproduce
Using: cmake 3.28.3, Intel oneAPI 2024.0