当前位置: 首页 > news >正文

Windows下编译SALOME

本文以笔记的形式记录在Windows下编译SALOME的流程。

零、环境

操作系统WIndows 10
Visual StudioVisual Studio 2022 Community
Visual Studio Code1.92.1
CMakeCMake-3.24.2

一、工具及依赖

 1.1 VS Code

下载并安装Visual Studio Code, 同时安装以下插件,

Task Explorer

Output Colorizer

Git Extension Pack

Git Graph

Remote Developement

Remote X11

Code Runner

Modern Fortran

FORTRAN InstelliSense

Fortran Breakpoint Support

C/C++ Extension Pack

C++ TestMate

Python Extension Pack
C# Dev Kit
Extension Pack for Intel Software Developer Tools
Nsight Visual Studio Code Edition

1.2 VCPKG

下载vcpkg到D:\,并完成配置

git clone https://github.com/Microsoft/vcpkg.git
cd D:\vcpkg
mkdir D:\vcpkg\binary-cache
mkdir D:\vcpkg\asset-cache
set "VCPKG_BINARY_SOURCES=clear;files,D:\vcpkg\binary-cache,readwrite"
set "X_VCPKG_ASSET_SOURCES=clear;x-azurl,file://D:/vcpkg/asset-cache,,readwrite"
bootstrap-vcpkg.bat

 注意:限于从国外网站下载速度较慢,考虑使用代理,

set "HTTP_PROXY=http://192.168.X.X:7890"
set "HTTPS_PROXY=http://192.168.X.X:7890"

通过vcpkg可以方便的安装第三方库,常用命令如下表

安装packagevcpkg install <package-name>
搜索packagevcpkg search <package-name>
已安装packagevcpkg list

然后,按照下表安装第三方依赖库

PackageDescription
pythonvcpkg install python3
pthreadvcpkg install pthread
cppunitvcpkg install cppunit
boostvcpkg install boost
qt
occ
vtk

二、下载SALOME

由于SALOME每个模块采用了单独的Git仓库进行代码托管,因此,需要手动下载SALOME相关模块。

新建fetch-salome.sh文件,并添加以下内容,

git clone https://github.com/SalomePlatform/.github.git
git clone https://github.com/SalomePlatform/adao.git
git clone https://github.com/SalomePlatform/adao_interface.git
git clone https://github.com/SalomePlatform/blsurfplugin.git
git clone https://github.com/SalomePlatform/calculator.git
git clone https://github.com/SalomePlatform/common_geometry_lib.git
git clone https://github.com/SalomePlatform/component.git
git clone https://github.com/SalomePlatform/configuration.git
git clone https://github.com/SalomePlatform/datafiles.git
git clone https://github.com/SalomePlatform/documentation.git
git clone https://github.com/SalomePlatform/eficas.git
git clone https://github.com/SalomePlatform/eficas_tools.git
git clone https://github.com/SalomePlatform/geom.git
git clone https://github.com/SalomePlatform/ghs3dplugin.git
git clone https://github.com/SalomePlatform/gmshplugin.git
git clone https://github.com/SalomePlatform/gui.git
git clone https://github.com/SalomePlatform/hello.git
git clone https://github.com/SalomePlatform/hexablock.git
git clone https://github.com/SalomePlatform/hexablockplugin.git
git clone https://github.com/SalomePlatform/hexoticplugin.git
git clone https://github.com/SalomePlatform/homard.git
git clone https://github.com/SalomePlatform/hybridplugin.git
git clone https://github.com/SalomePlatform/jobmanager.git
git clone https://github.com/SalomePlatform/kernel.git
git clone https://github.com/SalomePlatform/libbatch.git
git clone https://github.com/SalomePlatform/med.git
git clone https://github.com/SalomePlatform/MEDCoupling_tutos.git
git clone https://github.com/SalomePlatform/medreader.git
git clone https://github.com/SalomePlatform/medcoupling.git
git clone https://github.com/SalomePlatform/meshbooleanplugin.git
git clone https://github.com/SalomePlatform/mmgplugin.git
git clone https://github.com/SalomePlatform/netgenplugin.git
git clone https://github.com/SalomePlatform/openturns_salome.git
git clone https://github.com/SalomePlatform/paravis.git
git clone https://github.com/SalomePlatform/paravisaddons_common.git
git clone https://github.com/SalomePlatform/pmml.git
git clone https://github.com/SalomePlatform/py2cpp.git
git clone https://github.com/SalomePlatform/pycalculator.git
git clone https://github.com/SalomePlatform/pyhello.git
git clone https://github.com/SalomePlatform/SALOME.git
git clone https://github.com/SalomePlatform/salome_bootstrap.git
git clone https://github.com/SalomePlatform/sat.git
git clone https://github.com/SalomePlatform/sat_salome.git
git clone https://github.com/SalomePlatform/shaper.git
git clone https://github.com/SalomePlatform/shaper_study.git
git clone https://github.com/SalomePlatform/smesh.git
git clone https://github.com/SalomePlatform/solverlab.git
git clone https://github.com/SalomePlatform/top_ii_vol.git
git clone https://github.com/SalomePlatform/yacs.git
git clone https://github.com/SalomePlatform/yacsgen.git
git clone https://github.com/SalomePlatform/ydefx.git

在fetch-salome.sh所在目录,右键启动Git Bash,然后运行上述脚本,下载相关模块代码,

sh ./fetch-salome.sh

注1:国内访问GitHub需要通过'https_proxy'环境变量设置网络代理。

export https_proxy=http://X.X.X.X:7890

三、编译salome_bootstrap

3.1 CMake配置

VariableValue
ABS_APPLI_PATHD:/YouQuan/CaeFrameworks/SALOME/VS2022SALOMEBOOTSTRAP
WRAP_PYTHONOFF
PYTHON_EXECUTABLED:/vcpkg/installed/x64-windows/tools/python3/python.exe

四、编译kernel

4.1 CMake配置

VariableValue
CMAKE_INSTALL_PREFIXD:/YouQuan/CaeFrameworks/SALOME/VS2022KERNEL
SALOME_LIGHT_ONLYON
SALOME_BUILD_TESTSOFF
SALOME_BUILD_DOCOFF
PTHREAD_LIBRARIES
OMNIORB_ROOT_DIR
OMNIORB_LIBRARY_COS4
OMNIORB_LIBRARY_COSDynamic4
OMNIORB_LIBRARY_omniDynamic4
OMNIORB_LIBRARY_omniORB4
OMNIORB_LIBRARY_omnithread
CPPUNIT_LIBRARIES

五、编译gui

5.1 CMake配置

VariableValue
CMAKE_INSTALL_PREFIXD:/YouQuan/CaeFrameworks/SALOME/VS2022/GUI

附录Ⅰ:VS2022.bat

新建"D:\YouQuan\CaeFrameworks\SALOME\SOURCES\VS2022.bat"文件,添加以下内容,

@echo off

:: SALOME SOURCES Root
set SALOME_SRCS_ROOT=%cd%
:: VCPKG Root
set VCPKG_ROOT=D:/vcpkg
:: Path to toolchain file supplied to CMake
set CMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%/scripts/buildsystems/vcpkg.cmake

set INCLUDE=%VCPKG_ROOT%/installed/x64-windows/include;%INCLUDE%
set LIB=%VCPKG_ROOT%/installed/x64-windows/debug/lib;%LIB%
:: Add the path of your MinGW-w64 bin folder to the Windows PATH environment variable
set PATH=%VCPKG_ROOT%/installed/x64-windows/debug/bin;%PATH%

:: Packages
set PYTHON_ROOT_DIR=%VCPKG_ROOT%/installed/x64-windows
::set PYTHONINTERP_ROOT_DIR=%VCPKG_ROOT%/installed/x64-windows
set PTHREAD_ROOT_DIR=%VCPKG_ROOT%/installed/x64-windows
set CPPUNIT_ROOT_DIR=%VCPKG_ROOT%/installed/x64-windows
set BOOST_ROOT_DIR=%VCPKG_ROOT%/installed/x64-windows

:: Modules
set CONFIGURATION_ROOT_DIR=%cd%/configuration
set CPPUNIT_ROOT_DIR=%MinGW64_ROOT%

:: Open VS Code in the current working folder
code .vscode/salome.code-workspace

 附录Ⅱ: VS Code Multi-root workspaces

新建"D:\YouQuan\CaeFrameworks\SALOME\SOURCES\.vscode\salome.code-workspace"文件,添加以下内容,

{
	"folders": [
		{
			"path": "../configuration"
		},
		{
			"path": "../.github"
		},
		{
			"path": "../adao"
		},
		{
			"path": "../adao_interface"
		},
		{
			"path": "../blsurfplugin"
		},
		{
			"path": "../calculator"
		},
		{
			"path": "../common_geometry_lib"
		},
		{
			"path": "../component"
		},
		{
			"path": "../datafiles"
		},
		{
			"path": "../documentation"
		},
		{
			"path": "../eficas"
		},
		{
			"path": "../eficas_tools"
		},
		{
			"path": "../geom"
		},
		{
			"path": "../ghs3dplugin"
		},
		{
			"path": "../gmshplugin"
		},
		{
			"path": "../gui"
		},
		{
			"path": "../hello"
		},
		{
			"path": "../hexablock"
		},
		{
			"path": "../hexablockplugin"
		},
		{
			"path": "../hexoticplugin"
		},
		{
			"path": "../homard"
		},
		{
			"path": "../hybridplugin"
		},
		{
			"path": "../jobmanager"
		},
		{
			"path": "../kernel"
		},
		{
			"path": "../libbatch"
		},
		{
			"path": "../med"
		},
		{
			"path": "../medcoupling"
		},
		{
			"path": "../MEDCoupling_tutos"
		},
		{
			"path": "../medreader"
		},
		{
			"path": "../meshbooleanplugin"
		},
		{
			"path": "../mmgplugin"
		},
		{
			"path": "../netgenplugin"
		},
		{
			"path": "../openturns_salome"
		},
		{
			"path": "../paravis"
		},
		{
			"path": "../paravisaddons_common"
		},
		{
			"path": "../pmml"
		},
		{
			"path": "../py2cpp"
		},
		{
			"path": "../pycalculator"
		},
		{
			"path": "../pyhello"
		},
		{
			"path": "../SALOME"
		},
		{
			"path": "../salome_bootstrap"
		},
		{
			"path": "../sat"
		},
		{
			"path": "../sat_salome"
		},
		{
			"path": "../shaper"
		},
		{
			"path": "../shaper_study"
		},
		{
			"path": "../smesh"
		},
		{
			"path": "../solverlab"
		},
		{
			"path": "../top_ii_vol"
		},
		{
			"path": "../yacs"
		},
		{
			"path": "../yacsgen"
		},
		{
			"path": "../ydefx"
		},
		{
			"path": "."
		}
	],
	"settings": {}
}

附录Ⅲ: c_cpp_properties.json

新建"D:\YouQuan\CaeFrameworks\SALOME\SOURCES\.vscode\c_cpp_properties.json"文件,添加以下内容,

{
    "configurations": [
        {
            "name": "MSVC",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [
                "_DEBUG",
                "UNICODE",
                "_UNICODE"
            ],
            "windowsSdkVersion": "10.0.19041.0",
            "compilerPath": "cl.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-msvc-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        },
        {
            "name": "MinGW-w64",
            "includePath": [
                "${workspaceFolder}/**",
                "D:/msys64/mingw64/include"
            ],
            "defines": [],
            "compilerPath": "D:/msys64/mingw64/bin/g++.exe",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "windows-gcc-x64",
            "configurationProvider": "ms-vscode.cmake-tools",
            "compilerPathInCppPropertiesJson": "D:/msys64/mingw64/bin/g++.exe",
            "configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools",
            "mergeConfigurations": false,
            "browse": {
                "path": [
                    "D:/msys64/mingw64/include",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true
            }
        },
        {
            "name": "Mac",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "macFrameworkPath": [
                "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
            ],
            "compilerPath": "/usr/bin/clang",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "macos-clang-arm64"
        },
        {
            "name": "Linux-GCC",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/g++",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "gcc-x64",
            "browse": {
                "path": [
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": true,
                "databaseFilename": ""
            }
        }
    ],
    "version": 4
}

附录Ⅳ: cmake-kits.json

新建"D:\YouQuan\CaeFrameworks\SALOME\SOURCES\.vscode\cmake-kits.json"文件,添加以下内容,

[
    {
        "name": "MinGW-64",
        "compilers": {
            "C": "D:\\msys64\\mingw64\\bin\\gcc.exe",
            "CXX": "D:\\msys64\\mingw64\\bin\\g++.exe"
        },
        "isTrusted": true,
        "environmentVariables": {
            "CMT_MINGW_PATH": "C:\\msys64\\mingw64\\bin",
            "MSYSTEM": "MINGW64",
            "MSYSTEM_PREFIX": "/mingw64",
            "PATH": "D:\\msys64\\mingw64\\bin;D:\\msys64\\usr\\bin;${env:PATH}"
        },
        "preferredGenerator": {
            "name": "MinGW Makefiles"
        }
    },
    {
        "name": "GCC 11.4.0 x86_64-linux-gnu",
        "compilers": {
            "C": "/usr/bin/gcc",
            "CXX": "/usr/bin/g++"
        },
        "isTrusted": true
    },
    {
        "name": "Intel(R) oneAPI DPC++/C++ Compiler 2024.2.1",
        "compilers": {
            "C": "/opt/intel/oneapi/compiler/2024.2/bin/icx",
            "CXX": "/opt/intel/oneapi/compiler/2024.2/bin/icpx"
        },
        "isTrusted": true
    }

附录V: CMakeUserPresets.json

新建"D:\YouQuan\CaeFrameworks\SALOME\SOURCES\CMakeUserPresets.json"文件,添加以下内容,

{
    "version": 4,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 20,
        "patch": 0
    },
    "configurePresets": [
        {
            "name": "mingw64",
            "hidden": false,
            "displayName": "MinGW-w64",
            "description": "This build is using MinGW generator",
            "generator": "MinGW Makefiles",
			"binaryDir": "${sourceDir}/out/build/${presetName}",
            "cacheVariables": {
				"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",                
				"CMAKE_BUILD_TYPE": "Debug"
            },
            "environment": {
            }
        },
        {
            "name": "linux_gcc",
            "hidden": false,
            "displayName": "Linux GCC",
            "description": "Default build using Unix Makefiles generator",
            "generator": "Unix Makefiles",
            "binaryDir": "${sourceDir}/out/build/${presetName}",
            "cacheVariables": {
                "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}",
                "CMAKE_C_COMPILER": "/usr/bin/gcc",
                "CMAKE_CXX_COMPILER": "/usr/bin/g++",
                "CMAKE_MAKE_PROGRAM": "/usr/bin/make",
                "CMAKE_BUILD_TYPE": "Debug"
            },
            "environment": {
            }
        }
    ],
    "buildPresets": [
        {
            "name": "mingw64",
            "displayName": "MinGW-w64",
            "configurePreset": "mingw64"
        },
        {
            "name": "linux_gcc",
            "displayName": "Linux GCC",
            "configurePreset": "linux_gcc"
        }
    ],
    "testPresets": [
        {
            "name": "mingw64",
            "displayName": "MinGW-w64",
            "configurePreset": "mingw64"
        },
        {
            "name": "linux_gcc",
            "displayName": "Linux GCC",
            "configurePreset": "linux_gcc"
        }
    ]
}

 参考资料

SALOME

VS Code Multi-root workspaces

相关文章:

  • spm12_fMRI 2*4混合方差分析 Flexible factorial 对比矩阵
  • 多模态大语言模型arxiv论文略读(十)
  • vue3 history路由模式刷新页面报错问题解决
  • 华宇TAS应用中间件与联奕科技多款软件产品完成兼容互认证
  • 机场跑道异物检测数据集VOC+YOLO格式33793张31类别
  • 位运算与实战场景分析-Java代码版
  • Ubuntu搭建Pytorch环境
  • 操作系统 4.4-从生磁盘到文件
  • 无法读取库伦值文件节点解决方案
  • 项目周期过长,如何拆分里程碑
  • 基于STM32 的实时FFT处理(Matlab+MDK5)
  • UE5 Lyra Experience控件模式详解
  • 主流时序数据库深度对比:TDengine、InfluxDB与IoTDB的技术特性、性能及选型考量
  • 【黑客帝国连接虚拟与现实:数据采集系统(DAQ)硬核技术深度解析】
  • 静态链接part1
  • 图像融合(Image Fusion)是什么
  • Linux网络之局域网yum仓库与apt的实现
  • 算法中的数论基础
  • 客运从业资格证适用哪些岗位
  • Linux 多线程编程实战指南
  • 做垃圾网站怎么赚钱/不死鸟分享友情链接
  • 宜昌优化网站建设/2022年最火的电商平台
  • 运城建网站/广东省广州市佛山市
  • 网站设计制作规范/搜索网站哪个好
  • 大连网站建设招聘网/微博推广价格表
  • 网站优化与SEO区别/dw网页制作教程