Skip to content

Commit 9770ef7

Browse files
committed
fix flatpak build
1 parent 4080e72 commit 9770ef7

File tree

7 files changed

+83
-292
lines changed

7 files changed

+83
-292
lines changed

org.noise_planet.i-simpa.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,18 @@ modules:
5757
- name: wxwidgets
5858
buildsystem: cmake
5959
config-opts:
60-
- -DCMAKE_BUILD_TYPE=Release
61-
- -DwxBUILD_SHARED=ON
60+
- -DCMAKE_BUILD_TYPE=Release -
61+
- -DwxBUILD_SAMPLES=OFF
62+
- -DwxBUILD_TESTS=OFF
63+
- -DwxBUILD_SHARED=OFF
6264
- -DwxUSE_OPENGL=ON
63-
- -DwxUSE_GLCANVAS_EGL=ON
65+
- -DwxUSE_STATIC=ON
6466
- -DwxUSE_UNICODE=ON
6567
- -DwxUSE_LIBTIFF=OFF
68+
- -DwxUSE_GLCANVAS_EGL=ON
69+
- -DwxUSE_LIBWEBP=OFF
70+
- -DwxBUILD_MONOLITHIC=ON
71+
- -DwxBUILD_LOCALES=ON
6672
sources:
6773
- type: archive
6874
url: https://github.com/wxWidgets/wxWidgets/releases/download/v3.3.1/wxWidgets-3.3.1.tar.bz2
@@ -116,5 +122,3 @@ modules:
116122
- -DCPM_SOURCE_CACHE=/app/share
117123
- -DBoost_DIR=/app/lib64/cmake/Boost-1.86.0
118124
- -DBOOST_ROOT=/app
119-
- -DGLUT_INCLUDE_DIR=/app/include
120-
- DGLUT_glut_LIBRARY=/app/lib/libglut.so

src/isimpa/CMakeLists.txt

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,12 @@ endif()
1818
if(IS_FLATPAK)
1919
set(ISIMPA_ICON_DIR share/icons/hicolor/256x256/apps)
2020
set(ISIMPA_BIN_DIR "${CMAKE_INSTALL_BINDIR}")
21-
set(ISIMPA_DATA_DIR "${CMAKE_INSTALL_DATADIR}")
22-
set(ISIMPA_DOC_DIR "${CMAKE_INSTALL_DOCDIR}")
2321
elseif (WIN32)
2422
set(ISIMPA_ICON_DIR .)
2523
set(ISIMPA_BIN_DIR .)
26-
set(ISIMPA_DATA_DIR .)
27-
set(ISIMPA_DOC_DIR .)
2824
else ()
2925
set(ISIMPA_ICON_DIR .)
3026
set(ISIMPA_BIN_DIR "${CMAKE_INSTALL_BINDIR}")
31-
set(ISIMPA_DATA_DIR "${CMAKE_INSTALL_DATADIR}")
32-
set(ISIMPA_DOC_DIR "${CMAKE_INSTALL_DOCDIR}")
3327
endif()
3428

3529
MACRO(ADDMULTIPLE_LANG curdir installdir appname)
@@ -491,25 +485,6 @@ else ()
491485
set(RESOURCE_DEST_DIR "$<TARGET_FILE_DIR:isimpa>/resources")
492486
endif()
493487

494-
# to convert .po files into .mo files
495-
FIND_PACKAGE(Gettext)
496-
IF(GETTEXT_FOUND )
497-
MESSAGE(STATUS "Found Gettext")
498-
# Main isimpa locale
499-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/lang "${RESOURCE_DEST_DIR}/share/locale" "isimpa")
500-
# Plugins locale
501-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/check_version/locale "${RESOURCE_DEST_DIR}/SystemScript/check_version/locale" "isimpa")
502-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/job_tool/locale "${RESOURCE_DEST_DIR}/SystemScript/job_tool/locale" "isimpa")
503-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/moveto_vertex/locale "${RESOURCE_DEST_DIR}/SystemScript/moveto_vertex/locale" "isimpa")
504-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/preceiv_sourceTracker/locale "${RESOURCE_DEST_DIR}/SystemScript/preceiv_sourceTracker/locale" "isimpa")
505-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/recp_tool/locale "${RESOURCE_DEST_DIR}/SystemScript/recp_tool/locale" "isimpa")
506-
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/source_tools/locale "${RESOURCE_DEST_DIR}/SystemScript/source_tools/locale" "isimpa")
507-
# WxWidgets locale
508-
ADDMULTIPLE_LANG(${wxWidgets_SOURCE_DIR}/locale "${RESOURCE_DEST_DIR}/share/locale" "wx")
509-
ELSE ()
510-
MESSAGE(WARNING "Gettext not found !")
511-
ENDIF()
512-
513488
# Creates a folder "executables" and adds target
514489
# project (isimpa.vcproj) under it
515490
set_property(TARGET isimpa PROPERTY FOLDER "executables")
@@ -518,20 +493,21 @@ set_target_properties(isimpa PROPERTIES MACOSX_BUNDLE_ICON_FILE "isimpa.icns")
518493

519494
SET(wxUSE_GLCANVAS_EGL OFF)
520495

496+
set(wxWidgets_USE_STATIC_LIBS ON)
497+
SET(wxWidgets_USE_STATIC ON)
498+
521499
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
522500
SET(wxWidgets_USE_DEBUG ON)
523-
SET(wxWidgets_USE_STATIC ON)
524501
MESSAGE(STATUS "Using debug version of wxWidgets")
525502
ELSE()
526503
SET(wxWidgets_USE_DEBUG OFF)
527-
SET(wxWidgets_USE_STATIC ON)
528504
ENDIF()
529505

530506
# add wxWidgets as dependency
531507

532508
set(USING_CPM false)
533509

534-
find_package(wxWidgets 3.3.1)
510+
find_package(wxWidgets 3.3.1 COMPONENTS mono)
535511

536512
if(wxWidgets_FOUND)
537513

@@ -547,7 +523,7 @@ if(wxWidgets_FOUND)
547523
endif()
548524
endif()
549525

550-
find_package(wxWidgets COMPONENTS core base xml gl aui adv html REQUIRED)
526+
find_package(wxWidgets COMPONENTS mono REQUIRED)
551527

552528
include(${wxWidgets_USE_FILE})
553529
else(NOT wxWidgets_FOUND)
@@ -580,6 +556,30 @@ else(NOT wxWidgets_FOUND)
580556
)
581557
endif()
582558

559+
# to convert .po files into .mo files
560+
FIND_PACKAGE(Gettext)
561+
IF(GETTEXT_FOUND )
562+
MESSAGE(STATUS "Found Gettext")
563+
# Main isimpa locale
564+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/lang "${RESOURCE_DEST_DIR}/share/locale" "isimpa")
565+
# Plugins locale
566+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/check_version/locale "${RESOURCE_DEST_DIR}/SystemScript/check_version/locale" "isimpa")
567+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/job_tool/locale "${RESOURCE_DEST_DIR}/SystemScript/job_tool/locale" "isimpa")
568+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/moveto_vertex/locale "${RESOURCE_DEST_DIR}/SystemScript/moveto_vertex/locale" "isimpa")
569+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/preceiv_sourceTracker/locale "${RESOURCE_DEST_DIR}/SystemScript/preceiv_sourceTracker/locale" "isimpa")
570+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/recp_tool/locale "${RESOURCE_DEST_DIR}/SystemScript/recp_tool/locale" "isimpa")
571+
ADDMULTIPLE_LANG(${CMAKE_CURRENT_SOURCE_DIR}/resources/SystemScript/source_tools/locale "${RESOURCE_DEST_DIR}/SystemScript/source_tools/locale" "isimpa")
572+
# WxWidgets locale
573+
# Check if wxWidgets_SOURCE_DIR exists (will generate wx locales if wxBUILD_LOCALES is off)
574+
if (EXISTS "${wxWidgets_SOURCE_DIR}")
575+
message(WARNING "wxWidgets source directory not found: ${wxWidgets_SOURCE_DIR}")
576+
ADDMULTIPLE_LANG(${wxWidgets_SOURCE_DIR}/locale "${RESOURCE_DEST_DIR}/share/locale" "wx")
577+
endif ()
578+
ELSE ()
579+
MESSAGE(WARNING "Gettext not found !")
580+
ENDIF()
581+
582+
583583
execute_process(COMMAND ${Python3_EXECUTABLE} -c "import sys; import sysconfig; print(list(sysconfig.get_paths().values()))"
584584
OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
585585

@@ -697,6 +697,7 @@ if(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS)
697697
)
698698
endif()
699699

700+
700701
add_custom_command(TARGET isimpa POST_BUILD
701702
COMMAND ${CMAKE_COMMAND} -E copy_directory
702703
"$<TARGET_FILE_DIR:libsimpa>"
@@ -707,49 +708,52 @@ add_custom_command(TARGET isimpa POST_BUILD
707708
"${RESOURCE_DEST_DIR}/libsimpa/CMakeFiles"
708709
COMMENT "Copying libsimpa to isimpa binary directory"
709710
)
711+
if(NOT IS_FLATPAK)
712+
# Copy dependencies to bin directory of I-SIMPA in order to be able to debug the application in Visual Studio/CLion
710713

711-
add_custom_command(TARGET isimpa POST_BUILD
712-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
713-
"$<TARGET_FILE:spps>"
714-
"$<TARGET_FILE_DIR:isimpa>/"
715-
COMMENT "Copying spps binary to isimpa binary directory"
716-
)
714+
add_custom_command(TARGET isimpa POST_BUILD
715+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
716+
"$<TARGET_FILE:spps>"
717+
"$<TARGET_FILE_DIR:isimpa>/"
718+
COMMENT "Copying spps binary to isimpa binary directory"
719+
)
717720

718-
add_custom_command(TARGET isimpa POST_BUILD
719-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
720-
"$<TARGET_FILE:vmr>"
721-
"$<TARGET_FILE_DIR:isimpa>"
722-
COMMENT "Copying vmr to isimpa binary directory"
723-
)
721+
add_custom_command(TARGET isimpa POST_BUILD
722+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
723+
"$<TARGET_FILE:vmr>"
724+
"$<TARGET_FILE_DIR:isimpa>"
725+
COMMENT "Copying vmr to isimpa binary directory"
726+
)
724727

725-
add_custom_command(TARGET isimpa POST_BUILD
726-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
727-
"$<TARGET_FILE:tetgen>"
728-
"$<TARGET_FILE_DIR:isimpa>"
729-
COMMENT "Copying tetgen to isimpa binary directory"
730-
)
728+
add_custom_command(TARGET isimpa POST_BUILD
729+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
730+
"$<TARGET_FILE:tetgen>"
731+
"$<TARGET_FILE_DIR:isimpa>"
732+
COMMENT "Copying tetgen to isimpa binary directory"
733+
)
731734

732-
add_custom_command(TARGET isimpa POST_BUILD
733-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
734-
"$<TARGET_FILE:classicalTheory>"
735-
"$<TARGET_FILE_DIR:isimpa>"
736-
COMMENT "Copying classicalTheory to isimpa binary directory"
737-
)
735+
add_custom_command(TARGET isimpa POST_BUILD
736+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
737+
"$<TARGET_FILE:classicalTheory>"
738+
"$<TARGET_FILE_DIR:isimpa>"
739+
COMMENT "Copying classicalTheory to isimpa binary directory"
740+
)
738741

739-
add_custom_command(TARGET isimpa POST_BUILD
740-
COMMAND ${CMAKE_COMMAND} -E copy_if_different
741-
"$<TARGET_FILE:preprocess>"
742-
"$<TARGET_FILE_DIR:isimpa>"
743-
COMMENT "Copying preprocess to isimpa binary directory"
744-
)
742+
add_custom_command(TARGET isimpa POST_BUILD
743+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
744+
"$<TARGET_FILE:preprocess>"
745+
"$<TARGET_FILE_DIR:isimpa>"
746+
COMMENT "Copying preprocess to isimpa binary directory"
747+
)
748+
endif ()
745749

746750
#######################################################################
747751
# Prepare install commands for CPack builder
748752
if(APPLE)
749753
set( "" CACHE STRING "The development team ID for code signing")
750754

751755
if(TEAM_ID STREQUAL "")
752-
message(FATAL_ERROR "Please set the TEAM_ID variable when generating the project")
756+
message(WARNING "Please set the TEAM_ID variable when generating the project")
753757
endif()
754758

755759
set(CMAKE_MACOSX_BUNDLE YES) # after this line, paste this:
@@ -776,6 +780,11 @@ install(TARGETS isimpa
776780
LIBRARY DESTINATION ${ISIMPA_BIN_DIR}
777781
ARCHIVE DESTINATION ${ISIMPA_BIN_DIR})
778782

783+
if (IS_FLATPAK)
784+
install(TARGETS spps vmr classicalTheory tetgen preprocess DESTINATION "${ISIMPA_BIN_DIR}")
785+
install(DIRECTORY ${RESOURCE_DEST_DIR} DESTINATION "${ISIMPA_BIN_DIR}")
786+
endif ()
787+
779788
if(APPLE)
780789
# CPack bundle plist location after install
781790
SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/isimpa.app/Contents/Info.plist")

src/isimpa/main/i_simpa_main.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ MainUiFrame::MainUiFrame(wxLocale &lang) : wxFrame(NULL, -1, wxGetTranslation("I
163163
//m_mgr.SetFrame(this);
164164
m_mgr.SetManagedWindow(this);
165165
wxIcon ico_ui;
166-
#ifdef _WINDOWS
166+
#ifdef _WINDOWS
167+
ico_ui.LoadFile(resourceFolder + "/isimpa.ico",wxBITMAP_TYPE_ICO);
168+
#elif defined(__linux__)
167169
ico_ui.LoadFile(resourceFolder + "/isimpa.ico",wxBITMAP_TYPE_ICO);
168170
#else
169171
ico_ui.LoadFile(resourceFolder + "/isimpa.icns",wxBITMAP_TYPE_ICON);

src/isimpa/main/i_simpa_main.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ class ISimpaApp : public wxApp
447447
wxImage::AddHandler(new wxICOHandler); //ajoute le support du format ico
448448

449449
// Charge le gestionnaire de language
450-
wxLocale::AddCatalogLookupPathPrefix(stPath.GetResourcesDir() + wxFileName::GetPathSeparator() + _T("share") + wxFileName::GetPathSeparator() + _T("locale"));
450+
wxString langDir=ApplicationConfiguration::getResourcesFolder()+wxFileName::GetPathSeparator()+_T("share")+wxFileName::GetPathSeparator()+_T("locale");
451+
wxLocale::AddCatalogLookupPathPrefix(langDir);
451452
wxLanguage choosenLanguage=wxLANGUAGE_DEFAULT;
452453
wxString strConf;
453454
if(ApplicationConfiguration::GetFileConfig()->Read("interface/language",&strConf))

src/isimpa/platform/darwin/CMakeLists.txt

Lines changed: 0 additions & 35 deletions
This file was deleted.

src/isimpa/platform/linux/CMakeLists.txt

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)