Skip to content

Commit

Permalink
Merge branch 'f3d-app:master' into alias
Browse files Browse the repository at this point in the history
  • Loading branch information
v0id-strike authored Feb 11, 2025
2 parents e534fef + dc202ae commit 86ed346
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 34 deletions.
25 changes: 15 additions & 10 deletions application/F3DConfigFileTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,31 @@ std::vector<fs::path> GetConfigPaths(const std::string& configSearch)
continue;
}

// If the config search is a stem, add extensions
std::vector<std::string> configNames;
if (fs::path(configSearch).stem() == configSearch)
{
for (const std::string& ext : { std::string(".json"), std::string(".d") })
{
configPath = dir / (configSearch + ext);
if (fs::exists(configPath))
{
paths.emplace_back(configPath);
}
}
// If the config search is a stem, add extensions
configNames.emplace_back(configSearch + ".json");
configNames.emplace_back(configSearch + ".d");
}
else
{
// If not, use directly
configPath = dir / (configSearch);
configNames.emplace_back(configSearch);
}

for (const auto& configName : configNames)
{
configPath = dir / (configName);
if (fs::exists(configPath))
{
f3d::log::debug("Config file found: ", configPath.string());
paths.emplace_back(configPath);
}
else
{
f3d::log::debug("Candidate config file not found: ", configPath.string());
}
}
}
catch (const fs::filesystem_error&)
Expand Down
2 changes: 1 addition & 1 deletion application/F3DOptionsTools.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static inline const std::array<CLIGroup, 8> CLIOptions = {{
{ "no-background", "", "No background when render to file", "<bool>", "1" },
{ "help", "h", "Print help", "", "" }, { "version", "", "Print version details", "", "" },
{ "list-readers", "", "Print the list of readers", "", "" },
{ "list-bindings", "", "Print the list of interaction bindings and exits, ignored with `--no-render`, only considers the first file group.", "", "" },
{ "list-bindings", "", "Print the list of interaction bindings and exits, ignored with `--no-render`, only considers the first file group.", "<bool>", "1" },
{ "config", "", "Specify the configuration file to use. absolute/relative path or filename/filestem to search in configuration file locations", "<filePath/filename/fileStem>", "" },
{ "no-config", "", "Do not read the configuration file", "<bool>", "1" },
{ "no-render", "", "Do not render anything and quit right after loading the first file, use with --verbose to recover information about a file.", "<bool>", "1" },
Expand Down
5 changes: 4 additions & 1 deletion application/testing/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1095,7 +1095,10 @@ f3d_test(NAME TestConfigFileQuiet DATA nonExistentFile.vtp CONFIG ${F3D_SOURCE_D
f3d_test(NAME TestNoFileConfigFile CONFIG ${F3D_SOURCE_DIR}/testing/configs/verbose.json ARGS --verbose REGEXP "No files to load provided" NO_BASELINE)

# Test that --no-config overrides --config
f3d_test(NAME TestNoConfigWithConfig DATA f3d.glb ARGS --no-config --config ${F3D_SOURCE_DIR}/testing/configs/complex.json)
f3d_test(NAME TestNoConfigWithConfig DATA f3d.glb ARGS --no-config CONFIG ${F3D_SOURCE_DIR}/testing/configs/complex.json)

# Test that config file search display logs
f3d_test(NAME TestConfigFileLocationVerbose ARGS --verbose CONFIG inexistent.json REGEXP "Candidate config file not found: .*inexistent.json" NO_BASELINE)

# Test help display
f3d_test(NAME TestHelp ARGS --help REGEXP "Usage:")
Expand Down
71 changes: 50 additions & 21 deletions doc/dev/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can then simply run F3D from the command line:
./bin/f3d
```

### Running the test suite
### Running the test suite (optional)

```
cmake -DBUILD_TESTING=ON ../src
Expand All @@ -73,67 +73,96 @@ ctest

## Windows

Note: The following steps were tested with Visual Studio Community 2022 using Windows 10, but should also work for other versions
The following steps were tested with Visual Studio Community 2022 using Windows 10, but should also work for other versions.
This guide is relying a lot on terminal command in order to provide easy steps to follow.
Alternatively, it is possible to use Visual Studio directly by opening .sln files and building in Visual Studio.

#### Install Dependencies

- Download and install [git bash for windows][gitforwindows]
- Download and install [cmake][cmake-download]
- Download and install [Visual Studio 2022 Community Edition][visual-studio]

#### Recover F3D sources
#### Retrieve VTK and F3D sources

- Open git bash

```sh
cd C:
mkdir dev
cd dev
mkdir vtk
cd vtk
git clone --depth 1 --branch v9.4.1 https://gitlab.kitware.com/vtk/vtk.git src
mkdir build
mkdir install
cd ..
mkdir f3d
cd f3d
git clone https://github.com/f3d-app/f3d.git src
mkdir build
```

#### Install dependencies using vcpkg

- Open git bash
Note: Resulting folder architecture should look like this:

```sh
cd C:/dev
git clone https://github.com/Microsoft/vcpkg.git
```
dev
|-- f3d
| |-- build
| `-- src
`-- vtk
|-- build
|-- install
`-- src
```

- Open cmd
#### Build and install VTK in a dedicated folder

- Open x64 Native Tools Command Prompt for VS 2022

```sh
cd C:\dev
.\vcpkg\bootstrap-vcpkg.bat
cmake -B .\f3d\build -S .\f3d\src -DCMAKE_TOOLCHAIN_FILE=C:\dev\vcpkg\scripts\buildsystems\vcpkg.cmake
cd C:\dev\vtk\build
cmake -DCMAKE_INSTALL_PREFIX=../install ../src
cmake --build . -j 16 --config Debug
cmake --install . --config Debug
```

Note: Last command will take a while. It downloads, compiles and installs VTK and its dependencies.
Note: These commands will take a while.

#### Add VTK libraries to the PATH

- Search for "Environment variables" in Windows menu and open associated control panel
- Click on "Environment variables.." button
- Double click on "Path"
- Click on "New" and write "C:\dev\vtk\install\bin"
- Press Ok
- Press Ok
- Press Ok

#### Build F3D

- Open cmd
- Open x64 Native Tools Command Prompt for VS 2022

```sh
cd C:\dev\f3d\build
cmake .
cmake --build .
cmake -DVTK_DIR=C:/dev/vtk/install/lib/cmake/vtk-9.4 ../src
cmake --build . --config Debug
```

#### Run

- Open a new file manager window
- Double click on the `C:\dev\f3d\build\bin_Debug\f3d.exe` executable

### Running the test suite
### Running the test suite (optional)

- Open x64 Native Tools Command Prompt for VS 2022

```
cd C:\dev\f3d\build
cmake -DBUILD_TESTING=ON .
cmake --build . --config Release
ctest -C Release
cmake --build . --config Debug
ctest -C Debug
```

## macOS
Expand Down Expand Up @@ -187,7 +216,7 @@ You can then simply run F3D from the command line:
./bin/f3d.app/Contents/MacOS/f3d
```

### Running the test suite
### Running the test suite (optional)

```
cmake -DBUILD_TESTING=ON ../src
Expand Down
2 changes: 1 addition & 1 deletion resources/completion.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ local f3dhelp

f3dhelp=$(f3d --help 2>&1 | sed '1,/Examples/!d' | sed 's/\[.*\] *//')

shortopts=$(echo $f3dhelp | grep "^\s*[-].," | sed "s/^ *\(-.\), *--[^ ]* *\(.*\)$/\1[\2]/")
shortopts=$(echo $f3dhelp | grep "^\s*[-]., --" | sed "s/^ *\(-.\), *--[^ ]* *\(.*\)$/\1[\2]/")
longopts=$(echo $f3dhelp | grep "[, ] [-]-" | sed 's/=.*>//g' | sed 's/-.,//g' | sed "s/^ *\([^ ]*\) *\(.*\)$/\1[\2]/g")

arguments=("${(f)shortopts}")
Expand Down

0 comments on commit 86ed346

Please sign in to comment.