Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 58914d0

Browse files
committedFeb 12, 2024·
Merge branch 'develop' into new-dl-api
2 parents e873c54 + 068c70e commit 58914d0

File tree

20 files changed

+65
-9
lines changed

20 files changed

+65
-9
lines changed
 

‎.github/workflows/wheel-short-test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
CMAKE_C_COMPILER_LAUNCHER: ccache
122122
CMAKE_CXX_COMPILER_LAUNCHER: ccache
123123
CCACHE_DIR: /tmp/.ccache
124-
MACOSX_DEPLOYMENT_TARGET: '10.9'
124+
MACOSX_DEPLOYMENT_TARGET: '10.15'
125125
steps:
126126
- uses: actions/checkout@v3
127127
with:
@@ -159,7 +159,7 @@ jobs:
159159
run: |
160160
source ./py-venv/bin/activate
161161
CMAKE_PREFIX_PATH="$VIRTUAL_ENV:$CMAKE_PREFIX_PATH" \
162-
_PYTHON_HOST_PLATFORM='macosx-10.9-universal2' \
162+
_PYTHON_HOST_PLATFORM='macosx-10.15-universal2' \
163163
ARCHFLAGS='-arch arm64 -arch x86_64' \
164164
python -m build -w .
165165
- name: Upload

‎.github/workflows/wheel.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ jobs:
338338
CMAKE_C_COMPILER_LAUNCHER: ccache
339339
CMAKE_CXX_COMPILER_LAUNCHER: ccache
340340
CCACHE_DIR: /tmp/.ccache
341-
MACOSX_DEPLOYMENT_TARGET: '10.9'
341+
MACOSX_DEPLOYMENT_TARGET: '10.15'
342342
steps:
343343
- uses: actions/checkout@v3
344344
with:
@@ -376,7 +376,7 @@ jobs:
376376
run: |
377377
source ./py-venv/bin/activate
378378
CMAKE_PREFIX_PATH="$VIRTUAL_ENV:$CMAKE_PREFIX_PATH" \
379-
_PYTHON_HOST_PLATFORM='macosx-10.9-universal2' \
379+
_PYTHON_HOST_PLATFORM='macosx-10.15-universal2' \
380380
ARCHFLAGS='-arch arm64 -arch x86_64' \
381381
python -m build -w .
382382
- name: Upload

‎examples/C++/Advanced/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
add_executable(lasso-fbs lasso-fbs.cpp)
2-
target_link_libraries(lasso-fbs PRIVATE alpaqa::alpaqa alpaqa::warnings)
2+
target_link_libraries(lasso-fbs PRIVATE alpaqa::alpaqa alpaqa::warnings)
3+
alpaqa_register_example(lasso-fbs)

‎examples/C++/Advanced/lasso-fbs.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <alpaqa/example-util.hpp>
12
#include <alpaqa/functions/l1-norm.hpp>
23
#include <alpaqa/util/print.hpp>
34
USING_ALPAQA_CONFIG(alpaqa::EigenConfigd);
@@ -27,6 +28,8 @@ auto build_problem() {
2728
}
2829

2930
int main() {
31+
alpaqa::init_stdout();
32+
3033
// Least squares problem
3134
auto [A, x_exact, b, λ] = build_problem();
3235
// ℓ₁ regularizer

‎examples/C++/CasADi/Rosenbrock/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ target_link_libraries(casadi-rosenbrock
77
casadi_function_codegen_python(rosenbrock_functions "codegen-rosenbrock.py")
88
target_compile_definitions(casadi-rosenbrock PRIVATE
99
ROSENBROCK_FUNC_DLL=\"$<TARGET_FILE_NAME:rosenbrock_functions>\")
10-
add_dependencies(casadi-rosenbrock rosenbrock_functions)
10+
add_dependencies(casadi-rosenbrock rosenbrock_functions)
11+
alpaqa_register_example(casadi-rosenbrock)

‎examples/C++/CasADi/Rosenbrock/main.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <alpaqa/example-util.hpp>
12
#include <alpaqa/inner/directions/panoc/lbfgs.hpp>
23
#include <alpaqa/inner/panoc.hpp>
34
#include <alpaqa/outer/alm.hpp>
@@ -10,6 +11,7 @@
1011
namespace fs = std::filesystem;
1112

1213
int main(int argc, char *argv[]) {
14+
alpaqa::init_stdout();
1315
USING_ALPAQA_CONFIG(alpaqa::EigenConfigd);
1416

1517
// Find the problem to load
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
add_executable(custom-control-cpp-problem-example main.cpp)
22
target_link_libraries(custom-control-cpp-problem-example
3-
PRIVATE alpaqa::alpaqa alpaqa::warnings)
3+
PRIVATE alpaqa::alpaqa alpaqa::warnings)
4+
alpaqa_register_example(custom-control-cpp-problem-example)

‎examples/C++/CustomControlCppProblem/main.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <alpaqa/config/config.hpp>
2+
#include <alpaqa/example-util.hpp>
23
#include <alpaqa/inner/panoc-ocp.hpp>
34
#include <alpaqa/problem/ocproblem.hpp>
45
#include <alpaqa/util/print.hpp>
@@ -182,6 +183,7 @@ struct Problem {
182183
};
183184

184185
int main() {
186+
alpaqa::init_stdout();
185187
USING_ALPAQA_CONFIG(alpaqa::DefaultConfig);
186188

187189
// Problem
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
add_executable(custom-cpp-problem-example main.cpp)
22
target_link_libraries(custom-cpp-problem-example
3-
PRIVATE alpaqa::alpaqa alpaqa::warnings)
3+
PRIVATE alpaqa::alpaqa alpaqa::warnings)
4+
alpaqa_register_example(custom-cpp-problem-example)

‎examples/C++/CustomCppProblem/main.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
#include <alpaqa/example-util.hpp>
12
#include <alpaqa/panoc-alm.hpp>
23
#include <alpaqa/problem/box-constr-problem.hpp>
34
#include <alpaqa/problem/problem-with-counters.hpp>
45

56
#include <iostream>
67

78
int main() {
9+
alpaqa::init_stdout();
810
USING_ALPAQA_CONFIG(alpaqa::DefaultConfig);
911

1012
// Problem specification

‎examples/C++/DLProblem/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ target_link_libraries(dl-problem-example
1010
target_compile_definitions(dl-problem-example
1111
PRIVATE DLPROBLEM_DLL=\"$<TARGET_FILE_NAME:problem-c>\")
1212
add_dependencies(dl-problem-example problem-c)
13+
alpaqa_register_example(dl-problem-example)
1314

1415
# Stand-alone executable to test the matrix functions used by problem-c
1516
add_executable(test-matmul "test-matmul.c")

‎examples/C++/DLProblem/main.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include <alpaqa/dl/dl-problem.hpp>
2+
#include <alpaqa/example-util.hpp>
23
#include <alpaqa/problem/problem-with-counters.hpp>
34
#include <alpaqa/structured-panoc-alm.hpp>
45

@@ -11,6 +12,8 @@ namespace fs = std::filesystem;
1112
USING_ALPAQA_CONFIG(alpaqa::DefaultConfig);
1213

1314
int main(int argc, char *argv[]) {
15+
alpaqa::init_stdout();
16+
1417
// Find the problem to load
1518
fs::path so_name = DLPROBLEM_DLL;
1619
if (argc > 1)

‎examples/C++/FortranProblem/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ target_link_libraries(fortran-problem-example
44
PRIVATE alpaqa::alpaqa alpaqa::warnings problem-fortran)
55
set_target_properties(fortran-problem-example PROPERTIES
66
LINKER_LANGUAGE Fortran)
7+
alpaqa_register_example(fortran-problem-example)

‎examples/C++/FortranProblem/main.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <alpaqa/example-util.hpp>
12
#include <alpaqa/problem/box-constr-problem.hpp>
23
#include <alpaqa/problem/problem-with-counters.hpp>
34
#include <alpaqa/structured-panoc-alm.hpp>
@@ -32,6 +33,8 @@ struct FortranProblem : alpaqa::BoxConstrProblem<config_t> {
3233
};
3334

3435
int main() {
36+
alpaqa::init_stdout();
37+
3538
// Instantiate a problem
3639
FortranProblem problem{problem_get_num_vars(), problem_get_num_constr()};
3740
// Wrap the problem to count the function evaluations
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
add_executable(simple-unconstr-cpp-problem-example main.cpp)
22
target_link_libraries(simple-unconstr-cpp-problem-example
3-
PRIVATE alpaqa::alpaqa alpaqa::warnings)
3+
PRIVATE alpaqa::alpaqa alpaqa::warnings)
4+
alpaqa_register_example(simple-unconstr-cpp-problem-example)

‎examples/C++/SimpleUnconstrProblem/main.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#include <alpaqa/example-util.hpp>
12
#include <alpaqa/panoc-alm.hpp>
23
#include <alpaqa/problem/problem-with-counters.hpp>
34
#include <alpaqa/problem/unconstr-problem.hpp>
@@ -31,7 +32,9 @@ struct RosenbrockProblem : alpaqa::UnconstrProblem<alpaqa::DefaultConfig> {
3132
};
3233

3334
int main() {
35+
alpaqa::init_stdout();
3436
USING_ALPAQA_CONFIG(RosenbrockProblem::config_t);
37+
3538
// Instantiate a problem
3639
RosenbrockProblem problem;
3740

‎examples/CMakeLists.txt

+8
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,13 @@ if (PROJECT_IS_TOP_LEVEL)
55
find_package(alpaqa REQUIRED CONFIG OPTIONAL_COMPONENTS CasADi Dl Extra)
66
endif()
77

8+
add_subdirectory(util)
9+
10+
add_custom_target(examples ALL)
11+
function(alpaqa_register_example TGT)
12+
target_link_libraries(${TGT} PRIVATE alpaqa::example-util)
13+
add_dependencies(examples ${TGT})
14+
endfunction()
15+
816
add_subdirectory(C++)
917
add_subdirectory(problems)

‎examples/util/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
add_library(example-util "src/stdout.cpp")
2+
target_include_directories(example-util PUBLIC
3+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
4+
add_library(alpaqa::example-util ALIAS example-util)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
namespace alpaqa {
4+
void init_stdout();
5+
} // namespace alpaqa

‎examples/util/src/stdout.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <alpaqa/example-util.hpp>
2+
3+
#ifdef _WIN32
4+
#define NOMINMAX
5+
#include <Windows.h>
6+
#endif
7+
8+
namespace alpaqa {
9+
void init_stdout() {
10+
#ifdef _WIN32
11+
SetConsoleOutputCP(CP_UTF8);
12+
#endif
13+
}
14+
} // namespace alpaqa

0 commit comments

Comments
 (0)
Please sign in to comment.