Skip to content

Commit

Permalink
Drop conan. Build with cmake.
Browse files Browse the repository at this point in the history
  • Loading branch information
lucteo committed May 6, 2024
1 parent 219d7af commit 50da8d7
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 114 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
CMakePresets.json

# Build system
.build
build
CMakeUserPresets.json
test_package/conan.lock
Expand Down
15 changes: 14 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@
cmake_minimum_required(VERSION 3.24)
project(context_core_api CXX C)

find_package(Boost COMPONENTS context CONFIG REQUIRED)
include(FetchContent)

set(BOOST_INCLUDE_LIBRARIES context)
set(BOOST_ENABLE_CMAKE ON)

FetchContent_Declare(
Boost
URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz
URL_MD5 893b5203b862eb9bbd08553e24ff146a
DOWNLOAD_EXTRACT_TIMESTAMP ON
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(Boost)

add_library(context_core_api src/context_core_api.cpp)
target_include_directories(context_core_api PUBLIC include)
Expand All @@ -12,6 +24,7 @@ set_target_properties(context_core_api PROPERTIES PUBLIC_HEADER "include/context
# Turn on warning-as-error
set_property(TARGET context_core_api PROPERTY COMPILE_WARNING_AS_ERROR ON)

option(WITH_TESTS "Build the tests" OFF)
message(STATUS "With tests: ${WITH_TESTS}")
if(${WITH_TESTS})
add_subdirectory(test)
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,25 @@
# context-core-api
Exposing Boost.Context core API

## Building

1. **Configure step**

Execute the following:
```
cmake -G Ninja -S . -B <build-directory> -D CMAKE_BUILD_TYPE=<build-type> -DWITH_TESTS=On \
```
where `<build-directory>` is a build directory (usually `.build` or `build`), and `<build-type>` is the build type (usually `Debug` or `Release`).

2. **Build step**
```
cmake --build <build-directory>
```

3. **Test step**

For this step, `WITH_TESTS` needs to be set to `ON` in the configure step.

```
ctest --test-dir <build-directory>/test
```
75 changes: 0 additions & 75 deletions conanfile.py

This file was deleted.

7 changes: 0 additions & 7 deletions test_package/CMakeLists.txt

This file was deleted.

26 changes: 0 additions & 26 deletions test_package/conanfile.py

This file was deleted.

5 changes: 0 additions & 5 deletions test_package/src/example.cpp

This file was deleted.

0 comments on commit 50da8d7

Please sign in to comment.