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

fix Linux Release CI #377

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
cd92a51
Refactor core/resolver/resolve.hpp
ken-matsui Jan 4, 2021
eff1875
Fix bug that failing to resolve packages
ken-matsui Jan 4, 2021
cd56d7b
Remove core::except from core::resolver
ken-matsui Jan 4, 2021
08c22cc
Improve build command
ken-matsui Jan 4, 2021
0f6176a
Remove core::except completely
ken-matsui Jan 4, 2021
71d7aa4
Merge pull request #361 from poacpm/improve/build-cmd
ken-matsui Jan 5, 2021
9a3afc6
Merge branch 'master' into refactor/resolve
ken-matsui Jan 5, 2021
adc0178
Merge pull request #357 from poacpm/refactor/resolve
ken-matsui Jan 6, 2021
c0b8090
Merge branch 'master' into remove/except
ken-matsui Jan 6, 2021
e611695
Unify interface of new and init commands to Cargo
ken-matsui Jan 6, 2021
ac92aa0
Refactor cmd::init and cmd::new
ken-matsui Jan 6, 2021
c459260
Create _bold_green user-defined literal
ken-matsui Jan 6, 2021
be16bf5
Refactor termcolor2/literals_extra.hpp
ken-matsui Jan 6, 2021
337d32b
Remove macos-11.0 because it is broken frequently
ken-matsui Jan 6, 2021
ea33a6a
Merge pull request #363 from poacpm/remove/macos-11-1-ci
ken-matsui Jan 6, 2021
969eaae
Merge branch 'master' into remove/except
ken-matsui Jan 6, 2021
34527e3
Improve util::pretty
ken-matsui Jan 6, 2021
4e8ea76
Merge pull request #360 from poacpm/remove/except
ken-matsui Jan 6, 2021
48fb914
Merge branch 'master' into unify/new-and-init
ken-matsui Jan 6, 2021
efd0000
Refactor core::resolver::sat
ken-matsui Jan 6, 2021
93049c4
Improve usage of try/catch
ken-matsui Jan 6, 2021
324351a
Merge pull request #362 from poacpm/unify/new-and-init
ken-matsui Jan 6, 2021
9fcc850
Merge branch 'master' into improve/pretty
ken-matsui Jan 6, 2021
5020c5e
Merge pull request #364 from poacpm/improve/pretty
ken-matsui Jan 6, 2021
1c4e0cc
Merge branch 'master' into refactor/sat
ken-matsui Jan 6, 2021
905b2d5
Unify format of util::pretty to Cargo
ken-matsui Jan 6, 2021
e488642
Improve util::meta::time_to_string
ken-matsui Jan 6, 2021
833787a
Create util/execution_time.hpp
ken-matsui Jan 6, 2021
7187560
Merge pull request #365 from poacpm/refactor/sat
ken-matsui Jan 6, 2021
d1d3722
Merge branch 'master' into improve/catch
ken-matsui Jan 6, 2021
dfa0b38
Merge pull request #366 from poacpm/improve/catch
ken-matsui Jan 6, 2021
e844c9c
Merge branch 'master' into unify/pretty
ken-matsui Jan 6, 2021
53ce5c8
Merge pull request #367 from poacpm/unify/pretty
ken-matsui Jan 7, 2021
82b3d12
Merge branch 'master' into improve/time-to-string
ken-matsui Jan 7, 2021
0b2ef1e
Merge pull request #368 from poacpm/improve/time-to-string
ken-matsui Jan 7, 2021
d04d55d
Merge branch 'master' into create/execution-time
ken-matsui Jan 7, 2021
e4a2c63
Merge pull request #369 from poacpm/create/execution-time
ken-matsui Jan 7, 2021
800193c
Create interface of build system
ken-matsui Jan 7, 2021
ffcefa8
Merge pull request #370 from poacpm/create/interface-of-build-system
ken-matsui Jan 7, 2021
ba553a7
Refactor include/poac/util/pretty.hpp
ken-matsui Jan 7, 2021
1c6939a
Merge pull request #371 from poacpm/refactor/pretty
ken-matsui Jan 7, 2021
151e4e4
Bump actions/upload-artifact from v2.2.1 to v2.2.2
dependabot[bot] Feb 1, 2021
4bedc7c
Merge pull request #372 from poacpm/dependabot/github_actions/actions…
ken-matsui Feb 1, 2021
2ff77e7
Add needed space in src/main.cpp
ken-matsui Feb 13, 2021
c110704
Remove Windows from supported OS temporarily
ken-matsui Feb 13, 2021
c9074cc
Merge pull request #373 from poacpm/ken-matsui-patch-1
ken-matsui Feb 13, 2021
04e9972
Merge branch 'master' into ken-matsui-patch-2
ken-matsui Feb 13, 2021
b3224c8
Merge pull request #374 from poacpm/ken-matsui-patch-2
ken-matsui Feb 13, 2021
d2d2f4c
Bump actions/cache from v2.1.3 to v2.1.4
dependabot[bot] Mar 1, 2021
0eb34be
Merge pull request #375 from poacpm/dependabot/github_actions/actions…
ken-matsui Mar 1, 2021
00651ee
Rename default branch master to main
ken-matsui Apr 1, 2021
575aede
Merge pull request #376 from poacpm/rename-master-to-main
ken-matsui Apr 1, 2021
48443a8
Merge branch 'main' into support/release-build-on-linux-ci
wx257osn2 Apr 8, 2021
5d26a81
kicking off the dirty database
wx257osn2 Apr 8, 2021
a28cebd
enable LTO by CMake manner
wx257osn2 Apr 8, 2021
e604d86
workaround for static link
wx257osn2 Apr 8, 2021
0ef44ef
static link needs static libraries
wx257osn2 Apr 8, 2021
fe19eef
add dependencies
wx257osn2 Apr 8, 2021
cb392fc
link libstdc++fs explicitly for old libstdc++
wx257osn2 Apr 8, 2021
471ddce
LINUX is not defined on default CMake
wx257osn2 Apr 8, 2021
e679362
fix typo
wx257osn2 Apr 8, 2021
6995813
install lld and use it for ThinLTO
wx257osn2 Apr 8, 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
6 changes: 3 additions & 3 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ allownonascii=$(git config --bool hooks.allownonascii)
# Redirect output to stderr.
exec 1>&2

# Prevent committing to master branch
if test "$(git symbolic-ref HEAD | sed -e 's:^refs/heads/::')" = master; then
# Prevent committing to main branch
if test "$(git symbolic-ref HEAD | sed -e 's:^refs/heads/::')" = main; then
cat <<\EOF
Error: Attempt to commit to master branch.
Error: Attempt to commit to main branch.

If you want to commit new changes, you can create a new branch, checkout, and commit using:

Expand Down
4 changes: 2 additions & 2 deletions .github/disabled_workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Linux

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]
env:
OPENSSL_VERSION: 'OpenSSL_1_1_1h'
BOOST_VERSION: 1.75.0
Expand Down
84 changes: 61 additions & 23 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Linux

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]
env:
OPENSSL_VERSION: 'OpenSSL_1_1_1h'
BOOST_VERSION: 1.75.0
Expand All @@ -20,52 +20,62 @@ jobs:
compiler:
- {
cc: clang-7, cxx: clang++-7,
pacakge: clang-7,
package: clang-7,
subpackage: lld-7,
}
- {
cc: clang-8, cxx: clang++-8,
pacakge: clang-8,
package: clang-8,
subpackage: lld-8,
}
- {
cc: clang-9, cxx: clang++-9,
pacakge: clang-9,
package: clang-9,
subpackage: lld-9,
}
- {
cc: clang-10, cxx: clang++-10,
pacakge: clang-10,
package: clang-10,
subpackage: lld-10,
}
- {
cc: gcc-8, cxx: g++-8,
pacakge: g++-8,
package: g++-8,
subpackage: binutils,
}
- {
cc: gcc-9, cxx: g++-9,
pacakge: g++-9,
package: g++-9,
subpackage: binutils,
}
- {
cc: gcc-10, cxx: g++-10,
pacakge: g++-10,
package: g++-10,
subpackage: binutils,
}
include:
- build_type: Coverage
compiler: {
cc: gcc-10, cxx: g++-10,
pacakge: g++-10,
package: g++-10,
subpackage: binutils,
}
env:
CC: ${{ matrix.compiler.cc }}
CXX: ${{ matrix.compiler.cxx }}
CACHE_KEY_PREFIX: ${{ github.job }}-${{ matrix.compiler.pacakge }}-${{ matrix.build_type }}
CACHE_KEY_PREFIX: ${{ github.job }}-${{ matrix.compiler.package }}-${{ matrix.build_type }}
steps:
- uses: actions/checkout@v2.3.4

- name: Install ${{ matrix.compiler.pacakge }}
- name: Install ${{ matrix.compiler.package }} and ${{ matrix.compiler.subpackage }}
run: |
sudo apt-get -qq clean
sudo apt-get -qq update
sudo apt-get install -y -qq pkg-config cmake ${{ matrix.compiler.pacakge }}
sudo apt-get install -y -qq pkg-config cmake ${{ matrix.compiler.package }} ${{ matrix.compiler.subpackage }}

- name: Restore & Cache CMake build results
uses: actions/cache@v2.1.3
if: matrix.build_type != 'Coverage'
uses: actions/cache@v2.1.4
with:
path: build
key: ${{ env.CACHE_KEY_PREFIX }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake') }}
Expand All @@ -76,7 +86,7 @@ jobs:

- name: Restore & Cache openssl (${{ env.OPENSSL_VERSION }})
if: startsWith(matrix.compiler.cc, 'gcc')
uses: actions/cache@v2.1.3
uses: actions/cache@v2.1.4
id: openssl-cache
with:
path: ${{ runner.temp }}/libs/openssl
Expand All @@ -94,7 +104,7 @@ jobs:
working-directory: ${{ runner.temp }}

- name: Restore & Cache boost (${{ env.BOOST_VERSION }})
uses: actions/cache@v2.1.3
uses: actions/cache@v2.1.4
id: boost-cache
with:
path: ${{ runner.temp }}/libs/boost
Expand All @@ -109,17 +119,45 @@ jobs:
sudo ./b2 link=static install -j2 --prefix=${{ runner.temp }}/libs/boost || exit 0
working-directory: ${{ runner.temp }}

- name: Install libacl
run: sudo apt-get install -y -qq libacl1-dev

- name: Install libarchive
run: sudo apt-get install -y -qq libarchive-dev

- name: Restore & Cache libgit2 (${{ env.LIBGIT2_VERSION }})
uses: actions/cache@v2.1.3
id: libgit2-cache
- name: Restore & Cache static libgit2 (${{ env.LIBGIT2_VERSION }})
uses: actions/cache@v2.1.4
if: matrix.build_type == 'Release'
id: libgit2-static-cache
with:
path: ${{ runner.temp }}/libs/libgit2
key: ${{ env.CACHE_KEY_PREFIX }}-libgit2-static-${{ env.LIBGIT2_VERSION }}
- name: Install libgit2 (${{ env.LIBGIT2_VERSION }}) as static
if: steps.libgit2-cache.outputs.cache-hit != 'true' && matrix.build_type == 'Release'
run: |
mkdir -p ${{ runner.temp }}/libs/libgit2
git clone -q -b v${{ env.LIBGIT2_VERSION }} https://github.com/libgit2/libgit2.git
mkdir libgit2/build && cd libgit2/build
cmake .. \
-DCMAKE_INSTALL_PREFIX=${{ runner.temp }}/libs/libgit2 \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_CLAR=OFF \
-DCMAKE_C_FLAGS=-fPIC \
-DREGEX_BACKEND=builtin
make
sudo make install
working-directory: ${{ runner.temp }}

- name: Restore & Cache shared libgit2 (${{ env.LIBGIT2_VERSION }})
uses: actions/cache@v2.1.4
if: matrix.build_type != 'Release'
id: libgit2-shared-cache
with:
path: ${{ runner.temp }}/libs/libgit2
key: ${{ env.CACHE_KEY_PREFIX }}-libgit2-${{ env.LIBGIT2_VERSION }}
key: ${{ env.CACHE_KEY_PREFIX }}-libgit2-shared-${{ env.LIBGIT2_VERSION }}
- name: Install libgit2 (${{ env.LIBGIT2_VERSION }}) as shared
if: steps.libgit2-cache.outputs.cache-hit != 'true'
if: steps.libgit2-cache.outputs.cache-hit != 'true' && matrix.build_type != 'Release'
run: |
mkdir -p ${{ runner.temp }}/libs/libgit2
git clone -q -b v${{ env.LIBGIT2_VERSION }} https://github.com/libgit2/libgit2.git
Expand Down Expand Up @@ -160,10 +198,10 @@ jobs:
working-directory: build

- name: Upload pre-built binary
uses: actions/upload-artifact@v2.2.1
uses: actions/upload-artifact@v2.2.2
if: matrix.build_type == 'Release'
with:
name: ${{ github.job }}-${{ matrix.compiler.pacakge }}
name: ${{ github.job }}-${{ matrix.compiler.package }}
path: poac

- uses: actions/setup-python@v2.2.1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: macOS

on:
push:
branches: [ master ]
branches: [ main ]
pull_request:
branches: [ master ]
branches: [ main ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-10.15, macos-11.0 ]
os: [ macos-10.15 ] # macos-11.0
build_type: [ Debug, Release ]
env:
CACHE_KEY_PREFIX: ${{ matrix.os }}-${{ matrix.build_type }}
Expand All @@ -23,7 +23,7 @@ jobs:
run: brew install libgit2 boost libarchive

- name: Restore & Cache CMake build results
uses: actions/cache@v2.1.3
uses: actions/cache@v2.1.4
with:
path: build
key: ${{ env.CACHE_KEY_PREFIX }}-${{ hashFiles('CMakeLists.txt', 'cmake/*.cmake') }}
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ target_include_directories(${PROJECT_NAME} PUBLIC

include(cmake/PoacConfig.cmake)
include(cmake/AddPoacDependencies.cmake)
if (NOT APPLE AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
list(APPEND POAC_DEPENDENCIES "-lstdc++fs")
endif ()
target_link_libraries(
${PROJECT_NAME}
${STATIC_LINK_FLAG}
Expand Down
24 changes: 15 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div align="center"><img alt="poac" width="250" src="https://github.com/poacpm/design/raw/master/images/logo.svg"></div>
<div align="center"><img alt="poac" width="250" src="https://github.com/poacpm/design/raw/main/images/logo.svg"></div>

## Description

Expand All @@ -17,11 +17,17 @@ By using poac, you can create a C++ project, build sources and execute an applic

## Supported Operating Systems

| Linux | macOS | Windows |
|:-----:|:-----:|:-------:|
|[![GitHub Actions Linux Build](https://github.com/poacpm/poac/workflows/Linux/badge.svg?branch=master)](https://github.com/poacpm/poac/actions?query=workflow%3A%22Linux%22)|[![GitHub Actions macOS Build](https://github.com/poacpm/poac/workflows/macOS/badge.svg?branch=master)](https://github.com/poacpm/poac/actions?query=workflow%3A%22macOS%22)|[![GitHub Actions Windows Build](https://github.com/poacpm/poac/workflows/Windows/badge.svg?branch=master)](https://github.com/poacpm/poac/actions?query=workflow%3A%22Windows%22)|
| Linux | macOS |
|:-----:|:-----:|
|[![GitHub Actions Linux Build](https://github.com/poacpm/poac/workflows/Linux/badge.svg?branch=main)](https://github.com/poacpm/poac/actions?query=workflow%3A%22Linux%22)|[![GitHub Actions macOS Build](https://github.com/poacpm/poac/workflows/macOS/badge.svg?branch=main)](https://github.com/poacpm/poac/actions?query=workflow%3A%22macOS%22)|

<!-- [![Appveyor build status](https://ci.appveyor.com/api/projects/status/6r7d0526he3nsq7l/branch/master?svg=true)](https://ci.appveyor.com/project/matken11235/poac/branch/master) -->
<!--
Windows |
:-------:|
[![GitHub Actions Windows Build](https://github.com/poacpm/poac/workflows/Windows/badge.svg?branch=main)](https://github.com/poacpm/poac/actions?query=workflow%3A%22Windows%22)|
-->

<!-- [![Appveyor build status](https://ci.appveyor.com/api/projects/status/6r7d0526he3nsq7l/branch/main?svg=true)](https://ci.appveyor.com/project/matken11235/poac/branch/main) -->

Please see [1.1. Installation · The Poac Book](https://doc.poac.pm/en/getting-started/installation.html#supported-operating-systems) for more information about supported OS.

Expand All @@ -30,13 +36,13 @@ Please see [1.1. Installation · The Poac Book](https://doc.poac.pm/en/getting-s
* GitHub:
[![GitHub Release Version](https://img.shields.io/github/release/poacpm/poac.svg?style=flat)](https://github.com/poacpm/poac/releases)
[![Github All Releases](https://img.shields.io/github/downloads/poacpm/poac/total.svg)](https://github.com/poacpm/poac/releases)
[![GitHub License](https://img.shields.io/github/license/poacpm/poac.svg)](https://github.com/awslabs/aws-c-common/blob/master/LICENSE)
[![GitHub License](https://img.shields.io/github/license/poacpm/poac.svg)](https://github.com/awslabs/aws-c-common/blob/main/LICENSE)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpoacpm%2Fpoac.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpoacpm%2Fpoac?ref=badge_shield)

* Code Coverage:
[![Coverity Scan Build Status](https://scan.coverity.com/projects/17677/badge.svg)](https://scan.coverity.com/projects/poacpm-poac)
[![Coverage Status](https://coveralls.io/repos/github/poacpm/poac/badge.svg?branch=master)](https://coveralls.io/github/poacpm/poac?branch=master)
[![codecov](https://codecov.io/gh/poacpm/poac/branch/master/graph/badge.svg)](https://codecov.io/gh/poacpm/poac)
[![Coverage Status](https://coveralls.io/repos/github/poacpm/poac/badge.svg?branch=main)](https://coveralls.io/github/poacpm/poac?branch=main)
[![codecov](https://codecov.io/gh/poacpm/poac/branch/main/graph/badge.svg)](https://codecov.io/gh/poacpm/poac)

* Code Quality:
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4179a24c6e514bc0b3344f80bf64a40d)](https://app.codacy.com/app/matken11235/poac?utm_source=github.com&utm_medium=referral&utm_content=poacpm/poac&utm_campaign=Badge_Grade_Settings)
Expand Down Expand Up @@ -112,7 +118,7 @@ You can also find the useful [architecture documentation](https://doc.poac.pm/en

Poac is licensed under the terms of the Apache License version 2.0.

Please see [LICENSE](https://github.com/poacpm/poac/blob/master/LICENSE) for details.
Please see [LICENSE](https://github.com/poacpm/poac/blob/main/LICENSE) for details.

[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fpoacpm%2Fpoac.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fpoacpm%2Fpoac?ref=badge_large)

Expand Down
15 changes: 15 additions & 0 deletions cmake/AddLibArchive.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,27 @@ endif()

find_package(LibArchive)
if (LibArchive_FOUND)
if (STATIC_LINK_FLAG MATCHES "(^-static )|( -static )|(^-static$)|( -static$)" AND NOT APPLE AND ${LibArchive_LIBRARIES} MATCHES ".*\.so$")
unset(LibArchive_LIBRARIES)
unset(LibArchive_LIBRARY CACHE)
find_library(LibArchive_LIBRARY
NAMES libarchive.a)
mark_as_advanced(LibArchive_LIBRARY)
set(LibArchive_LIBRARIES ${LibArchive_LIBRARY})
set_target_properties(LibArchive::LibArchive PROPERTIES
IMPORTED_LOCATION "${LibArchive_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${LibArchive_INCLUDE_DIR}")
endif ()
message(CHECK_PASS "added")
message(STATUS "LibArchive include directory is ... ${LibArchive_INCLUDE_DIR}")
message(STATUS "LibArchive library is ... ${LibArchive_LIBRARIES}")

target_include_directories(${PROJECT_NAME} PRIVATE ${LibArchive_INCLUDE_DIR})
list(APPEND POAC_DEPENDENCIES ${LibArchive_LIBRARIES})
if (STATIC_LINK_FLAG MATCHES "(^-static )|( -static )|(^-static$)|( -static$)" AND NOT APPLE)
list(APPEND POAC_DEPENDENCIES acl)
list(APPEND POAC_DEPENDENCIES z)
endif ()
else ()
message(CHECK_FAIL "not found")
list(APPEND missingDependencies libarchive)
Expand Down
10 changes: 9 additions & 1 deletion cmake/AddOpenSSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ endif ()

find_package(OpenSSL REQUIRED)
if (OPENSSL_FOUND)
if (STATIC_LINK_FLAG MATCHES "(^-static )|( -static )|(^-static$)|( -static$)" AND NOT APPLE)
foreach(x IN LISTS OPENSSL_LIBRARIES)
string(REGEX REPLACE "[.]so" ".a" x ${x})
list(APPEND OPENSSL_STATIC_LIBRARIES ${x})
endforeach()
set(OPENSSL_LIBRARIES ${OPENSSL_STATIC_LIBRARIES})
unset(OPENSSL_STATIC_LIBRARIES)
endif ()
message(CHECK_PASS "added")
if (LINUX)
if (UNIX AND NOT APPLE)
list(APPEND OPENSSL_LIBRARIES ssl crypto dl)
elseif (APPLE)
list(APPEND OPENSSL_LIBRARIES dl)
Expand Down
16 changes: 13 additions & 3 deletions cmake/ConfigRelease.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,19 @@ include_guard(GLOBAL)
if (APPLE)
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto -mtune=native -march=native")
else ()
set(STATIC_LINK_FLAG "-static") # ref: https://stackoverflow.com/a/3801032
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -flto") # -mtune=powerpc64le -mcpu=powerpc64le
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if (${CMAKE_CXX_COMPILER} MATCHES "-[0-9]+$")
string(REGEX REPLACE [[.*clang\+\+(-[0-9]+)$]] [[lld\1]] LD ${CMAKE_CXX_COMPILER})
set(STATIC_LINK_FLAG "-static -fuse-ld=${LD}")
else ()
set(STATIC_LINK_FLAG "-static -fuse-ld=lld")
endif ()
else ()
set(STATIC_LINK_FLAG "-static") # ref: https://stackoverflow.com/a/3801032
endif ()
set(CMAKE_CXX_FLAGS_RELEASE "-O3") # -mtune=powerpc64le -mcpu=powerpc64le
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
endif ()
if (LINUX)
if (UNIX AND NOT APPLE)
set(Boost_USE_STATIC_LIBS ON)
endif ()
19 changes: 11 additions & 8 deletions include/poac/cmd/build.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define POAC_CMD_BUILD_HPP

// std
#include <filesystem>
#include <string>

// external
Expand All @@ -15,22 +16,24 @@

namespace poac::cmd::build {
struct Options {
core::builder::Mode mode;
core::builder::mode_t mode;
};

[[nodiscard]] mitama::result<void, std::string>
build([[maybe_unused]] Options&& opts, const toml::value& config) {
MITAMA_TRY(core::resolver::install_deps(config));
// core::Builder bs(config.get(), opts.mode, opts.verbose);
// MITAMA_TRY(bs.build());
return mitama::success();
[[nodiscard]] mitama::result<std::filesystem::path, std::string>
build(Options&& opts, const toml::value& config) {
const auto resolved_deps = MITAMA_TRY(core::resolver::install_deps(config));
const std::filesystem::path output_path = MITAMA_TRY(
core::builder::build(config, opts.mode, resolved_deps)
);
return mitama::success(output_path);
}

[[nodiscard]] mitama::result<void, std::string>
exec(Options&& opts) {
MITAMA_TRY(core::validator::require_config_exists());
const toml::value config = toml::parse("poac.toml");
return build(std::move(opts), config);
MITAMA_TRY(build(std::move(opts), config));
return mitama::success();
}
} // end namespace

Expand Down
Loading