Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 55d4d86

Browse files
committedOct 14, 2024
fix install
1 parent 6fe4038 commit 55d4d86

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ All
3636
```
3737
conan install . --output-folder=build --build=missing
3838
cd build
39-
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release
39+
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=out
4040
make -j9
4141
```
4242

‎src/CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
add_executable(radiopi player.cc main.cc)
22
target_link_libraries(radiopi PRIVATE ${LIBVLC_LIBRARY} Crow::Crow)
33

4-
file(MAKE_DIRECTORY static)
5-
file(COPY static/index.html DESTINATION static)
6-
file(COPY static/index.html DESTINATION ../static)
4+
install (TARGETS radiopi RUNTIME DESTINATION usr/bin)
5+
install (FILES static/index.html DESTINATION usr/bin/static)

‎src/main.cc

+5-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ int main(int /*ac*/, char ** /*av*/) {
5555
CROW_ROUTE(app, "/")
5656
([]() {
5757
crow::response resp;
58-
resp.set_static_file_info("static/index.html");
58+
59+
// https://stackoverflow.com/a/63229171
60+
auto index_html_path = std::filesystem::canonical("/proc/self/exe").parent_path() / "static/index.html";
61+
resp.set_static_file_info_unsafe(index_html_path);
5962
return resp;
6063
});
6164

@@ -169,5 +172,5 @@ int main(int /*ac*/, char ** /*av*/) {
169172
});
170173

171174
app.loglevel(crow::LogLevel::Info);
172-
app.port(8000).multithreaded().run();
175+
app.port(8001).multithreaded().run();
173176
}

0 commit comments

Comments
 (0)
Please sign in to comment.