Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 18 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Build
run: cd src && make -f Makefile.linux-x86.mk
- name: Install external tools
Expand All @@ -32,6 +34,8 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Build
run: cd src && make -f Makefile.linux-arm64.mk
- name: Test
Expand All @@ -57,8 +61,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: Install dependencies
run: |
vcpkg install curl:x64-windows
- name: Build
run: cd src && nmake.exe /F Makefile.windows.mk
env:
VCPKG_ROOT: C:\vcpkg
- name: Test
run: ./loda.exe test
build-windows-arm64:
Expand All @@ -68,14 +77,22 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_arm64
- name: Install dependencies
run: |
vcpkg install curl:arm64-windows
- name: Build
run: cd src && nmake.exe /F Makefile.windows.mk
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_ARCH: arm64-windows
code-coverage:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y lcov libcurl4-openssl-dev
- name: Generate
run: sudo apt install lcov && cd src && make -f Makefile.linux-x86.mk coverage
run: cd src && make -f Makefile.linux-x86.mk coverage
- name: Upload
uses: actions/upload-artifact@v4
with:
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Build
run: cd src && make -f Makefile.linux-x86.mk loda LODA_PLATFORM=linux-x86 LODA_VERSION=${{ needs.create-release.outputs.version }}
- name: Upload
Expand All @@ -60,6 +62,8 @@ jobs:
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev
- name: Build
run: cd src && make -f Makefile.linux-arm64.mk loda LODA_PLATFORM=linux-arm64 LODA_VERSION=${{ needs.create-release.outputs.version }}
- name: Upload
Expand Down Expand Up @@ -109,8 +113,13 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: ilammy/msvc-dev-cmd@v1
- name: Install dependencies
run: |
vcpkg install curl:x64-windows
- name: Build
run: cd src && nmake.exe /F Makefile.windows.mk loda LODA_PLATFORM=windows-x86 LODA_VERSION=${{ needs.create-release.outputs.version }}
env:
VCPKG_ROOT: C:\vcpkg
- name: Upload
uses: actions/upload-release-asset@v1
with:
Expand All @@ -128,8 +137,14 @@ jobs:
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_arm64
- name: Install dependencies
run: |
vcpkg install curl:arm64-windows
- name: Build
run: cd src && nmake.exe /F Makefile.windows.mk loda LODA_PLATFORM=windows-arm64 LODA_VERSION=${{ needs.create-release.outputs.version }}
env:
VCPKG_ROOT: C:\vcpkg
VCPKG_ARCH: arm64-windows
- name: Upload
uses: actions/upload-release-asset@v1
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

* Use `v2/submissions/` API endpoint to fetch programs
* Handle program submissions with `delete` mode
* Integrate libcurl for HTTP requests, replacing external curl/wget tools

## v25.11.9

Expand Down
7 changes: 5 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
CXXFLAGS += -I. -g -Wall -Werror -fmessage-length=0 -std=c++17

# Default curl libs for dynamic linking (can be overridden by platform-specific makefiles)
CURL_LIBS ?= -lcurl

ifdef LODA_VERSION
CXXFLAGS += -DLODA_VERSION=$(LODA_VERSION)
endif
Expand All @@ -21,14 +24,14 @@ OBJS = base/uid.o \

loda: CXXFLAGS += -O2
loda: $(OBJS)
$(CXX) $(LDFLAGS) -o loda $(OBJS)
$(CXX) $(LDFLAGS) -o loda $(OBJS) $(CURL_LIBS)
[ -L ../loda ] || ( cd .. && ln -s src/loda loda )
du -sh loda

coverage: CXXFLAGS += -O0 -fprofile-arcs -ftest-coverage
coverage: LDFLAGS += --coverage
coverage: $(OBJS)
$(CXX) $(LDFLAGS) -o loda $(OBJS)
$(CXX) $(LDFLAGS) -o loda $(OBJS) $(CURL_LIBS)
[ -L ../loda ] || ( cd .. && ln -s src/loda loda )
cd .. && ./loda test && cd src
gcov $(OBJS:.o=.cpp)
Expand Down
3 changes: 2 additions & 1 deletion src/Makefile.linux-arm64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# see https://stackoverflow.com/questions/35116327/when-g-static-link-pthread-cause-segmentation-fault-why
CXX = aarch64-linux-gnu-g++
CXXFLAGS += -pthread -flto=auto
LDFLAGS = -static -static-libstdc++ -static-libgcc -lrt -pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -s -flto=auto
LDFLAGS = -static-libstdc++ -static-libgcc -pthread -s -flto=auto
CURL_LIBS = -lcurl
# END PLATFORM CONFIG FOR LINUX ARM64

include Makefile
3 changes: 2 additions & 1 deletion src/Makefile.linux-x86.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
# see https://stackoverflow.com/questions/35116327/when-g-static-link-pthread-cause-segmentation-fault-why
CXX = x86_64-linux-gnu-g++
CXXFLAGS += -pthread -flto=auto
LDFLAGS = -static -static-libstdc++ -static-libgcc -lrt -pthread -Wl,--whole-archive -lpthread -Wl,--no-whole-archive -s -flto=auto
LDFLAGS = -static-libstdc++ -static-libgcc -pthread -s -flto=auto
CURL_LIBS = -lcurl
# END PLATFORM CONFIG FOR LINUX X86

include Makefile
1 change: 1 addition & 0 deletions src/Makefile.macos-arm64.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
CXX = clang++
CXXFLAGS = -target arm64-apple-macos14 -flto=thin
LDFLAGS = -target arm64-apple-macos14 -flto=thin
CURL_LIBS = -lcurl
# END PLATFORM CONFIG FOR MAC OS ARM64

include Makefile
1 change: 1 addition & 0 deletions src/Makefile.macos-x86.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
CXX = clang++
CXXFLAGS = -target x86_64-apple-macos14 -flto=thin
LDFLAGS = -target x86_64-apple-macos14 -flto=thin
CURL_LIBS = -lcurl
# END PLATFORM CONFIG FOR MAC OS X86

include Makefile
14 changes: 13 additions & 1 deletion src/Makefile.windows.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
CXXFLAGS = /I. /std:c++17 /O2 /GL
LDFLAGS = /link /LTCG

# Check if VCPKG_ROOT is set (for vcpkg integration)
!IFDEF VCPKG_ROOT
# Default to x64-windows if VCPKG_ARCH is not specified
!IFNDEF VCPKG_ARCH
VCPKG_ARCH = x64-windows
!ENDIF
CXXFLAGS = $(CXXFLAGS) /I$(VCPKG_ROOT)\installed\$(VCPKG_ARCH)\include
LDFLAGS = $(LDFLAGS) /LIBPATH:$(VCPKG_ROOT)\installed\$(VCPKG_ARCH)\lib
!ENDIF

CURL_LIBS = libcurl.lib

!IFDEF LODA_VERSION
CXXFLAGS = $(CXXFLAGS) /DLODA_VERSION=$(LODA_VERSION)
!ELSE
Expand All @@ -23,7 +35,7 @@ SRCS = base/uid.cpp \
sys/csv.cpp sys/file.cpp sys/git.cpp sys/jute.cpp sys/log.cpp sys/metrics.cpp sys/process.cpp sys/setup.cpp sys/util.cpp sys/web_client.cpp

loda: $(SRCS)
cl /EHsc /Feloda.exe $(CXXFLAGS) $(SRCS) $(LDFLAGS)
cl /EHsc /Feloda.exe $(CXXFLAGS) $(SRCS) $(LDFLAGS) $(CURL_LIBS)
copy loda.exe ..

clean:
Expand Down
8 changes: 7 additions & 1 deletion src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ The C++ source code contain is organized into the following modules:

## Building

LODA supports Linux, macOS, and Windows. You need a standard C++ compiler and `make` (or `nmake` on Windows). No external libraries are required, but the `curl` and `gzip` command-line tools must be available.
LODA supports Linux, macOS, and Windows. You need a standard C++ compiler and `make` (or `nmake` on Windows). The `libcurl` development library and the `gzip` command-line tool must be available at build time.

### Build Dependencies

- **C++ compiler**: g++, clang++, or MSVC (C++17 support required)
- **libcurl**: Development headers and library (e.g., `libcurl4-openssl-dev` on Debian/Ubuntu)
- **gzip**: Command-line tool for compression

To build from source, switch to the `src/` folder and run the appropriate command for your platform:

Expand Down
Loading