Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic support for gtest infra #89

Closed
wants to merge 123 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
6e12e8f
This rolls up over a year's worth of work on the flang middle-end and
schweitzpgi Apr 9, 2020
e08b389
Update README
schweitzpgi Apr 9, 2020
23d1196
fix the fallout from the pass manager changes in MLIR
schweitzpgi Apr 9, 2020
c7dd6ea
lapack work
schweitzpgi Apr 9, 2020
036237b
More CHARACTER runtime support
klausler Apr 8, 2020
b5d3f00
add lowering for CHARACTER comparison calls to the runtime
schweitzpgi Apr 10, 2020
0b8007e
[audit] add back changes that were lost with merge
schweitzpgi Apr 10, 2020
7d2dac8
Work on adjustable arrays.
schweitzpgi Apr 10, 2020
7147f9c
add a "using namespace Fortran;" to PFTBuilder.cpp
schweitzpgi Apr 11, 2020
04c866d
part 2 - implement the lower of variables
schweitzpgi Apr 11, 2020
8b94b01
drop assert that was being hit in many tests
schweitzpgi Apr 11, 2020
21687f7
A couple minor bug fixes
schweitzpgi Apr 12, 2020
1342280
kill warning
schweitzpgi Apr 12, 2020
e87b3bc
implement format for data transfer statements
schweitzpgi Apr 12, 2020
1fc5ab4
update the lapack list
schweitzpgi Apr 13, 2020
3e1bc13
add a check and TODO
schweitzpgi Apr 13, 2020
1cd4b9d
add plumbing to connect up character comparison; add test
schweitzpgi Apr 13, 2020
278221d
improve the folder for convert on bools
schweitzpgi Apr 14, 2020
f56e2c7
DCE was broken. This adds back the Op traits to make it work correctly.
schweitzpgi Apr 14, 2020
0d40e35
Replace internal symbol map.
schweitzpgi Apr 14, 2020
58fe0cd
Generate FIR for a group of multiway branches (#10)
vdonaldson Apr 14, 2020
b67b136
use SmallVector
schweitzpgi Apr 14, 2020
3fa4541
remove reference to deleted header
schweitzpgi Apr 15, 2020
eee7804
ABS, DBLE, SIGN, MOD, ICHAR intrinsic lowering
jeanPerier Apr 16, 2020
d29b9c1
Add fir::isa_real and fir::isa_complex and rework FirOpBuilder::isCha…
jeanPerier Apr 17, 2020
68ca21b
This is some initial work on getting Burnside to use the new symbol m…
schweitzpgi Apr 15, 2020
7bde1fe
FIR changes:
Apr 18, 2020
fc5f1ed
Instantiate global scalar values.
vjayathirtha-nv Apr 15, 2020
0376473
Reverse conditional create step so that it is created lazily rather than
schweitzpgi Apr 20, 2020
cb87867
Fix a bug in argument passing. When the expression is already a refer…
schweitzpgi Apr 21, 2020
896e884
tighten some checks
schweitzpgi Apr 21, 2020
d743746
PARAMETER type values should be 'constant' globals
vjayathirtha-nv Apr 21, 2020
63458ed
[rebase] changes from rebasing. fixes cmake fallout and a bad merge
schweitzpgi Apr 22, 2020
fc48a25
draft fix the lowering of adjusted arrays
Apr 22, 2020
652c176
Move and rework pgmath description used in folding
jeanPerier Apr 22, 2020
ef44967
Share pgmath description in lowering and folding. Simplify intrinsic …
jeanPerier Apr 20, 2020
776f577
Fix libpgmath linking regression after D78215
jeanPerier Apr 23, 2020
2c43709
Rename isNotInMemory to needToMaterialize. Fix StaticMultimapView usa…
jeanPerier Apr 23, 2020
696d9ef
add ability to use ConvertOp to perform a type conversion from a comp…
Apr 22, 2020
909de65
Add a test and fix some bugs for F77 array lowering
Apr 23, 2020
2e1a7d1
More work on LAPACK
Apr 24, 2020
bf6817c
LAPACK: changes to get xerbla_array.f to compile clean.
Apr 24, 2020
13ec174
Remove the special case handling of LOGICAL and i1.
Apr 26, 2020
8d71e47
Implement subroutine calls with alternate returns. (#26)
vdonaldson Apr 27, 2020
a58adb6
Improve character literal names. Add a mechanism to avoid future coll…
Apr 27, 2020
cbda647
move safe conversion to builder. rework FirOpBuilder for KindMapping.
Apr 25, 2020
bc1887c
edit todo list
Apr 25, 2020
c2a8fe7
fixes logical conversions
Apr 29, 2020
d2307f3
Start converting the speculative conversion of logical to bool to use…
Apr 29, 2020
d0cf5a5
fix compilation failure. function was merged twice.
schweitzpgi Apr 29, 2020
d3c331e
small cleanup on comments, missing cast
schweitzpgi Apr 29, 2020
842f728
Wrap a CHARACTER literal in a box.
schweitzpgi Apr 29, 2020
7cd0551
revert last patch
schweitzpgi Apr 29, 2020
03d5d11
Add a static flag on the link line to avoid the linker failing when
schweitzpgi Apr 30, 2020
14ae44d
alternative fix. this one works on the Mac as well.
Apr 30, 2020
7de3caa
Move the lib files around so they align with the include directory. …
schweitzpgi Apr 30, 2020
75f72f3
Moving some code around. Renaming files to be more reflective of what…
Apr 30, 2020
15696f8
alternate return test (#42)
vdonaldson May 1, 2020
871014a
This is a temporary hack to workaround the way we are currently lower…
May 1, 2020
ddcbab7
review suggestions
May 4, 2020
d2705ae
Remove the positive step check. Fortran has decrementing loops.
schweitzpgi May 4, 2020
d150b79
fix typo
May 4, 2020
4c0df2a
update the LAPACK issues list
schweitzpgi May 5, 2020
2967759
Dominance.h moved
schweitzpgi May 6, 2020
d0ceb94
fix breakage in tests
schweitzpgi May 6, 2020
4f2214b
Fix power lowering regression and add tests
jeanPerier May 5, 2020
2286324
LEN_TRIM inline implementation + make character length index type
jeanPerier Apr 27, 2020
c69b4f2
temporary fix for lapack. Need to get proper support for boxes in to …
schweitzpgi May 5, 2020
5ade328
update the list
schweitzpgi May 6, 2020
072b34d
To improve build times, lop off the f18 tool's dependence on Lowering…
Apr 25, 2020
2c31e06
Remove raw_ostream references from Decimal
schweitzpgi May 7, 2020
f97501e
Instantiate global single dimensional array values. Add global array …
vjayathirtha-nv Apr 24, 2020
0a3f485
add the missing directory path to test 4
schweitzpgi May 7, 2020
139d806
move towards making conversions more formal in the bridge
schweitzpgi May 7, 2020
e66bb7f
Removes some old aliases. Use the long names.
schweitzpgi May 8, 2020
e0fcfb9
rename function
schweitzpgi May 8, 2020
d44ed59
I/O condition specifier branching (#53)
vdonaldson May 8, 2020
5811d27
fix bug with external names
May 8, 2020
bdc69b4
update the lapack list
schweitzpgi May 8, 2020
d0d5e13
Fix IsDescriptor for dummy with explicit non constant shapes
jeanPerier May 11, 2020
a1c1c39
update the lapack list
May 8, 2020
7e06c91
add option to bbc
May 8, 2020
325f6d2
need to flip from column-major to row-major when converting to LLVM.
schweitzpgi May 11, 2020
6b8bddb
use TypeSwitch; fix failing test
schweitzpgi May 11, 2020
a0d7209
Lower FLOOR and NINT. Add tests for CEILING/FLOOR/NINT
jeanPerier May 7, 2020
42f9ae4
STOP and ERROR STOP lowering
jeanPerier May 8, 2020
894cdf7
Update lapack issue list
jeanPerier May 8, 2020
01a8ee3
Remove lower::RuntimeEntryCode enum
jeanPerier May 11, 2020
9d36f5e
revert PR #61
schweitzpgi May 12, 2020
91388ac
Fix two control flow bugs in lapack files.
vdonaldson May 12, 2020
e82b2f1
remove some dead code
schweitzpgi May 12, 2020
3ba69c1
need to flip from column-major to row-major when converting to LLVM.
schweitzpgi May 11, 2020
615cce7
add back the registration of MLIR options
May 12, 2020
9aad8c3
remove overly conservative assertions
May 12, 2020
45a7e97
fix bug with optional region
May 12, 2020
e1736d6
fix type mismatch bugs
May 12, 2020
f9c033a
clang-format
May 12, 2020
84f92a4
simplify
May 12, 2020
9b66af3
quick and dirty
May 13, 2020
ebfdf1b
[temporary] This patch should be reverted!
May 13, 2020
259f7e8
add a canonical test with temporary arrays
May 13, 2020
29c33e0
change to expected failure rather than making test pass
May 13, 2020
452716e
remove canonicalizer from tco temporarily
May 13, 2020
326c36c
add some comments
May 13, 2020
c420216
update the lapack bug list file
schweitzpgi May 13, 2020
2618b2c
Multi dimensional array initializers
vjayathirtha-nv May 11, 2020
d66e2ae
Scalar character concatenation
jeanPerier May 13, 2020
d156256
Update Lapack bug tracker
jeanPerier May 14, 2020
a566041
f
jeanPerier May 14, 2020
6f22fc2
rebase fallout. handles changes from renaming things in MLIR.
schweitzpgi May 15, 2020
4ecf23d
ignore compiler directives for now.
schweitzpgi May 16, 2020
28a12f6
remove the LAPACK-bugs.txt file.
schweitzpgi May 18, 2020
79f45de
fixes issue #74
schweitzpgi May 18, 2020
d48aba1
Merge pull request #77 from flang-compiler/ch-rmlapack
schweitzpgi May 18, 2020
99da446
fix bug #78
schweitzpgi May 18, 2020
7d284cf
Merge pull request #79 from flang-compiler/ch-pftbug
schweitzpgi May 19, 2020
91aaf26
Another crash apparently related to issue #74. Add check for empty list.
schweitzpgi May 19, 2020
65963dc
Merge pull request #80 from flang-compiler/ch-charbug
schweitzpgi May 19, 2020
aee3a8b
change size() to !empty() on list.
schweitzpgi May 19, 2020
0a676b9
Add name mangling support for constants in procedures.
Sameeranjoshi May 19, 2020
e689986
Merge pull request #81 from flang-compiler/ch-pftbug2
schweitzpgi May 19, 2020
6f4dbe5
Merge pull request #82 from Sameeranjoshi/sam-manglenaming
schweitzpgi May 19, 2020
c8417d8
Basic support for gtest infra
Sameeranjoshi May 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
185 changes: 91 additions & 94 deletions flang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
cmake_minimum_required(VERSION 3.9.0)
cmake_minimum_required(VERSION 3.9.0)

# RPATH settings on macOS do not affect INSTALL_NAME.
if (POLICY CMP0068)
if (POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR ON)
endif()

# Include file check macros honor CMAKE_REQUIRED_LIBRARIES.
if(POLICY CMP0075)
if(POLICY CMP0075)
cmake_policy(SET CMP0075 NEW)
endif()

# option() honors normal variables.
if (POLICY CMP0077)
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif()

option(LINK_WITH_FIR "Link driver with FIR and LLVM" ON)

# Flang requires C++17.
# Flang requires C++17.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF)

set(FLANG_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE)
message(FATAL_ERROR "In-source builds are not allowed. \
Expand All @@ -37,44 +35,42 @@ endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
include(AddFlang)


# Check for a standalone build and configure as appropriate from
# there.
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
message("Building Flang as a standalone project.")
project(Flang)
message("Building Flang as a standalone project.")
project(Flang)

set(FLANG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
if (NOT MSVC_IDE)
set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS}
CACHE BOOL "Enable assertions")
# Assertions follow llvm's configuration.
mark_as_advanced(LLVM_ENABLE_ASSERTIONS)
endif()

# We need a pre-built/installed version of LLVM.
# We need a pre-built/installed version of LLVM and MLIR.
find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}")
list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR})

find_package(MLIR REQUIRED HINTS "${MLIR_CMAKE_PATH}")
list(APPEND CMAKE_MODULE_PATH ${MLIR_DIR})

# If LLVM links to zlib we need the imported targets so we can too.
if(LLVM_ENABLE_ZLIB)
find_package(ZLIB REQUIRED)
endif()

# They are used as destination of target generators.
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib${LLVM_LIBDIR_SUFFIX})

include(CMakeParseArguments)
include(AddLLVM)
include(HandleLLVMOptions)
include(VersionFromVCS)

if(LINK_WITH_FIR)
include(TableGen)
find_package(MLIR REQUIRED CONFIG)
# Use SYSTEM for the same reasons as for LLVM includes
include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
list(APPEND CMAKE_MODULE_PATH ${MLIR_DIR})
include(AddMLIR)
find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)
endif()
include(TableGen)
include(AddMLIR)

option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
option(LLVM_INSTALL_TOOLCHAIN_ONLY
Expand All @@ -92,11 +88,13 @@ project(Flang)
# should not be suppressed).
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})
include_directories(SYSTEM ${MLIR_INCLUDE_DIRS})
add_definitions(${MLIR_DEFINITIONS})

# LLVM's cmake configuration files currently sneak in a c++11 flag.
# We look for it here and remove it from Flang's compile flags to
# avoid some mixed compilation flangs (e.g. -std=c++11 ... -std=c++17).
if (DEFINED LLVM_CXX_STD)
# We look for it here and remove it from Flang's compile flags to
# avoid some mixed compilation flangs (e.g. -std=c++11 ... -std=c++17).
if (DEFINED LLVM_CXX_STD)
message("LLVM configuration set a C++ standard: ${LLVM_CXX_STD}")
if (NOT LLVM_CXX_STD EQUAL "c++17")
message("Flang: Overriding LLVM's 'cxx_std' setting...")
Expand All @@ -109,12 +107,16 @@ project(Flang)

link_directories("${LLVM_LIBRARY_DIR}")

set(LLVM_TOOLS_BINARY_DIR ${TOOLS_BINARY_DIR} CACHE PATH "Path to llvm/bin")
find_program(MLIR_TABLEGEN_EXE "mlir-tblgen" ${LLVM_TOOLS_BINARY_DIR}
NO_DEFAULT_PATH)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})

set(BACKEND_PACKAGE_STRING "LLVM ${LLVM_PACKAGE_VERSION}")
set(LLVM_EXTERNAL_LIT "${LLVM_TOOLS_BINARY_DIR}/llvm-lit" CACHE STRING "Command used to spawn lit")

Expand All @@ -127,37 +129,37 @@ project(Flang)
endif()

else()
option(FLANG_INCLUDE_TESTS
"Generate build targets for the Flang unit tests."
${LLVM_INCLUDE_TESTS})
set(FLANG_BINARY_DIR ${CMAKE_BINARY_DIR}/tools/flang)
set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
if (LINK_WITH_FIR)
set(MLIR_MAIN_SRC_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --src-root
set(MLIR_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/../mlir/include ) # --includedir
set(MLIR_TABLEGEN_OUTPUT_DIR ${CMAKE_BINARY_DIR}/tools/mlir/include)
set(MLIR_TABLEGEN_EXE $<TARGET_FILE:mlir-tblgen>)
include_directories(SYSTEM ${MLIR_INCLUDE_DIR})
include_directories(SYSTEM ${MLIR_TABLEGEN_OUTPUT_DIR})
endif()
set(MLIR_BINARY_DIR ${LLVM_BINARY_DIR}/tools/mlir)
set(MLIR_SOURCE_DIR ${LLVM_SOURCE_DIR}/../mlir)
endif()

if(LINK_WITH_FIR)
# tco tool and FIR lib output directories
set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/bin)
set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_BINARY_DIR}/lib)
# Always build tco tool
set(LLVM_BUILD_TOOLS ON)
message(STATUS "Linking driver with FIR and LLVM")
llvm_map_components_to_libnames(LLVM_COMMON_LIBS support)
message(STATUS "LLVM libraries: ${LLVM_COMMON_LIBS}")
endif()

# Add Flang-centric modules to cmake path.
include_directories(BEFORE
${FLANG_BINARY_DIR}/include
${FLANG_SOURCE_DIR}/include)

if(MLIR_SOURCE_DIR)
include_directories(BEFORE
${FLANG_BINARY_DIR}/include
${FLANG_SOURCE_DIR}/include
${MLIR_BINARY_DIR}/include
${MLIR_SOURCE_DIR}/include
)
set(MLIR_MAIN_SRC_DIR ${MLIR_SOURCE_DIR})
set(MLIR_INCLUDE_DIR ${MLIR_SOURCE_DIR}/include)
else()
include_directories(BEFORE
${FLANG_BINARY_DIR}/include
${FLANG_SOURCE_DIR}/include
${MLIR_BINARY_DIR}/include
)
set(MLIR_MAIN_SRC_DIR ${MLIR_BINARY_DIR})
set(MLIR_INCLUDE_DIR ${MLIR_BINARY_DIR}/include)
endif()

set(MLIR_TABLEGEN_EXE mlir-tblgen)

# Add Flang-centric modules to cmake path.
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

if (NOT DEFAULT_SYSROOT)
Expand All @@ -172,7 +174,7 @@ endif()
set(FLANG_DEFAULT_LINKER "" CACHE STRING
"Default linker to use (linker name or absolute path, empty for platform default)")

set(FLANG_DEFAULT_RTLIB "" CACHE STRING
set(FLANG_DEFAULT_RTLIB "" CACHE STRING
"Default Fortran runtime library to use (\"libFortranRuntime\"), leave empty for platform default.")

if (NOT(FLANG_DEFAULT_RTLIB STREQUAL ""))
Expand All @@ -184,7 +186,7 @@ endif()


set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
# Override LLVM versioning for now...
# Override LLVM versioning for now...
set(FLANG_VERSION_MAJOR "0")
set(FLANG_VERSION_MINOR "1")
set(FLANG_VERSION_PATCHLEVEL "0")
Expand Down Expand Up @@ -234,59 +236,53 @@ endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/include/flang/Version.inc.in
${CMAKE_CURRENT_BINARY_DIR}/include/flang/Version.inc)
# Configure Flang's version info header file.
# Configure Flang's version info header file.
configure_file(
${FLANG_SOURCE_DIR}/include/flang/Config/config.h.cmake
${FLANG_BINARY_DIR}/include/flang/Config/config.h)

# Add global F18 flags.
set(CMAKE_CXX_FLAGS "-fno-rtti -fno-exceptions -pedantic -Wall -Wextra -Werror -Wcast-qual -Wimplicit-fallthrough -Wdelete-non-virtual-dtor ${CMAKE_CXX_FLAGS}")

# Builtin check_cxx_compiler_flag doesn't seem to work correctly
macro(check_compiler_flag flag resultVar)
unset(${resultVar} CACHE)
check_cxx_compiler_flag("${flag}" ${resultVar})
endmacro()

check_compiler_flag("-Werror -Wno-deprecated-copy" CXX_SUPPORTS_NO_DEPRECATED_COPY_FLAG)
if (CXX_SUPPORTS_NO_DEPRECATED_COPY_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy")
endif()
check_compiler_flag("-Wstring-conversion" CXX_SUPPORTS_NO_STRING_CONVERSION_FLAG)
if (CXX_SUPPORTS_NO_STRING_CONVERSION_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-string-conversion")
endif()

# Add appropriate flags for GCC
if (LLVM_COMPILER_IS_GCC_COMPATIBLE)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions")
if (NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing -fno-semantic-interposition")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-command-line-argument -Wstring-conversion \
-Wcovered-switch-default")
endif() # Clang.

# The following works around warnings in the f18 sources. TODO: Should these move
# outside of GCC compatible block at some point?

check_cxx_compiler_flag("-Werror -Wstring-conversion" CXX_SUPPORTS_NO_STRING_CONVERSION_FLAG)
if (CXX_SUPPORTS_NO_STRING_CONVERSION_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-string-conversion")
endif()
endif() # Clang.

check_cxx_compiler_flag("-Werror -Wnested-anon-types" CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG)
if (CXX_SUPPORTS_NO_NESTED_ANON_TYPES_FLAG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nested-anon-types")
endif()

# Add to or adjust build type flags.
#
# TODO: This needs some extra thought. CMake's default for release builds
# Add to or adjust build type flags.
#
# TODO: This needs some extra thought. CMake's default for release builds
# is -O3, which can cause build failures on certain platforms (and compilers)
# with the current code base -- some templated functions are inlined and don't
# become available at link time when using -O3 (with Clang under MacOS/darwin).
# If we reset CMake's default flags we also clobber any user provided settings;
# If we reset CMake's default flags we also clobber any user provided settings;
# make it difficult to customize a build in this regard... The setup below
# has this side effect but enables successful builds across multiple platforms
# in release mode...
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUGF18")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DCHECK=\"(void)\"") # do we need -O2 here?
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
# has this side effect but enables successful builds across multiple platforms
# in release mode...
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUGF18")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DCHECK=(void)") # do we need -O2 here?
set(CMAKE_CXX_FLAGS_RELEASE "-O2")

if (GCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --gcc-toolchain=${GCC}")
endif()

# Building shared libraries is bad for performance with GCC by default
# Building shared libraries is death on performance with GCC by default
# due to the need to preserve the right to override external entry points
if (BUILD_SHARED_LIBS AND NOT (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fno-semantic-interposition")
Expand Down Expand Up @@ -330,11 +326,11 @@ if (FLANG_BUILD_TOOLS)
endif()
add_subdirectory(runtime)

if (FLANG_INCLUDE_TESTS)
enable_testing()
add_subdirectory(test)
add_subdirectory(unittests)
endif()
option(FLANG_INCLUDE_TESTS
"Generate build targets for the Flang unit tests."
${LLVM_INCLUDE_TESTS})
enable_testing()
add_subdirectory(test)

option(FLANG_INCLUDE_DOCS "Generate build targets for the Flang docs."
${LLVM_INCLUDE_DOCS})
Expand Down Expand Up @@ -370,9 +366,10 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
FILES_MATCHING
PATTERN "*.def"
PATTERN "*.h"
PATTERN "*.inc"
PATTERN "*.td"
PATTERN "*.inc"
PATTERN "config.h" EXCLUDE
PATTERN ".git" EXCLUDE
PATTERN "CMakeFiles" EXCLUDE)
PATTERN "CMakeFiles" EXCLUDE
PATTERN "*")
endif()

Loading