Skip to content

Commit ceab906

Browse files
authored
Merge pull request #454 from SCOREC/apw/capVol_mds_adapt
Refactor Capstone support
2 parents 7e8072d + 912a7dd commit ceab906

25 files changed

+2103
-1429
lines changed

CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,18 @@ set(Trilinos_PREFIX "" CACHE STRING "Trilinos installation directory")
105105
option(SKIP_SIMMETRIX_VERSION_CHECK "enable at your own risk; it may result in undefined behavior" OFF)
106106
option(ENABLE_SIMMETRIX "Build with Simmetrix support" OFF)
107107
message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}")
108-
option(ENABLE_CAPSTONE "Build with Capstone support" OFF)
109-
message(STATUS "ENABLE_CAPSTONE: ${ENABLE_CAPSTONE}")
108+
option(PUMI_ENABLE_CAPSTONE "Build PUMI with Capstone support" OFF)
109+
# For compatibility and to inherit from owning projects:
110+
if(ENABLE_CAPSTONE)
111+
set(PUMI_ENABLE_CAPSTONE ON)
112+
endif()
113+
message(STATUS "PUMI_ENABLE_CAPSTONE: ${PUMI_ENABLE_CAPSTONE}")
110114

111115
if(ENABLE_SIMMETRIX)
112116
add_definitions(-DHAVE_SIMMETRIX)
113117
endif()
114-
if(ENABLE_CAPSTONE)
115-
add_definitions(-DHAVE_CAPSTONE)
118+
if(PUMI_ENABLE_CAPSTONE)
119+
add_definitions(-DPUMI_HAS_CAPSTONE)
116120
endif()
117121

118122
option(ENABLE_FPP "Build with snapping to first problem plane" OFF)
@@ -144,8 +148,8 @@ if(ENABLE_SIMMETRIX)
144148
find_package(SimModSuite MODULE REQUIRED)
145149
endif()
146150

147-
if(ENABLE_CAPSTONE)
148-
set(SCOREC_USE_CreateMG_DEFAULT ${ENABLE_CAPSTONE})
151+
if(PUMI_ENABLE_CAPSTONE)
152+
set(SCOREC_USE_CreateMG_DEFAULT ${PUMI_ENABLE_CAPSTONE})
149153
bob_public_dep(CreateMG)
150154
endif()
151155

apf/apfMesh.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ int const quad_edge_verts[4][2] =
5151
*/
5252

5353
int const tet_edge_verts[6][2] =
54-
#ifndef HAVE_CAPSTONE
54+
#ifndef PUMI_HAS_CAPSTONE
5555
{{0,1}
5656
,{1,2}
5757
,{2,0}
@@ -78,7 +78,7 @@ int const pyramid_edge_verts[8][2] =
7878
,{0,4},{1,4},{2,4},{3,4}};
7979

8080
int const tet_tri_verts[4][3] =
81-
#ifndef HAVE_CAPSTONE
81+
#ifndef PUMI_HAS_CAPSTONE
8282
{{0,1,2}
8383
,{0,1,3}
8484
,{1,2,3}

apf_cap/CMakeLists.txt

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ if(DEFINED TRIBITS_PACKAGE)
33
return()
44
endif()
55

6-
if(NOT ENABLE_CAPSTONE)
6+
if(NOT PUMI_ENABLE_CAPSTONE)
77
return()
88
endif()
99

@@ -12,25 +12,35 @@ include(CheckIncludeFileCXX)
1212
cmake_policy(SET CMP0075 NEW) # Observe CMAKE_REQUIRED_LIBRARIES.
1313

1414
#Sources & Headers
15-
set(SOURCES apfCAP.cc)
15+
set(SOURCES apfCAP.cc apfCAPsizing.cc)
1616
set(HEADERS apfCAP.h)
1717

1818
#Library
1919
add_library(apf_cap ${SOURCES})
2020
target_link_libraries(apf_cap PUBLIC apf gmi_cap)
21-
target_link_libraries(apf_cap PUBLIC capstone_module
22-
framework_testing)
21+
target_link_libraries(apf_cap PRIVATE framework_mesh framework_application)
2322

2423
set(CMAKE_CXX_OLD_STANDARD "${CMAKE_CXX_STANDARD}")
2524
cmake_push_check_state(RESET)
2625
set(CMAKE_CXX_STANDARD 14)
26+
27+
# CreateFT_Vector.h via CreateMG_SizingMetricTool.h is missing
28+
# `#include <limits>` in Capstone 12.5.2 so add it explicitly in this check.
29+
if(MSVC)
30+
set(CMAKE_REQUIRED_FLAGS "/FI limits")
31+
else()
32+
set(CMAKE_REQUIRED_FLAGS "-include limits")
33+
endif()
34+
2735
set(CMAKE_REQUIRED_LIBRARIES "framework_meshing")
28-
check_include_file_cxx("CreateMG_SizingMetricTool.h" HAVE_CAPSTONE_SIZINGMETRICTOOL)
36+
check_include_file_cxx(
37+
"CreateMG_SizingMetricTool.h" PUMI_HAS_CAPSTONE_SIZINGMETRICTOOL
38+
)
2939
cmake_pop_check_state()
3040
set(CMAKE_CXX_STANDARD "${CMAKE_CXX_OLD_STANDARD}")
3141

32-
if(HAVE_CAPSTONE_SIZINGMETRICTOOL)
33-
target_compile_definitions(apf_cap PRIVATE HAVE_CAPSTONE_SIZINGMETRICTOOL)
42+
if(PUMI_HAS_CAPSTONE_SIZINGMETRICTOOL)
43+
target_compile_definitions(apf_cap PRIVATE PUMI_HAS_CAPSTONE_SIZINGMETRICTOOL)
3444
target_compile_features(framework_meshing INTERFACE cxx_std_14)
3545
target_link_libraries(apf_cap PRIVATE framework_meshing)
3646
endif()

0 commit comments

Comments
 (0)