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

Use Cmake #17

Merged
merged 62 commits into from
Nov 10, 2023
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
f3f2214
Bugfix for R package (RS_RCPP macro)
JetteReeg Sep 29, 2023
35719f3
Minimal working CMakeLists#15
TheoPannetier Oct 20, 2023
7c36ff7
RScore as a linked library
TheoPannetier Oct 20, 2023
bcde1db
progress #15, cannot rm Version.h yet
TheoPannetier Oct 20, 2023
c90225a
Version.h replaced with cmake target_compile_definition
TheoPannetier Oct 23, 2023
63b920f
ignore CMakeLists
TheoPannetier Oct 23, 2023
91ec5e6
include Version.h obsolete in batch with cmake
TheoPannetier Oct 23, 2023
e559dce
switch RScore branch
TheoPannetier Oct 23, 2023
13eabc0
Add 'src/RScore/' from commit '91ec5e6ca0ee72b5ec4aed52e68c99769294c467'
TheoPannetier Oct 23, 2023
233898d
don't ignore CMakeList after all
TheoPannetier Oct 23, 2023
9d2bd55
Merge commit '233898d9a1bc54c120744b4fb8baae0616e1361f' into cmake
TheoPannetier Oct 23, 2023
41f4271
can compile without Version.h?
TheoPannetier Oct 24, 2023
954ac29
can I rm BATCH def + others?
TheoPannetier Oct 24, 2023
15f8c41
try out matrix for GHA
TheoPannetier Oct 24, 2023
37b4957
fix typo
TheoPannetier Oct 24, 2023
51b120d
fix yaml
TheoPannetier Oct 24, 2023
281fe45
deprecated directive
TheoPannetier Oct 25, 2023
70f1352
Merge branch 'ci' of https://github.com/RangeShifter/RangeShifter_bat…
TheoPannetier Oct 25, 2023
f5009fc
simplified test project
TheoPannetier Oct 25, 2023
2ba3e6a
paths in output files uniform across platforms
TheoPannetier Oct 25, 2023
6ad8e29
had missed some files
TheoPannetier Oct 25, 2023
178e2fe
investigating why macos differs
TheoPannetier Oct 25, 2023
d379108
what os does gha run jobs on?
TheoPannetier Oct 27, 2023
b12f793
disable macos build for a short bit
TheoPannetier Oct 27, 2023
f00631d
separate set of expectations for macos
TheoPannetier Oct 27, 2023
3bb09e4
build with cmake msvc
TheoPannetier Oct 27, 2023
08bb790
solve merge conflict with ci
TheoPannetier Oct 27, 2023
4cb4f39
build cmake on gha, only windows for now
TheoPannetier Oct 27, 2023
71ff979
fix broken path
TheoPannetier Oct 27, 2023
554c392
Merge branch 'ci' into cmake
TheoPannetier Oct 27, 2023
13147ca
attempt at crossplatform cmake
TheoPannetier Oct 27, 2023
b74caac
oops teehee silly billy
TheoPannetier Oct 27, 2023
c708a8c
oops^2
TheoPannetier Oct 27, 2023
cb33766
we're building from /build now
TheoPannetier Oct 27, 2023
81ecc01
we don't likey?
TheoPannetier Oct 27, 2023
abff5d7
I'm of not understanding
TheoPannetier Oct 27, 2023
0ca3288
set explicit paths in CMake
TheoPannetier Oct 31, 2023
6b18c37
whereami
TheoPannetier Oct 31, 2023
dd2658e
i insist
TheoPannetier Oct 31, 2023
0de751e
what do you not see
TheoPannetier Oct 31, 2023
3e90430
disable tests to see if builds on win/mac
TheoPannetier Oct 31, 2023
f344273
what's up GHA windows?
TheoPannetier Oct 31, 2023
97304b9
attempt with GHA matrix
TheoPannetier Oct 31, 2023
9199dfe
is this better, yaml?
TheoPannetier Oct 31, 2023
2a12728
how this
TheoPannetier Oct 31, 2023
d71e78d
npm example
TheoPannetier Oct 31, 2023
ceed1b3
hows this then
TheoPannetier Oct 31, 2023
e10e2dd
or that
TheoPannetier Oct 31, 2023
fe546ea
this good?
TheoPannetier Oct 31, 2023
e0f50c5
do we like
TheoPannetier Oct 31, 2023
e54fae4
work with me
TheoPannetier Oct 31, 2023
47c2e57
enable output check again
TheoPannetier Oct 31, 2023
99e0ded
don't diff BatchLog, ignore input file names
TheoPannetier Nov 1, 2023
c0f02ec
drop BatchLog comparison, ignore input filenames in comparisons
TheoPannetier Nov 2, 2023
b406129
forgot to update expectation path
TheoPannetier Nov 2, 2023
60b35ea
we do need different expectations for macos
TheoPannetier Nov 2, 2023
3764f7a
strip unused macros
TheoPannetier Nov 9, 2023
d8d1f6d
update subtree with RScore branch cmake_batch
TheoPannetier Nov 9, 2023
f2d0fee
Add 'src/RScore/' from commit '3764f7aaaaf9a6624af0037511077a42bbb6ad4e'
TheoPannetier Nov 9, 2023
769e6f7
rm drop_wd_prefix()
TheoPannetier Nov 9, 2023
3436936
build instructions #18
TheoPannetier Nov 10, 2023
fd5405c
drop #BATCH macro
TheoPannetier Nov 10, 2023
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
28 changes: 19 additions & 9 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ on: push

jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
include:
- os: windows-latest
path_to_exe: ./build/Debug/RangeShifter.exe
- os: ubuntu-latest
path_to_exe: ./build/RangeShifter
- os: macos-latest
path_to_exe: ./build/RangeShifter
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

- name: build
run: g++ -o ./run_on_gha/rs_test_project/rs.exe ./src/*.cpp ./src/RScore/*.cpp

- name: run
run: |
cd ./run_on_gha/rs_test_project
./rs.exe
mkdir build
cd build
cmake ../
cmake --build .

- name: run
run: ${{ matrix.path_to_exe }} run_on_gha/rs_test_project/

- name: check_output
run: |
cd ./run_on_gha/rs_test_project
cd ./run_on_gha/rs_test_project
rm Outputs/DebugLog.txt
bash check_output.bash
# DebugLog contains addresses, changes every run


3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# CodeLite
/.build-debug/
/build-Debug/
/build/
/Debug/
/Release/
RNG_test/
Expand Down Expand Up @@ -56,6 +57,8 @@ Bacup*/
.vs/
*.sln
*.vcxproj*
out/
x64/

# Ignore test project outputs, except anchors
run_on_gha/rs_test_project/Outputs/*
Expand Down
27 changes: 27 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cmake_minimum_required(VERSION 3.10)

# set the project name and version
project(RangeShifter VERSION 2.1.0)

# specify the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# add RScore to source search path
add_subdirectory(src/RScore)

# add the executable
add_executable(RangeShifter src/Main.cpp src/BatchMode.cpp)

# enable LINUX_CLUSTER macro on Linux + macOS
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
target_compile_definitions(RangeShifter PRIVATE "RSDEBUG" "RSWIN64" "LINUX_CLUSTER")
else() # Windows
target_compile_definitions(RangeShifter PRIVATE "RSDEBUG" "RSWIN64")
endif()

# link RScore to the executable as a library
target_link_libraries(RangeShifter PUBLIC RScore)

# add RScore as an include dir
target_include_directories(RangeShifter PUBLIC "${PROJECT_BINARY_DIR}" "${PROJECT_SOURCE_DIR}/RScore")
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,29 @@ In Batch Mode, RangeShifter can be run from the command line (e.g., `./rangeshif
This allows the user to run large batches of simulations with different parameters, which would need to be specified individually in the GUI version.
The Batch Mode also enables running RangeShifter on machines with a non-interactive interface, for example a high-performance cluster.

## Usage
## Building RangeShifter

The compiled software can be found in the [Software and Documentation](https://github.com/RangeShifter/RangeShifter-software-and-documentation) repo.
RangeShifter can be built in Windows or Linux. To build the programm you need to set the operating system in the file Version.h.
The compiled software can be found in the [Software and Documentation](https://github.com/RangeShifter/RangeShifter-software-and-documentation) repo.

For Windows: set #define LINUX_CLUSTER 0
For Linux: set #define LINUX_CLUSTER 1
Building RangeShifter from the source code requires CMake. If you haven't done so yet, you will need to [download and install it](https://cmake.org/download/).

Then, one can build RangeShifter e.g. with the GNU compiler:
RangeShifter can then be configured and built (out-of-source) from `CMakeLists.txt`, with the usual CMake commands:

```bash
g++ -o rs.exe ./src/*.cpp ./src/RScore/*.cpp
mkdir build && cd build
cmake ..
cmake --build .
```
If you use Visual Studio as your IDE, CMake should be recognised automatically when `RangeShifter_batch_dev` is opened as a new folder.
Visual Studio will take care of the configuration, and you only need to select target RangeShifter.exe before pressing the build button.

Alternatively, RangeShifter can also be built directly with the GNU C++ compiler, in which case some #define macros must be passed to it:

```bash
g++ -o RangeShifter.exe ./src/*.cpp ./src/RScore/*.cpp -DRSDEBUG -DRSWIN64 -DLINUX_CLUSTER
```

## Running RangeShifter

For instructions on how to setup the project directory and input files, please refer to section 3.3 of the [User Manual](https://raw.githubusercontent.com/RangeShifter/RangeShifter-software-and-documentation/master/RangeShifter_v2.0_UserManual.pdf), and to the [documentation repository](https://github.com/RangeShifter/RangeShifter-software-and-documentation) for examples.

Expand Down
51 changes: 0 additions & 51 deletions run_on_gha/expected_output/Batch1_Sim1_Land37_Occupancy.txt

This file was deleted.

102 changes: 0 additions & 102 deletions run_on_gha/expected_output/Batch1_Sim1_Land37_Occupancy_Stats.txt

This file was deleted.

Loading