Skip to content

Commit 0305248

Browse files
committed
Merge pull request #748 from bettio/make-dialyzer-optional
Do not require dialyzer, skip PLT build in case dialyzer has not been found. These changes are made under both the "Apache 2.0" and the "GNU Lesser General Public License 2.1 or later" license terms (dual license). SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
2 parents 982a31d + 6086b5f commit 0305248

File tree

4 files changed

+45
-11
lines changed

4 files changed

+45
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ build/**
1010
xcode/**
1111
src/platforms/esp32/build/**
1212
src/platforms/esp32/build/**/*.d
13+
src/platforms/esp32/test/build/**
1314
src/platforms/esp32/components/**
1415
src/platforms/esp32/sdkconfig
1516
!src/platforms/esp32/components/avm_builtins/

CMakeLists.txt

Lines changed: 2 additions & 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)
@@ -32,6 +33,7 @@ option(AVM_VERBOSE_ABORT "Print module and line number on VM abort" OFF)
3233
option(AVM_RELEASE "Build an AtomVM release" OFF)
3334
option(AVM_CREATE_STACKTRACES "Create stacktraces" ON)
3435
option(COVERAGE "Build for code coverage" OFF)
36+
option(RUN_DIALYZER "Run dialyzer on BEAM modules" ON)
3537

3638
if((${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") OR
3739
(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") OR

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 AND RUN_DIALYZER)
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("Dialyzer is not enabled -- skipping PLT build")
58+
endif()
5559

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

0 commit comments

Comments
 (0)