Skip to content

Commit 6173b78

Browse files
authored
Merge pull request #138 from michaeltryby/dev-build
Update build system for CMake 4 and OpenMP 17.0.1
2 parents 9b818a6 + 7d08b48 commit 6173b78

File tree

5 files changed

+60
-38
lines changed

5 files changed

+60
-38
lines changed

swmm-toolkit/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
################## CMAKELISTS FOR SWMM-TOOLKIT PROJECT ###################
1212
################################################################################
1313

14-
cmake_minimum_required (VERSION 3.17)
14+
cmake_minimum_required (VERSION 4.0.2)
1515

1616
project(swmm-toolkit
1717
VERSION
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11

22

33

4-
setuptools == 65.5.1
5-
wheel == 0.38.1
6-
scikit-build == 0.11.1
7-
cmake == 3.21
8-
swig == 4.0.2
9-
ninja; sys_platform == "darwin"
4+
setuptools
5+
wheel
6+
scikit-build
7+
cmake
8+
swig == 4.0.2

swmm-toolkit/extern/openmp.cmake

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# CMakeLists.txt - CMake configuration file for OpenMP Library on Darwin
33
#
44
# Created: Mar 17, 2021
5-
# Updated: May 19, 2021
5+
# Updated: Aug 29, 2025
66
#
77
# Author: Michael E. Tryby
88
# US EPA ORD/CESER
@@ -14,50 +14,73 @@
1414
# instead.
1515
#
1616
# All sources were obtained directly from the LLVM releases on github
17-
# See license-llvm-openmp.txt for the corresponding license and
18-
# https://openmp.llvm.org/ for details on the OpenMP run-time.
17+
# See license-llvm-openmp.txt for the corresponding license and
18+
# https://openmp.llvm.org/ for details on the OpenMP run-time.
1919

2020
################################################################################
2121
##################### CMAKELISTS FOR OPENMP LIBRARY ######################
2222
################################################################################
2323

24-
include(FetchContent)
2524

25+
# Append local dir to module search path
26+
list(
27+
APPEND CMAKE_MODULE_PATH
28+
${CMAKE_BINARY_DIR}/_deps/llvm_cmake-src/Modules
29+
)
30+
31+
include(
32+
FetchContent
33+
)
34+
35+
36+
# v17.0.1 (v17.0.0 was yanked)
37+
FetchContent_Declare(
38+
llvm_cmake
39+
URL
40+
https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/cmake-17.0.1.src.tar.xz
41+
URL_HASH
42+
SHA256=46e745d9bdcd2e18719a47b080e65fd476e1f6c4bbaa5947e4dee057458b78bc
43+
)
2644

27-
FetchContent_Declare(OpenMP
45+
FetchContent_Declare(
46+
OpenMP
2847
URL
29-
https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/openmp-12.0.1.src.tar.xz
48+
https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.1/openmp-17.0.1.src.tar.xz
3049
URL_HASH
31-
SHA256=60fe79440eaa9ebf583a6ea7f81501310388c02754dbe7dc210776014d06b091
50+
SHA256=d4a25c04d1bc035990a85f172bfe29a38f21ff87448f7fbae165fa780cb95717
51+
OVERRIDE_FIND_PACKAGE
3252
)
3353

34-
set(OPENMP_STANDALONE_BUILD TRUE)
35-
set(LIBOMP_INSTALL_ALIASES OFF)
54+
set(
55+
OPENMP_STANDALONE_BUILD
56+
TRUE
57+
)
58+
set(
59+
LIBOMP_INSTALL_ALIASES
60+
OFF
61+
)
3662

37-
FetchContent_MakeAvailable(OpenMP)
38-
set(OpenMP_AVAILABLE TRUE)
63+
FetchContent_MakeAvailable(
64+
llvm_cmake
65+
OpenMP
66+
)
3967

68+
target_compile_options(
69+
omp
70+
INTERFACE
71+
-Xclang
72+
-fopenmp
73+
)
4074

41-
target_link_directories(omp
75+
target_link_directories(
76+
omp
4277
PUBLIC
4378
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src>
44-
$<INSTALL_INTERFACE:${LIBRARY_DIST}>
79+
$<INSTALL_INTERFACE:/include>
4580
)
4681

47-
install(TARGETS omp
48-
LIBRARY
49-
DESTINATION
50-
"${LIBRARY_DIST}"
82+
add_library(
83+
OpenMP::OpenMP_C
84+
ALIAS
85+
omp
5186
)
52-
53-
if(CMAKE_C_COMPILER_ID MATCHES "Clang\$")
54-
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src")
55-
set(OpenMP_C_LIB_NAMES "omp")
56-
set(OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src/libomp.dylib")
57-
endif()
58-
59-
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang\$")
60-
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src")
61-
set(OpenMP_CXX_LIB_NAMES "omp")
62-
set(OpenMP_omp_LIBRARY "${CMAKE_BINARY_DIR}/_deps/openmp-build/runtime/src/libomp.dylib")
63-
endif()

swmm-toolkit/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def run(self):
8888
cmake_args = ["-GVisual Studio 17 2022","-Ax64"]
8989

9090
elif platform_system == "Darwin":
91-
cmake_args = ["-GNinja","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.0"]
91+
cmake_args = ["-GXcode","-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=11.0"]
9292

9393
else:
9494
cmake_args = ["-GUnix Makefiles"]

swmm-toolkit/swmm-solver

0 commit comments

Comments
 (0)