@@ -80,7 +80,6 @@ set(GENERATED_DIR "${CMAKE_BINARY_DIR}/generated")
80
80
81
81
# Set output directory for compiled executable
82
82
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_DIR} )
83
- set (BUILD_TESTING OFF CACHE BOOL "Disable testing for external dependencies" FORCE )
84
83
85
84
# Save the current state and disable deprecation warnings
86
85
set (_original_WARN_DEPRECATED ${CMAKE_WARN_DEPRECATED} )
@@ -97,30 +96,35 @@ FetchContent_Declare(
97
96
)
98
97
FetchContent_MakeAvailable (miniz-cpp )
99
98
100
- # Disable building tests for nlohmann_json
101
- set (JSON_BuildTests OFF CACHE BOOL "Do not build tests for nlohmann_json" )
102
- # Define the version of nlohmann_json to use
103
- set (NLOHMANN_JSON_VERSION v3.11.3 )
104
- # Fetch nlohmann_json
105
- FetchContent_Declare (
106
- nlohmann_json
107
- URL https://github.com/nlohmann/json/releases/download/${NLOHMANN_JSON_VERSION}/json.tar.xz
108
- URL_HASH SHA256=d6c65aca6b1ed68e7a182f4757257b107ae403032760ed6ef121c9d55e81757d # Verify the hash matches the tarball
109
- DOWNLOAD_EXTRACT_TIMESTAMP TRUE
110
- )
111
- FetchContent_MakeAvailable (nlohmann_json )
99
+ # Define a cache variable for the local MNX C++ DOM path relative to the source directory.
100
+ set (MNXDOM_LOCAL_PATH "" CACHE STRING "Path to local MNX C++ DOM checkout relative to the source directory (if provided)" )
112
101
113
- # Disable building tests for json_schema_validator
114
- set (JSON_VALIDATOR_BUILD_TESTS OFF CACHE BOOL "Do not build tests for json_schema_validator" )
115
- # Fetch json_schema_validator from your fork
116
- set (nlohmann_json_VERSION ${NLOHMANN_JSON_VERSION} )
102
+ if (MNXDOM_LOCAL_PATH )
103
+ # Combine the source directory with the relative path to get an absolute path.
104
+ get_filename_component (MNXDOM_LOCAL_PATH_ABS "${CMAKE_SOURCE_DIR} /${MNXDOM_LOCAL_PATH} " ABSOLUTE )
105
+ if (EXISTS "${MNXDOM_LOCAL_PATH_ABS} /CMakeLists.txt" )
106
+ message (STATUS "Local MNX C++ DOM found at ${MNXDOM_LOCAL_PATH_ABS} " )
107
+ # Set the FetchContent source directory to the computed absolute path.
108
+ set (FETCHCONTENT_SOURCE_DIR_MNXDOM "${MNXDOM_LOCAL_PATH_ABS} " CACHE INTERNAL "" )
109
+ else ()
110
+ message (FATAL_ERROR "Local MNX C++ DOM not found at ${MNXDOM_LOCAL_PATH_ABS} " )
111
+ endif ()
112
+ else ()
113
+ message (STATUS "Using GitHub for MNX C++ DOM" )
114
+ endif ()
115
+
116
+ option (mnxdom_BUILD_TESTING "Enable testing mnxdom" ON )
117
+ # Fetch mnxdom
117
118
FetchContent_Declare (
118
- json_schema_validator
119
- GIT_REPOSITORY https://github.com/pboettch/json-schema-validator
120
- GIT_TAG 40af3ec39670e768fc3f01f935140af311d71024
119
+ mnxdom
120
+ GIT_REPOSITORY https://github.com/rpatters1/mnxdom.git
121
+ GIT_TAG main
121
122
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
122
123
)
123
- FetchContent_MakeAvailable (json_schema_validator )
124
+ FetchContent_MakeAvailable (mnxdom )
125
+
126
+ FetchContent_GetProperties (mnxdom )
127
+ message (STATUS "mnxdom Source Directory: ${mnxdom_SOURCE_DIR} " )
124
128
125
129
# Restore the original state
126
130
set (CMAKE_WARN_DEPRECATED ${_original_WARN_DEPRECATED} CACHE BOOL "Restore original deprecation warnings setting" FORCE )
@@ -129,7 +133,6 @@ add_custom_target(PrintConfig ALL
129
133
COMMAND ${CMAKE_COMMAND} -E echo "Active build configuration: $<CONFIG>"
130
134
)
131
135
132
- include ("${CMAKE_SOURCE_DIR} /cmake/GenerateMnxSchemaXxd.cmake" )
133
136
include ("${CMAKE_SOURCE_DIR} /cmake/GenerateLicenseXxd.cmake" )
134
137
135
138
# Add executable target
@@ -158,16 +161,15 @@ set(MUSX_DISPLAY_NODE_NAMES ON CACHE BOOL "Write node names to std::cout as they
158
161
#set(MUSX_THROW_ON_INTEGRITY_CHECK_FAIL ON CACHE BOOL "Enable throwing integrity check failures" FORCE)
159
162
160
163
# Ensure the include directories are added
161
- add_dependencies (mnxvalidate GenerateMnxSchemaXxd GenerateLicenseXxd )
164
+ add_dependencies (mnxvalidate GenerateLicenseXxd )
162
165
target_include_directories (mnxvalidate PRIVATE "${FETCHCONTENT_BASE_DIR} /ezgz-src" )
163
166
target_include_directories (mnxvalidate SYSTEM PRIVATE "${FETCHCONTENT_BASE_DIR} /miniz-cpp-src" )
164
167
target_include_directories (mnxvalidate PRIVATE ${GENERATED_DIR} )
165
168
target_include_directories (mnxvalidate PRIVATE ${MUSX_OBJECT_MODEL_DIR} )
166
169
target_include_directories (mnxvalidate PRIVATE ${CMAKE_SOURCE_DIR} /src )
167
170
168
171
# Ensure the libraries are added
169
- target_link_libraries (mnxvalidate PRIVATE nlohmann_json::nlohmann_json )
170
- target_link_libraries (mnxvalidate PRIVATE nlohmann_json_schema_validator )
172
+ target_link_libraries (mnxvalidate PRIVATE mnxdom )
171
173
172
174
# Define an interface library for precompiled headers
173
175
add_library (mnxvalidate_pch INTERFACE )
@@ -178,6 +180,7 @@ target_precompile_headers(mnxvalidate_pch INTERFACE
178
180
<functional>
179
181
<string>
180
182
<memory>
183
+ <mnxdom.h>
181
184
)
182
185
183
186
# Link the interface library to mnxvalidate
0 commit comments