Skip to content

Commit c2b6e79

Browse files
authored
Fix some tasks about Latex (#20)
* check new latex find * latex updates * revert script * fix gha * fix gha 2 * fix gha 2 * fix gha 3 * fix gha 4 * Update main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * change dir layout
1 parent 6f4b1d5 commit c2b6e79

File tree

16 files changed

+141
-49
lines changed

16 files changed

+141
-49
lines changed

.github/workflows/main.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ jobs:
1313
run: |
1414
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
1515
sudo apt-get update
16+
sudo apt-get install ninja-build
1617
sudo apt-get install texlive*
1718
- name: Build
1819
run: |
1920
mkdir build
20-
cd build
21-
cmake -D USE_LATEX=ON ..
22-
cmake --build .
23-
cd ..
21+
cmake -G Ninja -S . -B build -D USE_LATEX=ON
22+
cmake --build build
2423
shell: bash
2524
- uses: actions/upload-artifact@v4
2625
with:
@@ -34,17 +33,37 @@ jobs:
3433
submodules: true
3534
- name: Setup environment
3635
run: |
37-
choco install texlive --params="'/scheme:full'" --execution-timeout=10000
36+
scripts\miktex_install.ps1
37+
shell: pwsh
3838
- name: Build
3939
run: |
4040
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
4141
refreshenv
4242
mkdir build
43-
cd build
44-
cmake -D USE_LATEX=ON ..
45-
cmake --build .
46-
cd ..
43+
cmake -S . -B build -D USE_LATEX=ON
44+
cmake --build build
45+
shell: pwsh
4746
- uses: actions/upload-artifact@v4
4847
with:
4948
name: windows-artifacts
5049
path: build/bin/
50+
macos-build:
51+
runs-on: macos-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
with:
55+
submodules: true
56+
- name: Setup environment
57+
run: |
58+
brew install --cask mactex
59+
brew install ninja
60+
- name: Build
61+
run: |
62+
eval "$(/usr/libexec/path_helper)"
63+
mkdir build
64+
cmake -G Ninja -S . -B build -D USE_LATEX=ON
65+
cmake --build build
66+
- uses: actions/upload-artifact@v4
67+
with:
68+
name: macos-artifacts
69+
path: build/bin/

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

3rdparty/UseLATEX

Lines changed: 0 additions & 1 deletion
This file was deleted.

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
cmake_minimum_required( VERSION 3.13 )
1+
cmake_minimum_required( VERSION 3.27 )
22

33
message( STATUS "Programming Course Reports" )
4+
project(programming_course_reports)
45

5-
include(${CMAKE_SOURCE_DIR}/cmake/Configure.cmake)
6+
include(${CMAKE_SOURCE_DIR}/cmake/configure.cmake)
67

78
############################### LATEX ###############################
89
option(USE_LATEX OFF)
910
if( USE_LATEX )
10-
include( 3rdparty/UseLATEX/UseLATEX.cmake )
11+
find_package(LATEX REQUIRED)
12+
if(NOT (LATEX_FOUND AND LATEX_PDFLATEX_FOUND))
13+
set(USE_LATEX OFF)
14+
endif()
1115
endif( USE_LATEX )
1216

1317
add_subdirectory(modules)
File renamed without changes.

modules/example/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
message(STATUS "Example tasks")
2+
3+
SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})
4+
5+
foreach(subd ${subdirs})
6+
add_subdirectory(${subd})
7+
endforeach()

modules/example/latex/CMakeLists.txt

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
get_filename_component(ProjectId ${CMAKE_CURRENT_SOURCE_DIR} NAME)
2+
3+
set(LATEX_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
4+
if (NOT EXISTS ${LATEX_OUTPUT_PATH})
5+
file(MAKE_DIRECTORY ${LATEX_OUTPUT_PATH})
6+
endif ()
7+
8+
if (USE_LATEX)
9+
message( STATUS "-- " ${ProjectId} )
10+
file(GLOB_RECURSE report_files "*.tex")
11+
12+
foreach (report ${report_files})
13+
get_filename_component(report_name ${report} NAME_WE)
14+
list(APPEND list_report_names ${report_name})
15+
endforeach ()
16+
17+
add_custom_target( ${ProjectId}_prebuild
18+
COMMAND ${PDFLATEX_COMPILER} -draftmode -interaction=nonstopmode ${report_files}
19+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
20+
DEPENDS ${report_files})
21+
22+
add_custom_target( ${ProjectId}_pdf
23+
COMMAND ${PDFLATEX_COMPILER} ${report_files}
24+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
25+
DEPENDS ${report_files})
26+
27+
add_custom_target(${ProjectId}_all_formats ALL)
28+
add_dependencies(${ProjectId}_all_formats ${ProjectId}_pdf)
29+
30+
foreach (report_name ${list_report_names})
31+
add_custom_command(
32+
TARGET ${ProjectId}_all_formats
33+
POST_BUILD
34+
COMMAND mv "${CMAKE_CURRENT_SOURCE_DIR}/${report_name}.aux" "${LATEX_OUTPUT_PATH}/${report_name}.aux"
35+
COMMAND mv "${CMAKE_CURRENT_SOURCE_DIR}/${report_name}.log" "${LATEX_OUTPUT_PATH}/${report_name}.log"
36+
COMMAND mv "${CMAKE_CURRENT_SOURCE_DIR}/${report_name}.pdf" "${LATEX_OUTPUT_PATH}/${report_name}.pdf"
37+
)
38+
endforeach ()
39+
else()
40+
message( STATUS "-- ${ProjectId} - NOT BUILD!" )
41+
endif()

modules/task_3/CMakeLists.txt renamed to modules/mpi/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
message(STATUS "Task 3")
1+
message(STATUS "MPI tasks")
22

33
SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})
44

modules/task_2/CMakeLists.txt renamed to modules/omp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
message(STATUS "Task 2")
1+
message(STATUS "OpenMP tasks")
22

33
SUBDIRLIST(subdirs ${CMAKE_CURRENT_SOURCE_DIR})
44

0 commit comments

Comments
 (0)