Skip to content

Commit

Permalink
fable: Update examples to use modern CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
cassava committed Mar 31, 2023
1 parent 1230015 commit 6f06b12
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
11 changes: 4 additions & 7 deletions fable/examples/contacts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ BUILD_DIR := build
# The build type must be synchronized between Conan (host build type)
# and CMake, otherwise you will get strange and unhelpful errors.
BUILD_TYPE := Release
CMAKE_BUILD_TYPE := $(shell echo ${BUILD_TYPE} | tr '[:upper:]' '[:lower:]')

# This is the output that Conan generates when using
# `CMakeToolchain` generator AND the `cmake_layout` layout.
TOOLCHAIN_FILE := ${BUILD_DIR}/generators/conan_toolchain.cmake
TOOLCHAIN_FILE := ${BUILD_DIR}/${BUILD_TYPE}/generators/conan_toolchain.cmake

.PHONY: all clean
all: ${TOOLCHAIN_FILE}
cmake --build ${BUILD_DIR}
cmake --build --preset=${CMAKE_BUILD_TYPE}

${TOOLCHAIN_FILE}:
conan install . --build=missing --install-folder=${BUILD_DIR} -s:h build_type=${BUILD_TYPE}
cmake -B ${BUILD_DIR} -S . \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build ${BUILD_DIR}
cmake --preset=${CMAKE_BUILD_TYPE} -DCMAKE_EXPORT_COMPILE_COMMANDS=1

clean:
-rm -r ${BUILD_DIR}
9 changes: 3 additions & 6 deletions fable/examples/simple_config/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,19 @@ BUILD_DIR := build
# The build type must be synchronized between Conan (host build type)
# and CMake, otherwise you will get strange and unhelpful errors.
BUILD_TYPE := Release
CMAKE_BUILD_TYPE := $(shell echo ${BUILD_TYPE} | tr '[:upper:]' '[:lower:]')

# This is the output that Conan generates when using
# `CMakeToolchain` generator AND the `cmake_layout` layout.
TOOLCHAIN_FILE := ${BUILD_DIR}/generators/conan_toolchain.cmake

.PHONY: all clean
all: ${TOOLCHAIN_FILE}
cmake --build ${BUILD_DIR}
cmake --build --preset=${CMAKE_BUILD_TYPE}

${TOOLCHAIN_FILE}:
conan install . --build=missing --install-folder=${BUILD_DIR} -s:h build_type=${BUILD_TYPE}
cmake -B ${BUILD_DIR} -S . \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1
cmake --build ${BUILD_DIR}
cmake --preset=${CMAKE_BUILD_TYPE} -DCMAKE_EXPORT_COMPILE_COMMANDS=1

clean:
-rm -r ${BUILD_DIR}

0 comments on commit 6f06b12

Please sign in to comment.