Skip to content

Commit

Permalink
Allow building fmusim with VisualStudio 2019 (#504)
Browse files Browse the repository at this point in the history
fixes #493
  • Loading branch information
t-sommer authored May 16, 2024
1 parent 8aca6f2 commit 069c79b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 15 deletions.
13 changes: 9 additions & 4 deletions build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@
choices={'x86-windows', 'x86_64-windows', 'x86_64-linux', 'aarch64-linux', 'x86_64-darwin', 'aarch64-darwin'},
help="Platform to build for, e.g. x86_64-windows"
)
parser.add_argument('--cmake-generator')
parser.add_argument(
'--cmake-generator',
choices={'Visual Studio 17 2022', 'Visual Studio 16 2019'},
default='Visual Studio 17 2022',
help="CMake generator for Windows"
)
args, _ = parser.parse_known_args()


Expand All @@ -38,12 +43,12 @@ def build_fmus(fmi_version, fmi_type=None):

if fmi_system == 'windows':

cmake_generator = 'Visual Studio 17 2022' if args.cmake_generator is None else args.cmake_generator
cmake_args += ['-G', args.cmake_generator]

if fmi_architecture == 'x86':
cmake_args += ['-G', cmake_generator, '-A', 'Win32']
cmake_args += ['-A', 'Win32']
elif fmi_architecture == 'x86_64':
cmake_args += ['-G', cmake_generator, '-A', 'x64']
cmake_args += ['-A', 'x64']

elif fmi_platform == 'aarch64-linux':

Expand Down
13 changes: 9 additions & 4 deletions build/build_cvode.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
choices={'x86-windows', 'x86_64-windows', 'x86_64-linux', 'aarch64-linux', 'x86_64-darwin', 'aarch64-darwin'},
help="Platform to build for, e.g. x86_64-windows"
)
parser.add_argument(
'--cmake-generator',
choices={'Visual Studio 17 2022', 'Visual Studio 16 2019'},
default='Visual Studio 17 2022',
help="CMake generator for Windows"
)
args, _ = parser.parse_known_args()

archive = download_file('https://github.com/LLNL/sundials/releases/download/v6.4.1/cvode-6.4.1.tar.gz',
Expand All @@ -33,16 +39,15 @@
if fmi_system == 'windows':

cmake_args = [
'-G', 'Visual Studio 17 2022',
'-G', args.cmake_generator,
'-D', 'CMAKE_C_FLAGS_RELEASE=/MT /O2 /Ob2 /DNDEBUG',
'-D', 'CMAKE_C_FLAGS_DEBUG=/MT /Zi /Ob0 /Od /RTC1',
'-A'
]

if fmi_architecture == 'x86':
cmake_args.append('Win32')
cmake_args += ['-A', 'Win32']
elif fmi_architecture == 'x86_64':
cmake_args.append('x64')
cmake_args += ['-A', 'x64']

elif fmi_platform == 'aarch64-linux':

Expand Down
13 changes: 9 additions & 4 deletions build/build_libxml2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
choices={'x86-windows', 'x86_64-windows', 'x86_64-linux', 'aarch64-linux', 'x86_64-darwin', 'aarch64-darwin'},
help="Platform to build for, e.g. x86_64-windows"
)
parser.add_argument(
'--cmake-generator',
choices={'Visual Studio 17 2022', 'Visual Studio 16 2019'},
default='Visual Studio 17 2022',
help="CMake generator for Windows"
)
(args, _) = parser.parse_known_args()

archive = download_file('https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.zip',
Expand All @@ -32,15 +38,14 @@
if fmi_system == 'windows':

cmake_args = [
'-G', 'Visual Studio 17 2022',
'-G', args.cmake_generator,
'-D', 'CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded',
'-A'
]

if fmi_architecture == 'x86':
cmake_args.append('Win32')
cmake_args += ['-A', 'Win32']
elif fmi_architecture == 'x86_64':
cmake_args.append('x64')
cmake_args += ['-A', 'x64']

elif fmi_platform == 'aarch64-linux':

Expand Down
12 changes: 9 additions & 3 deletions build/build_zlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
choices={'x86-windows', 'x86_64-windows', 'x86_64-linux', 'aarch64-linux', 'x86_64-darwin', 'aarch64-darwin'},
help="Platform to build for, e.g. x86_64-windows"
)
parser.add_argument(
'--cmake-generator',
choices={'Visual Studio 17 2022', 'Visual Studio 16 2019'},
default='Visual Studio 17 2022',
help="CMake generator for Windows"
)
args, _ = parser.parse_known_args()

archive = download_file('https://www.zlib.net/fossils/zlib-1.3.tar.gz',
Expand All @@ -31,12 +37,12 @@

if fmi_system == 'windows':

cmake_args += ['-G', 'Visual Studio 17 2022', '-A']
cmake_args += ['-G', args.cmake_generator]

if fmi_architecture == 'x86':
cmake_args.append('Win32')
cmake_args += ['-A', 'Win32']
elif fmi_architecture == 'x86_64':
cmake_args.append('x64')
cmake_args += ['-A', 'x64']

cmake_args += [
'-D', 'CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded'
Expand Down

0 comments on commit 069c79b

Please sign in to comment.