Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
2fae476
allow building wihtout wxwidget
BSVogler Jan 10, 2025
6df246f
adapt code to work without GUI
BSVogler Jan 10, 2025
9feba9a
fix imports
BSVogler Jan 10, 2025
efaddea
remove headless file
BSVogler Jan 10, 2025
5b72112
slimmer build
BSVogler Jan 10, 2025
3d0c484
fix parsing of help and version commands
BSVogler Jan 10, 2025
d8c252b
remove headless launcher
BSVogler Jan 10, 2025
499d583
fix path
BSVogler Jan 10, 2025
c1b549d
Update .gitignore
BSVogler Jan 12, 2025
061c750
fix path
BSVogler Jan 10, 2025
a21bc4c
initial wasm config
BSVogler Jan 11, 2025
bd55889
update readme about new compilation capability
BSVogler Jan 11, 2025
947965c
fix path
BSVogler Jan 11, 2025
a5767ca
fix more build issues
BSVogler Jan 11, 2025
96f0f88
add wasm controller
BSVogler Jan 11, 2025
9c7b7c8
remove extra controller
BSVogler Jan 11, 2025
aa5539a
documentation
BSVogler Jan 11, 2025
ca2edf4
ignore wasm out
BSVogler Jan 11, 2025
823d8ca
change paths
BSVogler Jan 11, 2025
8f889c3
fix binding names
BSVogler Jan 11, 2025
69ed1bc
fix exe name
BSVogler Jan 11, 2025
c90ba0a
skip cli
BSVogler Jan 11, 2025
bc8ff16
try loading the resource files
BSVogler Jan 11, 2025
5767f57
checks to help debug file loading issues
BSVogler Jan 11, 2025
a8cb18f
fix writing only uploaded file
BSVogler Jan 11, 2025
cb592cd
add file extension to wasm
BSVogler Jan 11, 2025
fe3d4ee
more debugging
BSVogler Jan 11, 2025
bb8836a
make it work by skipping header lines in elements.txt
BSVogler Jan 11, 2025
1724afe
tried building the new form
BSVogler Jan 11, 2025
68f2eff
reorganize cmake
BSVogler Jan 12, 2025
c300b33
update version number
BSVogler Jan 12, 2025
bf8dd95
fix compilation again
BSVogler Jan 12, 2025
ba518bd
output it to the view
BSVogler Jan 12, 2025
a136747
working version
BSVogler Jan 12, 2025
28b2e8e
ignore all wasm output files
BSVogler Jan 12, 2025
fafebae
improve download buttons
BSVogler Jan 13, 2025
dc56383
file input to dropzone
BSVogler Jan 13, 2025
4526f24
fix export options
BSVogler Jan 13, 2025
5e40823
pass filename to allow all file formats
BSVogler Jan 13, 2025
5e1d527
remove prints
BSVogler Jan 13, 2025
8efcfb5
web workers for computation
BSVogler Jan 17, 2025
4bc0134
some parsing of the output table
BSVogler Jan 17, 2025
2bf6bf5
improve css
BSVogler Jan 17, 2025
e364a02
add version number back
BSVogler Jan 17, 2025
fc39a59
fix test build
BSVogler Feb 9, 2025
d6c2b0b
Update performance_test.cpp
BSVogler Feb 10, 2025
8a6cd54
copy static files for test
BSVogler Feb 10, 2025
261ef0b
Merge branch 'performance-test' into wasm
BSVogler Feb 10, 2025
0d6e533
fix loading files
BSVogler Feb 10, 2025
563cef4
compile as library
BSVogler Feb 10, 2025
c3dd9bd
enable obenmp
BSVogler Feb 10, 2025
8d63cc1
improve speed
BSVogler Feb 10, 2025
687ccc3
Merge branch 'performance-test' into no-gui-compilation
BSVogler Feb 10, 2025
e3ac5eb
correct port
BSVogler Feb 26, 2025
e961613
Update README.md
BSVogler Feb 26, 2025
a0965d4
fix openmp build issues
BSVogler Feb 26, 2025
99a41d1
resolve merge conflicts
BSVogler Jul 6, 2025
1a09d3f
Add submodule references to match upstream
BSVogler Jul 6, 2025
c2f3f64
fix comparing signed and unsigned int
BSVogler Jul 6, 2025
1d007d5
compile fixes for MOLOVOL_BUILD_GUI on or off
BSVogler Jul 6, 2025
ce5855b
increase version string to 1.2.1
BSVogler Jul 6, 2025
70000c0
remove aider ignore
BSVogler Jul 6, 2025
f723e51
Merge branch 'no-gui-compilation' into wasm
BSVogler Jul 6, 2025
0a3e510
update from upstream master
BSVogler Jul 6, 2025
1e53154
fix compile issues
BSVogler Jul 6, 2025
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ _site/

.idea/
*.pyc
webserver/molovol_wasm.*

# Virtual python environment
venv*/
Expand All @@ -61,3 +62,6 @@ external/VTK/build*
external/VTK/out/build*

notforcommit/
webserver/static/molovol_wasm.data
webserver/static/molovol_wasm.js
webserver/static/molovol_wasm.wasm
121 changes: 79 additions & 42 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "Minimum macOS deployment version" FORCE)

# Set name and version
project(MoloVol VERSION 1.2.0)
project(MoloVol VERSION 1.2.1)

if(NOT APPLE)
# Strip binary for release build
Expand All @@ -27,25 +27,54 @@ endif()

include(ExecutableName)
# EXE_NAME
if(EMSCRIPTEN)
set(EXE_NAME molovol_wasm)
endif()

# Specify C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# wxWidgets
set(wxWidgets_USE_STATIC=ON)
# Not ideal to use these absolute paths here
if (MSVC)
set(wxWidgets_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/wxWidgets")
set(wxWidgets_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/wxWidgets/lib/vc_x64_lib-x64-Release-MT")
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
endif()

find_package(wxWidgets REQUIRED core base gl OPTIONAL_COMPONENTS net)
include(${wxWidgets_USE_FILE})
if(APPLE)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY /opt/homebrew/opt/libomp/lib/libomp.dylib)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY /opt/homebrew/opt/libomp/lib/libomp.dylib)
endif()
endif()

#find_package(OpenMP)
if(MOLOVOL_RENDERER)
include(VTKRenderer)

# wxWidgets
if(MOLOVOL_BUILD_GUI)
set(wxWidgets_USE_STATIC=ON)
# Not ideal to use these absolute paths here
if (MSVC)
set(wxWidgets_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/wxWidgets")
set(wxWidgets_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/wxWidgets/lib/vc_x64_lib-x64-Release-MT")
endif()

if(MOLOVOL_RENDERER)
find_package(wxWidgets REQUIRED core base gl OPTIONAL_COMPONENTS net)
else()
find_package(wxWidgets REQUIRED core base OPTIONAL_COMPONENTS net)
endif()
include(${wxWidgets_USE_FILE})

if(MOLOVOL_RENDERER)
include(VTKRenderer)
endif()
endif()

# Add include path, so that header files can be found
Expand All @@ -68,11 +97,10 @@ endif()

include(Sources)
# SOURCES
if(MOLOVOL_RENDERER)
if(MOLOVOL_RENDERER AND MOLOVOL_BUILD_GUI)
list(APPEND SOURCES "src/render_frame.cpp")
endif()


include(Resources)
# ELEM_FILE
# SPACEGROUP_FILE
Expand All @@ -99,45 +127,54 @@ endif()
#set(CMAKE_INSTALL_RPATH "@executable_path/Frameworks")

# Target MoloVol
if (MSVC)
#target_sources(${EXE_NAME} PRIVATE ${WIN_RESOURCE_FILES})
add_executable(${EXE_NAME} WIN32 ${SOURCES} ${WIN_RESOURCE_FILES})
if(EMSCRIPTEN)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/wasm.cmake)
elseif(MSVC)
#target_sources(${EXE_NAME} PRIVATE ${WIN_RESOURCE_FILES})
add_executable(${EXE_NAME} WIN32 ${SOURCES} ${WIN_RESOURCE_FILES})
else()
add_executable(${EXE_NAME} ${SOURCES} ${OSX_RESOURCE_FILES})
add_executable(${EXE_NAME} ${SOURCES} ${OSX_RESOURCE_FILES})
endif()

# XCode, app bundle and libtiff
include(MacSpecific)

target_link_libraries(${EXE_NAME} ${wxWidgets_LIBRARIES})
if(MOLOVOL_RENDERER)
target_link_libraries(${EXE_NAME} ${WXVTK_LIB})
target_compile_definitions(${EXE_NAME} PRIVATE MOLOVOL_RENDERER)
target_link_libraries(${EXE_NAME} PRIVATE molovol_lib)

if(MOLOVOL_BUILD_GUI)
target_link_libraries(${EXE_NAME} ${wxWidgets_LIBRARIES})
target_compile_definitions(${EXE_NAME} PRIVATE MOLOVOL_GUI)
if(MOLOVOL_RENDERER)
target_link_libraries(${EXE_NAME} ${WXVTK_LIB})
target_compile_definitions(${EXE_NAME} PRIVATE MOLOVOL_RENDERER)
endif()
endif()

# Add custom flag
if(MOLOVOL_ABS_RESOURCE_PATH)
target_compile_definitions(${EXE_NAME} PUBLIC -DABS_PATH)
endif()

# Keeping this around just so I don't forget the syntax
# if(OpenMP_CXX_FOUND)
# target_link_libraries(target PUBLIC OpenMP::OpenMP_CXX)
# endif()

# Tests
if (MOLOVOL_BUILD_TESTING AND BUILD_TESTING)
include(Testing)
endif()

# Installation instructions for debian package
if (UNIX AND NOT APPLE)
include(DebInstall)
elseif(APPLE)
# This is needed for generation of the dmg file
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/MoloVol.app DESTINATION "."
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
if (NOT EMSCRIPTEN) # Only do native installations
if (UNIX AND NOT APPLE)
include(DebInstall)
elseif(APPLE)
# This is needed for generation of the dmg file
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/MoloVol.app DESTINATION "."
FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endif()
endif()

include(Packing)


#this openMP section is currently commented out as it leads to runtime crashed because of some memory issue
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries(${EXE_NAME} PUBLIC OpenMP::OpenMP_CXX)
target_compile_definitions(${EXE_NAME} PUBLIC HAVE_OPENMP)
endif()


# Ensure molovol_test is built if MOLOVOL_BUILD_TESTING is ON
if(MOLOVOL_BUILD_TESTING)
include(Testing) # Include Testing.cmake here
endif()
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@ software for your own purposes or propose changes to the developers and take par
Dependencies needed for compilation:

- Any C++ compiler
- [wxWidgets 3.1.5](https://www.wxwidgets.org)
- cmake
- Optional for native GUI: [wxWidgets 3.1.5](https://www.wxwidgets.org)

You can build without the desktop native GUI by setting it up with
`cmake -DMOLOVOL_BUILD_GUI=0`

You can build for wasm with set-up
`emcmake cmake -DCMAKE_VERBOSE_MAKEFILE=ON -DMOLOVOL_BUILD_GUI=0 ..`
then compile with
`emmake make`

### MoloVol Web

Expand All @@ -58,7 +67,7 @@ front-end wrapping the MoloVol CLI interface. To launch, first change the FLASK_
the command `export FLASK_APP=./webserver/app.py` from the project's root directory. Then execute `flask run`.
For hosting on a web server check out the next section.

### Containerized application
### Containerized cli application

Instead of compiling or running the binaries you can also use a containerized version (for instance using docker or
podman) to access the CLI or web interface.
Expand All @@ -72,7 +81,7 @@ below with your local image name.
Running a container:
- For a short-lived container: Pass the CLI arguments in the run command:
`docker run -it bsvogler/molovol ./launch_headless.sh <yourMolovolArguments>`
- To run web application http://localhost:80: run
- To run web application http://localhost:5000: run
`docker run -dt --restart=always -p 5000:5000 --name molovol bsvogler/molovol`.
When not otherwise specified the default port of a flask instance is 5000.

Expand Down
51 changes: 28 additions & 23 deletions cmake/DebInstall.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@

include(GNUInstallDirs)

# Compress changelog
# Compress changelog and man pages (needed for both GUI and non-GUI)
set(DEB_CHANGELOG_COMPRESSED "${CMAKE_CURRENT_BINARY_DIR}/changelog.gz")
set(DEB_MAN_COMPRESSED "${CMAKE_CURRENT_BINARY_DIR}/molovol.1.gz")
set(HICOLOR_DIR "${CMAKE_CURRENT_BINARY_DIR}/hicolor")

add_custom_command(
OUTPUT ${DEB_CHANGELOG_COMPRESSED} ${DEB_MAN_COMPRESSED}
Expand All @@ -15,39 +13,46 @@ add_custom_command(
COMMENT "Compressing changelog and manual file"
)

add_custom_command(
OUTPUT ${HICOLOR_DIR}
COMMAND bash ${DEB_RES_DIR}/shell/resize_icon ${DEB_ICON} ./
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${DEB_ICON}
COMMENT "Resizing icon to supported sizes"
)

add_custom_target(compress ALL DEPENDS ${DEB_CHANGELOG_COMPRESSED} ${DEB_MAN_COMPRESSED})

add_custom_target(resize_icon ALL DEPENDS ${HICOLOR_DIR})

#
execute_process(COMMAND dpkg --print-architecture COMMAND tr -d '\n' OUTPUT_VARIABLE LINUX_ARCHITECTURE)
if(MOLOVOL_BUILD_GUI)
# GUI-specific icon processing
set(HICOLOR_DIR "${CMAKE_CURRENT_BINARY_DIR}/hicolor")

add_custom_command(
OUTPUT ${HICOLOR_DIR}
COMMAND bash ${DEB_RES_DIR}/shell/resize_icon ${DEB_ICON} ./
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${DEB_ICON}
COMMENT "Resizing icon to supported sizes"
)

add_custom_target(resize_icon ALL DEPENDS ${HICOLOR_DIR})
endif()

# Set directory permissions to 0755
# Must come before install commands
set(
CPACK_INSTALL_DEFAULT_DIRECTORY_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

# Install commands so that these files get added to the deb file
# Install commands for both GUI and non-GUI
install(TARGETS ${EXE_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES ${ELEM_FILE} ${SPACEGROUP_FILE}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/${EXE_NAME})
install(FILES ${DEB_COPYRIGHT_FILE} ${DEB_CHANGELOG_COMPRESSED}
DESTINATION ${CMAKE_INSTALL_DATADIR}/doc/${EXE_NAME})
install(FILES ${DEB_DESKTOP_FILE}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES ${DEB_MAN_COMPRESSED} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install(FILES ${DEB_ICON} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
install(DIRECTORY ${HICOLOR_DIR} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons)

install(FILES ${DEB_MAN_COMPRESSED}
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)

# GUI-specific install commands
if(MOLOVOL_BUILD_GUI)
install(FILES ${DEB_DESKTOP_FILE}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES ${DEB_ICON}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pixmaps)
install(DIRECTORY ${HICOLOR_DIR}
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons)
endif()
21 changes: 13 additions & 8 deletions cmake/MacSpecific.cmake
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@

# XCode compatibility
set_target_properties(${EXE_NAME} PROPERTIES
XCODE_GENERATE_SCHEME TRUE
XCODE_SCHEME_WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)

# macOS Bundle
set_target_properties(${EXE_NAME} PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME ${EXE_NAME}
MACOSX_BUNDLE_EXECUTABLE_NAME ${EXE_NAME}
MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_ICON_FILE icon
)
if(MOLOVOL_BUILD_GUI)
# macOS Bundle
set_target_properties(${EXE_NAME} PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME ${EXE_NAME}
MACOSX_BUNDLE_EXECUTABLE_NAME ${EXE_NAME}
MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION}
MACOSX_BUNDLE_ICON_FILE icon
)

# Library shenanigans for wxWidgets
if(APPLE)
string(REPLACE "-ltiff" "/usr/local/opt/libtiff/lib/libtiff.a" wxWidgets_LIBRARIES "${wxWidgets_LIBRARIES}")
endif()
endif()
5 changes: 5 additions & 0 deletions cmake/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ if (CMAKE_MACOSX_BUNDLE AND NOT MOLOVOL_ABS_RESOURCE_PATH)
set(MOLOVOL_ABS_RESOURCE_PATH TRUE)
endif()

option(
MOLOVOL_BUILD_GUI
"Build MoloVol with GUI support (requires wxWidgets)"
ON
)
option(
MOLOVOL_RENDERER
"Enable compilation and linking to wxVTK24"
Expand Down
Loading