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

Require C++17 for Halide. #5282

Merged
merged 83 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
b6ddbc1
parent a23995175f0d3f253bd26dd58a9b2df5efa6bf45 author Steven Johnson…
steven-johnson Sep 24, 2020
461c7d5
Check _MSVC_LANG
steven-johnson Sep 24, 2020
57918d8
Merge branch 'master' into srj/c++17
steven-johnson Sep 30, 2020
6f7c679
Merge branch 'master' into srj/c++17
steven-johnson Sep 30, 2020
b0400c3
Merge branch 'master' into srj/c++17
steven-johnson Oct 5, 2020
ffc8a26
Merge branch 'master' into srj/c++17
steven-johnson Nov 2, 2020
fd4a18e
Fix for trunk LLVM
steven-johnson Nov 2, 2020
83bd779
fixes
steven-johnson Nov 2, 2020
8be3b6a
Fix various clang-tidy issues
steven-johnson Nov 2, 2020
b16603e
Merge branch 'srj/tidyness' into srj/c++17
steven-johnson Nov 2, 2020
9154de1
Merge remote-tracking branch 'origin/srj/llvm-fix' into srj/c++17
steven-johnson Nov 2, 2020
6b6282f
Update HalideTraceViz.cpp
steven-johnson Nov 2, 2020
f3b33f2
Update HalideTraceViz.cpp
steven-johnson Nov 2, 2020
a88c088
more fixes
steven-johnson Nov 2, 2020
e320f3f
Merge branch 'srj/tidyness' into srj/c++17
steven-johnson Nov 2, 2020
6cf73b6
Update FindCalls.cpp
steven-johnson Nov 2, 2020
0563c8b
Upgrade PyBind11 version in CMake to 2.5
steven-johnson Nov 2, 2020
5da13a4
Merge branch 'master' into srj/pb11-25
steven-johnson Nov 2, 2020
f7d6ddd
Merge branch 'master' into srj/c++17
steven-johnson Nov 2, 2020
60f35bb
Merge branch 'srj/pb11-25' into srj/c++17
steven-johnson Nov 2, 2020
61e02b7
Merge branch 'master' into srj/c++17
steven-johnson Jan 11, 2021
e45027d
Update Generator.h
steven-johnson Jan 11, 2021
9bc6235
Update Generator.h
steven-johnson Jan 11, 2021
5a622f9
Merge branch 'master' into srj/c++17
steven-johnson Jan 12, 2021
bba6013
Update Generator.cpp
steven-johnson Jan 12, 2021
134d220
Merge branch 'master' into srj/c++17
steven-johnson Jan 13, 2021
d5fee91
Update README.md
steven-johnson Jan 14, 2021
536bd98
Fix typo
steven-johnson Jan 14, 2021
d099320
Revert apps, tests, tutorials to C++11
steven-johnson Jan 14, 2021
f841543
Update build.gradle
steven-johnson Jan 14, 2021
b426493
Update build.gradle
steven-johnson Jan 14, 2021
6bfc31b
Update setup.py
steven-johnson Jan 14, 2021
d78b147
Update Makefile
steven-johnson Jan 14, 2021
0d68640
Update Generator.cpp
steven-johnson Jan 14, 2021
0fb5c60
Tutorials back to C++11
steven-johnson Jan 14, 2021
e9bdcdd
Update setup.py
steven-johnson Jan 14, 2021
04d6914
Merge branch 'master' into srj/c++17
steven-johnson Jan 15, 2021
a1db9d7
Merge branch 'master' into srj/c++17
steven-johnson Jan 15, 2021
1652a4b
Update Generator.cpp
steven-johnson Jan 15, 2021
6491f29
Update Generator.cpp
steven-johnson Jan 15, 2021
df73068
Update Generator.cpp
steven-johnson Jan 15, 2021
7b5e7cd
Update Generator.cpp
steven-johnson Jan 15, 2021
8e16be5
Update Generator.cpp
steven-johnson Jan 15, 2021
799e9a6
Update Generator.cpp
steven-johnson Jan 15, 2021
d8ea2aa
Merge branch 'master' into srj/c++17
steven-johnson Jan 19, 2021
e18328a
Update Generator.cpp
steven-johnson Jan 20, 2021
d4fecdf
Update Generator.cpp
steven-johnson Jan 20, 2021
bbe6f44
Merge branch 'master' into srj/c++17
steven-johnson Jan 21, 2021
dced269
Merge branch 'master' into srj/c++17
steven-johnson Jan 21, 2021
b53c015
trigger buildbots
steven-johnson Jan 22, 2021
6052d70
trigger buildbots
steven-johnson Jan 25, 2021
02dfc43
trigger buildbots
steven-johnson Jan 25, 2021
04d5d26
Merge branch 'master' into srj/c++17
steven-johnson Jan 26, 2021
70387fe
Update interpreter.cpp
steven-johnson Jan 26, 2021
c9ca274
Update interpreter.cpp
steven-johnson Jan 26, 2021
38cf498
Merge branch 'master' into srj/c++17
steven-johnson Jan 26, 2021
446e2cf
Merge branch 'master' into srj/c++17
steven-johnson Feb 3, 2021
3853ddd
Update Timer.h
steven-johnson Feb 3, 2021
d62e147
Merge branch 'master' into srj/c++17
steven-johnson Feb 6, 2021
cf39a14
Merge branch 'master' into srj/c++17
steven-johnson Mar 1, 2021
161b385
clang-format
steven-johnson Mar 1, 2021
26a120c
Merge branch 'master' into srj/c++17
steven-johnson Apr 9, 2021
697bde1
Merge branch 'master' into srj/c++17
steven-johnson Apr 19, 2021
073d881
Merge branch 'master' into srj/c++17
steven-johnson May 17, 2021
f1f5e56
Merge branch 'master' into srj/c++17
steven-johnson May 20, 2021
e1c2769
Merge branch 'master' into srj/c++17
alexreinking May 24, 2021
b0c6426
add a hint to Clang package search
alexreinking May 24, 2021
bb12849
Compile runtime with -std=c++17
alexreinking May 24, 2021
da9b812
Use simpler method to set default BUILD_SHARED_LIBS
alexreinking May 24, 2021
232aead
make sure C++17 requirement propagates to libHalide consumers
alexreinking May 25, 2021
cd6c8da
Merge branch 'master' into srj/c++17
steven-johnson Jun 3, 2021
b50bedc
Fixes
steven-johnson Jun 3, 2021
377c2b6
Update apps, tutorials, etc
steven-johnson Jun 3, 2021
1eb8b18
Add user-facing C++ version check
steven-johnson Jun 3, 2021
4b5091f
Force tflite to build in C++17 mode.
steven-johnson Jun 4, 2021
f0d717a
Oops
steven-johnson Jun 4, 2021
354eff3
Experimental fix for hannk
steven-johnson Jun 4, 2021
ff1e67c
More fix attempts
steven-johnson Jun 4, 2021
c8fd401
Still more
steven-johnson Jun 4, 2021
abce80a
Update CMakeLists.txt
steven-johnson Jun 4, 2021
2e48574
Merge branch 'master' into srj/c++17
steven-johnson Jun 7, 2021
f1a84b8
Update README_cmake.md
steven-johnson Jun 7, 2021
64d1cda
Revert unrelated change
steven-johnson Jun 7, 2021
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
2 changes: 1 addition & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
Standard: c++11
Standard: c++17
TabWidth: 8
UseTab: Never
...
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ include(MakeShellPath)
include(CMakeDependentOption)

# Build Halide as a shared lib by default, but still honor command-line settings.
if (NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS YES)
endif ()
option(BUILD_SHARED_LIBS "Build shared libraries" ON)

# Warn if the user did not set a build type and is using a single-configuration generator.
get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
Expand All @@ -40,13 +38,13 @@ endif ()
# Export all symbols on Windows to match GCC/Clang behavior on Linux/macOS
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)

# Require standard C++14
# Require standard C++17
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
elseif(CMAKE_CXX_STANDARD LESS 14)
message(FATAL_ERROR "Halide requires C++14 or newer")
elseif(CMAKE_CXX_STANDARD LESS 17)
message(FATAL_ERROR "Halide requires C++17 or newer")
endif()

# Build Halide with ccache if the package is present
Expand Down
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ LLVM_GIT_LLD_INCLUDE_DIR = $(shell $(LLVM_CONFIG) --src-root | sed -e 's/\\/\//g
LLVM_SYSTEM_LIBS=$(shell ${LLVM_CONFIG} --system-libs --link-static | sed -e 's/[\/&]/\\&/g' | sed 's/-llibxml2.tbd/-lxml2/')
LLVM_AS = $(LLVM_BINDIR)/llvm-as
LLVM_NM = $(LLVM_BINDIR)/llvm-nm
LLVM_CXX_FLAGS = -std=c++11 $(filter-out -O% -g -fomit-frame-pointer -pedantic -W% -W, $(shell $(LLVM_CONFIG) --cxxflags | sed -e 's/\\/\//g' -e 's/\([a-zA-Z]\):/\/\1/g;s/-D/ -D/g;s/-O/ -O/g')) -I$(LLVM_GIT_LLD_INCLUDE_DIR)
LLVM_CXX_FLAGS = -std=c++17 $(filter-out -O% -g -fomit-frame-pointer -pedantic -W% -W, $(shell $(LLVM_CONFIG) --cxxflags | sed -e 's/\\/\//g' -e 's/\([a-zA-Z]\):/\/\1/g;s/-D/ -D/g;s/-O/ -O/;s/c++14/c++17/g')) -I$(LLVM_GIT_LLD_INCLUDE_DIR)
OPTIMIZE ?= -O3
OPTIMIZE_FOR_BUILD_TIME ?= -O0

Expand Down Expand Up @@ -252,7 +252,7 @@ LLVM_SHARED_LIBS = -Wl,-rpath=$(LLVM_LIBDIR) -L $(LLVM_LIBDIR) -lLLVM

LLVM_LIBS_FOR_SHARED_LIBHALIDE=$(if $(WITH_LLVM_INSIDE_SHARED_LIBHALIDE),$(LLVM_STATIC_LIBS),$(LLVM_SHARED_LIBS))

TUTORIAL_CXX_FLAGS ?= -std=c++11 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP)
TUTORIAL_CXX_FLAGS ?= -std=c++17 -g -fno-omit-frame-pointer $(RTTI_CXX_FLAGS) -I $(ROOT_DIR)/tools $(SANITIZER_FLAGS) $(LLVM_CXX_FLAGS_LIBCPP)
# The tutorials contain example code with warnings that we don't want
# to be flagged as errors, so the test flags are the tutorial flags
# plus our warning flags.
Expand Down Expand Up @@ -941,8 +941,8 @@ $(INCLUDE_DIR)/Halide.h: $(SRC_DIR)/../LICENSE.txt $(HEADERS) $(BIN_DIR)/build_h
$(BIN_DIR)/build_halide_h $(SRC_DIR)/../LICENSE.txt $(HEADERS) > $(INCLUDE_DIR)/Halide.h
# Also generate a precompiled version in the same folder so that anything compiled with a compatible set of flags can use it
@mkdir -p $(INCLUDE_DIR)/Halide.h.gch
$(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch
$(CXX) -std=c++11 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch
$(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.default.gch
$(CXX) -std=c++17 $(TEST_CXX_FLAGS) -I$(ROOT_DIR) $(OPTIMIZE_FOR_BUILD_TIME) -x c++-header $(INCLUDE_DIR)/Halide.h -o $(INCLUDE_DIR)/Halide.h.gch/Halide.test.gch

$(INCLUDE_DIR)/HalideRuntime%: $(SRC_DIR)/runtime/HalideRuntime%
echo Copying $<
Expand All @@ -966,7 +966,7 @@ $(INCLUDE_DIR)/HalidePyTorchCudaHelpers.h: $(SRC_DIR)/runtime/HalidePyTorchCudaH

$(BIN_DIR)/build_halide_h: $(ROOT_DIR)/tools/build_halide_h.cpp
@-mkdir -p $(@D)
$(CXX) -std=c++11 $< -o $@
$(CXX) -std=c++17 $< -o $@

-include $(OBJECTS:.o=.d)
-include $(INITIAL_MODULES:.o=.d)
Expand All @@ -991,7 +991,7 @@ RUNTIME_TRIPLE_WIN_GENERIC_64 = "le64-unknown-windows-unknown"

# `-fno-threadsafe-statics` is very important here (note that it allows us to use a 'modern' C++
# standard but still skip threadsafe guards for static initialization in our runtime code)
RUNTIME_CXX_FLAGS = -std=c++11 -O3 -fno-vectorize -ffreestanding -fno-blocks -fno-exceptions -fno-unwind-tables -fno-threadsafe-statics
RUNTIME_CXX_FLAGS = -std=c++17 -O3 -fno-vectorize -ffreestanding -fno-blocks -fno-exceptions -fno-unwind-tables -fno-threadsafe-statics

$(BUILD_DIR)/initmod.windows_%_x86_32.ll: $(SRC_DIR)/runtime/windows_%_x86.cpp $(BUILD_DIR)/clang_ok
@mkdir -p $(@D)
Expand Down Expand Up @@ -1700,7 +1700,7 @@ $(FILTERS_DIR)/%.registration.o: $(FILTERS_DIR)/%.registration.cpp

$(FILTERS_DIR)/%.rungen: $(BUILD_DIR)/RunGenMain.o $(BIN_DIR)/$(TARGET)/runtime.a $(FILTERS_DIR)/%.registration.o $(FILTERS_DIR)/%.a
@mkdir -p $(@D)
$(CXX) -std=c++11 -I$(FILTERS_DIR) \
$(CXX) -std=c++17 -I$(FILTERS_DIR) \
$(BUILD_DIR)/RunGenMain.o \
$(BIN_DIR)/$(TARGET)/runtime.a \
$(call alwayslink,$(FILTERS_DIR)/$*.registration.o) \
Expand Down Expand Up @@ -1756,7 +1756,7 @@ $(FILTERS_DIR)/multi_rungen: $(BUILD_DIR)/RunGenMain.o $(BIN_DIR)/$(TARGET)/runt
$(FILTERS_DIR)/cxx_mangling.registration.o $(FILTERS_DIR)/cxx_mangling.a \
$(FILTERS_DIR)/pyramid.registration.o $(FILTERS_DIR)/pyramid.a
@mkdir -p $(@D)
$(CXX) -std=c++11 -I$(FILTERS_DIR) \
$(CXX) -std=c++17 -I$(FILTERS_DIR) \
$(BUILD_DIR)/RunGenMain.o \
$(BIN_DIR)/$(TARGET)/runtime.a \
$(call alwayslink,$(FILTERS_DIR)/blur2x2.registration.o) \
Expand All @@ -1777,7 +1777,7 @@ $(FILTERS_DIR)/multi_rungen2: $(BUILD_DIR)/RunGenMain.o $(BIN_DIR)/$(TARGET)/run
$(FILTERS_DIR)/cxx_mangling.a \
$(FILTERS_DIR)/pyramid.a
@mkdir -p $(@D)
$(CXX) -std=c++11 -I$(FILTERS_DIR) $^ $(GEN_AOT_LD_FLAGS) $(IMAGE_IO_LIBS) -o $@
$(CXX) -std=c++17 -I$(FILTERS_DIR) $^ $(GEN_AOT_LD_FLAGS) $(IMAGE_IO_LIBS) -o $@

$(BIN_DIR)/tutorial_%: $(ROOT_DIR)/tutorial/%.cpp $(BIN_DIR)/libHalide.$(SHARED_EXT) $(INCLUDE_DIR)/Halide.h $(INCLUDE_DIR)/HalideRuntime.h
@ if [[ $@ == *_run ]]; then \
Expand Down Expand Up @@ -2323,10 +2323,10 @@ $(DISTRIB_DIR)/halide.tgz: distrib
mv $(BUILD_DIR)/halide.tgz $(DISTRIB_DIR)/halide.tgz

$(BIN_DIR)/HalideTraceViz: $(ROOT_DIR)/util/HalideTraceViz.cpp $(INCLUDE_DIR)/HalideRuntime.h $(ROOT_DIR)/tools/halide_image_io.h $(ROOT_DIR)/tools/halide_trace_config.h
$(CXX) $(OPTIMIZE) -std=c++11 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -L$(BIN_DIR) -o $@
$(CXX) $(OPTIMIZE) -std=c++17 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -L$(BIN_DIR) -o $@

$(BIN_DIR)/HalideTraceDump: $(ROOT_DIR)/util/HalideTraceDump.cpp $(ROOT_DIR)/util/HalideTraceUtils.cpp $(INCLUDE_DIR)/HalideRuntime.h $(ROOT_DIR)/tools/halide_image_io.h
$(CXX) $(OPTIMIZE) -std=c++11 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -I$(ROOT_DIR)/src/runtime -L$(BIN_DIR) $(IMAGE_IO_CXX_FLAGS) $(IMAGE_IO_LIBS) -o $@
$(CXX) $(OPTIMIZE) -std=c++17 $(filter %.cpp,$^) -I$(INCLUDE_DIR) -I$(ROOT_DIR)/tools -I$(ROOT_DIR)/src/runtime -L$(BIN_DIR) $(IMAGE_IO_CXX_FLAGS) $(IMAGE_IO_LIBS) -o $@

# Note: you must have CLANG_FORMAT_LLVM_INSTALL_DIR set for this rule to work.
# Let's default to the Ubuntu install location.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ to an object file, or JIT-compile it and run it in the same process. Halide also
provides a Python binding that provides full support for writing Halide embedded
in Python without C++.

Halide requires C++17 (or later) to use.

For more detail about what Halide is, see http://halide-lang.org.

For API documentation see http://halide-lang.org/docs
Expand Down Expand Up @@ -97,7 +99,7 @@ Windows 7 and includes Ubuntu 18.04 LTS.

Compiled AOT pipelines are expected to have much broader platform support. The
binaries use the C ABI, and we expect any compliant C compiler to be able to use
the generated headers correctly. The C++ bindings currently require C++11. If
the generated headers correctly. The C++ bindings currently require C++17. If
you discover a compatibility problem with a generated pipeline, please open an
issue.

Expand Down
4 changes: 2 additions & 2 deletions README_cmake.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ boilerplate.
cmake_minimum_required(VERSION 3.16)
project(HalideExample)

set(CMAKE_CXX_STANDARD 11) # or newer
set(CMAKE_CXX_STANDARD 17) # or newer
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand All @@ -558,7 +558,7 @@ immediately after setting the minimum version.

The next three variables set the project-wide C++ standard. The first,
[`CMAKE_CXX_STANDARD`][cmake_cxx_standard], simply sets the standard version.
Halide requires at least C++11. The second,
Halide requires at least c++17. The second,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: capital C++

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@steven-johnson - can you fix this one little thing before merging? No need to wait on buildbots for this, obviously.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

[`CMAKE_CXX_STANDARD_REQUIRED`][cmake_cxx_standard_required], tells CMake to
fail if the compiler cannot provide the requested standard version. Lastly,
[`CMAKE_CXX_EXTENSIONS`][cmake_cxx_extensions] tells CMake to disable
Expand Down
2 changes: 1 addition & 1 deletion apps/HelloAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ sources {
executables {
hello_generator {
binaries.all {
cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include"
cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include"
// "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build
linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib"
}
Expand Down
2 changes: 1 addition & 1 deletion apps/HelloAndroid/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -e
android update project -p . --target android-17
mkdir -p bin
c++ jni/hello_generator.cpp ../../tools/GenGen.cpp \
-g -fno-rtti -Wall -std=c++11 \
-g -fno-rtti -Wall -std=c++17 \
-I ../../include -I ../../build/include \
-L ../../bin -lHalide -ldl -lpthread -lz \
-o bin/hello_generator
Expand Down
2 changes: 1 addition & 1 deletion apps/HelloAndroid/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86
APP_PLATFORM := android-17
APP_STL := gnustl_static
APP_CPPFLAGS := -std=c++11
APP_CPPFLAGS := -std=c++17
2 changes: 1 addition & 1 deletion apps/HelloAndroidCamera2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ sources {
executables {
halide_generator {
binaries.all {
cppCompiler.args "-std=c++11", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include"
cppCompiler.args "-std=c++17", "-g", "-Wall", "-fno-rtti", "-I", "${projectDir}/../../include", "-I", "${projectDir}/../../build/include"
// "/bin" assumes Makefile build for Halide; "/build/lib" assumes CMake build
linker.args "-lHalide", "-ldl", "-lpthread", "-lz", "-L", "${projectDir}/../../bin", "-L", "${projectDir}/../../build/lib"
}
Expand Down
4 changes: 2 additions & 2 deletions apps/HelloAndroidCamera2/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ fi
mkdir -p bin

c++ jni/edge_detect_generator.cpp ../../tools/GenGen.cpp \
-g -fno-rtti -Wall -std=c++11 \
-g -fno-rtti -Wall -std=c++17 \
-I ../../include -I ../../build/include \
-L ../../bin -lHalide -ldl -lpthread -lz \
-o bin/edge_detect_generator

c++ jni/deinterleave_generator.cpp ../../tools/GenGen.cpp \
-g -fno-rtti -Wall -std=c++11 \
-g -fno-rtti -Wall -std=c++17 \
-I ../../include -I ../../build/include \
-L ../../bin -lHalide -ldl -lpthread -lz \
-o bin/deinterleave_generator
Expand Down
2 changes: 1 addition & 1 deletion apps/HelloAndroidCamera2/jni/Application.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
APP_ABI := armeabi armeabi-v7a arm64-v8a mips x86_64 x86
APP_PLATFORM := android-21
APP_STL := c++_static
APP_CPPFLAGS := -std=c++11 -fno-rtti -fexceptions
APP_CPPFLAGS := -std=c++17 -fno-rtti -fexceptions
2 changes: 1 addition & 1 deletion apps/HelloWasm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(HelloWasm)

enable_testing()

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/HelloiOS/HelloiOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/bash;
shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++11 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n";
shellScript = "echo \"${SRCROOT}\"\ncd \"${SRCROOT}/HelloiOS\"\n\n# Echoing commands to output makes it easier to debug XCode failures.\n# Failure on undefined vars is always a good idea.\nset -ex\n\n# xcode puts all sorts of junk in the environment which\n# prevents building a binary for osx (instead of ios).\n# sudo'ing to yourself gives a fresh environment.\nsudo -u ${USER} \\\nc++ reaction_diffusion_2_generator.cpp ${SRCROOT}/../../tools/GenGen.cpp \\\n-std=c++17 \\\n-fno-rtti \\\n-I ${SRCROOT}/../../include \\\n-I ${SRCROOT}/../../build/include \\\n-I ${SRCROOT}/../../tools \\\n-arch x86_64 \\\n-L ${SRCROOT}/../../bin \\\n-lHalide \\\n-o ${DERIVED_FILE_DIR}/reaction_diffusion_2_generator\n\n\nif [ \"${arch}\" == \"x86_64\" ]\nthen\n# assume simulator, which requires osx rather than ios\nTARGET=x86-64-osx\nelse\n# TODO: sniff arm-32 builds here; for now, just assume arm-64 only\nTARGET=arm-64-ios\nfi\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_${GEN} -n reaction_diffusion_2_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-user_context)\ndone\n\nfor GEN in init update render; do\n(cd ${DERIVED_FILE_DIR}; \\\nDYLD_LIBRARY_PATH=${SRCROOT}/../../bin:${SRCROOT}/../../build/lib \\\n./reaction_diffusion_2_generator -g reaction_diffusion_2_${GEN} -f reaction_diffusion_2_metal_${GEN} -n reaction_diffusion_2_metal_${GEN} -o ${DERIVED_FILE_DIR} target=${TARGET}-metal-user_context)\ndone\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
2 changes: 1 addition & 1 deletion apps/bgu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(bgu)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/bilateral_grid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(bilateral_grid)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/blur/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(blur)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/c_backend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(c_backend)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/camera_pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(camera_pipe)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/conv_layer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(conv_layer)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/cuda_mat_mul/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif ()
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/depthwise_separable_conv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(depthwise_separable_conv)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/fft/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ project(fft)
enable_testing()

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
2 changes: 1 addition & 1 deletion apps/fft/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ $(BIN)/%/fft_inverse_c2c.a: $(GENERATOR_BIN)/fft.generator

$(BIN)/%/fft_aot_test: fft_aot_test.cpp $(BIN)/%/fft_forward_r2c.a $(BIN)/%/fft_inverse_c2r.a $(BIN)/%/fft_forward_c2c.a $(BIN)/%/fft_inverse_c2c.a
@mkdir -p $(@D)
$(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++11 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS)
$(CXX) -I$(BIN)/$* -I$(HALIDE_DISTRIB_PATH)/include/ -std=c++17 $^ -o $@ $(LDFLAGS) $(HALIDE_SYSTEM_LIBS)

clean:
rm -rf $(BIN)
Expand Down
2 changes: 1 addition & 1 deletion apps/hannk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ enable_testing()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

# Set up language settings
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

Expand Down
24 changes: 18 additions & 6 deletions apps/hannk/delegate/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
# --------------- registrar (static-library) delegate

add_library(hannk_delegate_registrar STATIC
hannk_delegate_provider.cpp
add_library(hannk_delegate STATIC
hannk_delegate.cpp)
target_link_libraries(hannk_delegate PRIVATE
hannk_log_tflite
interpreter_lower
tensorflowlite_headers
Halide::Runtime)
target_include_directories(hannk_delegate PRIVATE
$<BUILD_INTERFACE:${hannk_SOURCE_DIR}>)

# --------------- registrar (static-library) delegate

add_library(hannk_delegate_registrar STATIC
hannk_delegate_provider.cpp)
target_link_libraries(hannk_delegate_registrar PRIVATE
interpreter
error_util
interpreter
hannk_delegate
hannk_log_tflite
tensorflowlite_headers
Halide::Runtime)
Expand All @@ -19,11 +31,11 @@ target_include_directories(hannk_delegate_registrar PRIVATE
# on Mac we must declare the library to be MODULE rather than SHARED to get this.
# Apparently on Linux they are basically the same, so, use it everywhere for now.
add_library(hannk_delegate_external MODULE
hannk_delegate_adaptor.cpp
hannk_delegate.cpp)
hannk_delegate_adaptor.cpp)
target_link_libraries(hannk_delegate_external PRIVATE
interpreter
error_util
interpreter
hannk_delegate
hannk_log_tflite
tensorflowlite_headers
Halide::Runtime)
Expand Down
8 changes: 6 additions & 2 deletions apps/hannk/interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,17 @@ add_library(elementwise_program STATIC
target_include_directories(elementwise_program PUBLIC $<BUILD_INTERFACE:${hannk_SOURCE_DIR}>)
target_link_libraries(elementwise_program PRIVATE Halide::Runtime)

add_library(interpreter_lower STATIC
lower.cpp)
target_include_directories(interpreter_lower PUBLIC $<BUILD_INTERFACE:${hannk_SOURCE_DIR}>)
target_link_libraries(interpreter_lower PRIVATE Halide::Runtime)

add_library(interpreter STATIC
interpreter.cpp
interval.cpp
lower.cpp
model.cpp
ops.cpp
transforms.cpp)
target_include_directories(interpreter PUBLIC $<BUILD_INTERFACE:${hannk_SOURCE_DIR}>)
target_link_libraries(interpreter PRIVATE elementwise_program op_impls Halide::Runtime)
target_link_libraries(interpreter PRIVATE elementwise_program op_impls interpreter_lower Halide::Runtime)

Loading