diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2019-11-21 01:05:50 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-21 01:05:50 -0500 |
commit | 0c2b6efeb29f184a42286bb9adeda0f1988c45e1 (patch) | |
tree | 54ebb52effff630eb528582349880e7e8a8d9896 | |
parent | 6aac41d2f220424591f306b15d0a47a7a11e88c2 (diff) | |
parent | 6a0aa493a001df88c31dc41d3bd03b9433347235 (diff) | |
download | reloc-0c2b6efeb29f184a42286bb9adeda0f1988c45e1.tar.gz |
Merge pull request #1 from jhunkeler/jhunkeler-patch-1
Implement GitHub Actions
-rw-r--r-- | .github/workflows/ci.yml | 38 | ||||
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | reloc.h | 5 |
5 files changed, 66 insertions, 4 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..be6a633 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,38 @@ +name: ci + +#on: [push, pull_request] +on: [push] + +jobs: + unix: + name: "${{ matrix.os }}" + runs-on: "${{ matrix.os }}" + strategy: + matrix: + os: [ubuntu-latest, macOS-latest] + + steps: + - uses: actions/checkout@v1 + - name: configure + run: cmake . + - name: make + run: make + - name: test + run: ctest -V + - name: install + run: sudo make install + + windows: + name: "${{ matrix.os }}" + runs-on: "${{ matrix.os }}" + strategy: + matrix: + os: [windows-latest] + steps: + - uses: actions/checkout@v1 + - name: configure + run: cmake . + - name: make + run: cmake --build . + - name: test + run: ctest -V diff --git a/CMakeLists.txt b/CMakeLists.txt index c46d94d..fef8144 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,11 @@ cmake_minimum_required(VERSION 2.8.11) project(relocate C) set(VERSION "1.2.2") set(CMAKE_C_STANDARD 99) -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra") +if(MSVC) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS /Wall") +else() + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall -Wextra") +endif() enable_testing() add_subdirectory(test) @@ -2,21 +2,38 @@ Replace strings in binary executables and data files. + + ## System Requirements * `gcc` +* _or_ `clang` +* _or_ Microsoft Visual Studio (`cl.exe`)p * `>=cmake-2.18.11` ## Installing +### Linux / MacOS + ```bash $ git clone https://github.com/jhunkeler/reloc $ mkdir build $ cd build -$ cmake -DCMAKE_INSTALL_PREFIX=/some/place .. +$ cmake -DCMAKE_INSTALL_PREFIX=/some/place -DCMAKE_BUILD_TYPE=Release .. $ make install ``` +### Windows + +```cmd +> git clone https://github.com/jhunkeler/reloc +> cd reloc +> mkdir build +> cd build +> cmake -DCMAKE_INSTALL_PREFIX=c:\some\place -DCMAKE_BUILD_TYPE=Release .. +> cmake --build . --target INSTALL +``` + ## Usage ``` $ reloc <str1> <str2> <input_file> <output_file> @@ -6,7 +6,7 @@ void show_version() { } void usage(char *program) { - printf("usage: %s [-V] <str1> <str2> <input_file> <output_file>\n" + printf("usage: %s [-hV] <str1> <str2> <input_file> <output_file>\n" "\n" "Options:\n" "--help (-h) - Display this help message\n" @@ -10,9 +10,12 @@ #include <string.h> #include "version.h" -#if defined(_WIN32) || defined(_WIN64) +#if defined(__MINGW32__) || defined(__MINGW64__) #define DIRSEP '\\' #define SIZE_T_FMT "%I64u" +#elif defined(_MSC_VER) +#define DIRSEP '\\' +#define SIZE_T_FMT "%lu" #elif defined(__linux__) || defined(__unix__) || defined(__APPLE__) || defined(__MACH__) #define DIRSEP '/' #define SIZE_T_FMT "%lu" |