Skip to content

Commit 34e323b

Browse files
committed
Make dialyzer optional
Do not require dialyzer, skip PLT build in case dialyzer has not been found. Signed-off-by: Davide Bettio <[email protected]>
1 parent f585c5b commit 34e323b

File tree

3 files changed

+43
-11
lines changed

3 files changed

+43
-11
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ cmake_minimum_required (VERSION 3.13)
2323
project(AtomVM)
2424
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
2525

26+
find_package(Dialyzer)
2627
find_package(Elixir)
2728

2829
option(AVM_DISABLE_FP "Disable floating point support." OFF)

CMakeModules/FindDialyzer.cmake

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#
2+
# This file is part of AtomVM.
3+
#
4+
# Copyright 2019 Riccardo Binetti <[email protected]>
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
#
18+
# SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
19+
#
20+
21+
find_program(DIALYZER_PATH dialyzer)
22+
23+
if (DIALYZER_PATH)
24+
set(Dialyzer_FOUND TRUE)
25+
elseif(Dialyzer_FIND_REQUIRED)
26+
message(FATAL_ERROR "dialyzer not found")
27+
endif()

libs/CMakeLists.txt

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,22 @@ else()
4040
pack_lib(atomvmlib eavmlib estdlib alisp)
4141
endif()
4242

43-
add_custom_command(
44-
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.plt
45-
DEPENDS atomvmlib
46-
COMMAND dialyzer --build_plt --output_plt ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.plt
47-
-r ${CMAKE_CURRENT_BINARY_DIR}/estdlib/src/beams
48-
-r ${CMAKE_CURRENT_BINARY_DIR}/eavmlib/src/beams
49-
-r ${CMAKE_CURRENT_BINARY_DIR}/alisp/src/beams
50-
)
43+
if (Dialyzer_FOUND)
44+
add_custom_command(
45+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.plt
46+
DEPENDS atomvmlib
47+
COMMAND dialyzer --build_plt --output_plt ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.plt
48+
-r ${CMAKE_CURRENT_BINARY_DIR}/estdlib/src/beams
49+
-r ${CMAKE_CURRENT_BINARY_DIR}/eavmlib/src/beams
50+
-r ${CMAKE_CURRENT_BINARY_DIR}/alisp/src/beams
51+
)
5152

52-
add_custom_target(atomvmlib_plt ALL
53-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.plt
54-
)
53+
add_custom_target(atomvmlib_plt ALL
54+
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.plt
55+
)
56+
else()
57+
message("Unable to find dialyzer -- skipping PLT build")
58+
endif()
5559

5660
install(
5761
FILES ${CMAKE_CURRENT_BINARY_DIR}/atomvmlib.avm

0 commit comments

Comments
 (0)