Skip to content

Commit

Permalink
Added an option to create wxCrafter standalong deb package
Browse files Browse the repository at this point in the history
wxCrafter standalone: removed calls "Register your wxCrafter"
  • Loading branch information
eranif committed Dec 30, 2021
1 parent 1395fef commit 04ec408
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 186 deletions.
183 changes: 94 additions & 89 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -634,109 +634,114 @@ if( NOT SQLITE3_FOUND )
add_subdirectory(sqlite3)
endif()

# build the Core part of CodeLite (regardless of the final target)
add_subdirectory(sdk/wxsqlite3)
add_subdirectory(sdk/wxshapeframework)
add_subdirectory(sdk/databaselayer)
add_subdirectory(CodeLite)
add_subdirectory(Plugin)
add_subdirectory(PCH)

if(NOT NO_CORE_PLUGINS)
add_subdirectory(abbreviation)
if(NOT DISABLE_CXX)
add_subdirectory(Gizmos)
add_subdirectory(Debugger)
add_subdirectory(UnitTestCPP)
add_subdirectory(QmakePlugin)
add_subdirectory(cppchecker)
add_subdirectory(wxformbuilder)
add_subdirectory(CMakePlugin)
add_subdirectory(cscope)
add_subdirectory(EOSWiki)
endif()
add_subdirectory(AutoSave)
add_subdirectory(CodeLiteDiff)
add_subdirectory(git)
add_subdirectory(Outline)
add_subdirectory(CodeFormatter)
add_subdirectory(Copyright)
add_subdirectory(DatabaseExplorer)
add_subdirectory(ExternalTools)
add_subdirectory(SnipWiz)
add_subdirectory(Subversion2)
add_subdirectory(ZoomNavigator)
add_subdirectory(SpellChecker)
add_subdirectory(Tail)
add_subdirectory(EditorConfigPlugin)
add_subdirectory(PHPLint)
add_subdirectory(PHPRefactoring)
add_subdirectory(codelite_vim)
add_subdirectory(Docker)
add_subdirectory(LanguageServer)
add_subdirectory(Rust)
if (WITH_SFTP)
add_subdirectory(SFTP)
add_subdirectory(Remoty)
endif(WITH_SFTP)

if (WITH_LLDB AND NOT DISABLE_CXX)
add_subdirectory(LLDBDebugger)
endif()
if (WXC_APP)
add_subdirectory(wxcrafter)
else()
if(NOT NO_CORE_PLUGINS)
add_subdirectory(abbreviation)
if(NOT DISABLE_CXX)
add_subdirectory(Gizmos)
add_subdirectory(Debugger)
add_subdirectory(UnitTestCPP)
add_subdirectory(QmakePlugin)
add_subdirectory(cppchecker)
add_subdirectory(wxformbuilder)
add_subdirectory(CMakePlugin)
add_subdirectory(cscope)
add_subdirectory(EOSWiki)
endif()
add_subdirectory(AutoSave)
add_subdirectory(CodeLiteDiff)
add_subdirectory(git)
add_subdirectory(Outline)
add_subdirectory(CodeFormatter)
add_subdirectory(Copyright)
add_subdirectory(DatabaseExplorer)
add_subdirectory(ExternalTools)
add_subdirectory(SnipWiz)
add_subdirectory(Subversion2)
add_subdirectory(ZoomNavigator)
add_subdirectory(SpellChecker)
add_subdirectory(Tail)
add_subdirectory(EditorConfigPlugin)
add_subdirectory(PHPLint)
add_subdirectory(PHPRefactoring)
add_subdirectory(codelite_vim)
add_subdirectory(Docker)
add_subdirectory(LanguageServer)
add_subdirectory(Rust)
if (WITH_SFTP)
add_subdirectory(SFTP)
add_subdirectory(Remoty)
endif(WITH_SFTP)

if (WITH_LLDB AND NOT DISABLE_CXX)
add_subdirectory(LLDBDebugger)
endif()

add_subdirectory(codelitephp)
add_subdirectory(WordCompletion)
add_subdirectory(HelpPlugin)
add_subdirectory(WebTools)
add_subdirectory(SmartCompletion)
add_subdirectory(codelitephp)
add_subdirectory(WordCompletion)
add_subdirectory(HelpPlugin)
add_subdirectory(WebTools)
add_subdirectory(SmartCompletion)

if(UNIX AND NOT APPLE AND NOT DISABLE_CXX)
## Add valgrind plugin
add_subdirectory(MemCheck)
endif()
if(UNIX AND NOT APPLE AND NOT DISABLE_CXX)
## Add valgrind plugin
add_subdirectory(MemCheck)
endif()

if(APPLE AND NOT DISABLE_CXX)
message("-- Adding MacBundler...")
add_subdirectory(MacBundler)
endif()
endif(NOT NO_CORE_PLUGINS)
if(APPLE AND NOT DISABLE_CXX)
message("-- Adding MacBundler...")
add_subdirectory(MacBundler)
endif()
endif(NOT NO_CORE_PLUGINS)

# wxCrafter is not a core plugin so we include it we find the directory
if(IS_DIRECTORY "${CL_SRC_ROOT}/wxcrafter" AND NOT DISABLE_CXX AND NOT NO_CORE_PLUGINS)
add_subdirectory(wxcrafter)
endif()
# wxCrafter is not a core plugin so we include it we find the directory
if(IS_DIRECTORY "${CL_SRC_ROOT}/wxcrafter" AND NOT DISABLE_CXX AND NOT NO_CORE_PLUGINS)
add_subdirectory(wxcrafter)
endif()

## Executables
if(NOT SDK_ONLY)
add_subdirectory(LiteEditor)
add_subdirectory(codelitegcc)
add_subdirectory(codelite_make)
add_subdirectory(codelite_terminal)
add_subdirectory(sdk/codelite_indexer)
add_subdirectory(sdk/codelite_cppcheck)
add_subdirectory(codelite_echo)
add_subdirectory(ctagsd)
endif()
##
## Setup the proper dependencies
##
if(NOT SQLITE3_FOUND)
if ( USE_PCH AND NOT MINGW )
add_dependencies(sqlite3lib ${CL_PCH_TARGET})
## Executables
if(NOT SDK_ONLY)
add_subdirectory(LiteEditor)
add_subdirectory(codelitegcc)
add_subdirectory(codelite_make)
add_subdirectory(codelite_terminal)
add_subdirectory(sdk/codelite_indexer)
add_subdirectory(sdk/codelite_cppcheck)
add_subdirectory(codelite_echo)
add_subdirectory(ctagsd)
endif()
##
## Setup the proper dependencies
##
if(NOT SQLITE3_FOUND)
if ( USE_PCH AND NOT MINGW )
add_dependencies(sqlite3lib ${CL_PCH_TARGET})
endif()
add_dependencies(wxsqlite3 sqlite3lib)
endif()
add_dependencies(wxsqlite3 sqlite3lib)
endif()

add_dependencies(databaselayersqlite wxsqlite3)
add_dependencies(wxshapeframework wxsqlite3)
add_dependencies(libcodelite wxshapeframework databaselayersqlite wxsqlite3)
add_dependencies(plugin libcodelite)
add_dependencies(databaselayersqlite wxsqlite3)
add_dependencies(wxshapeframework wxsqlite3)
add_dependencies(libcodelite wxshapeframework databaselayersqlite wxsqlite3)
add_dependencies(plugin libcodelite)

if(NOT SDK_ONLY)
add_dependencies(codelite plugin)
endif()
if(NOT SDK_ONLY)
add_dependencies(codelite plugin)
endif()

## Include our custom plugin.cmake module
include(plugin)
## Include our custom plugin.cmake module
include(plugin)

## Scan for user plugins
CL_SCAN_FOR_PLUGINS()
## Scan for user plugins
CL_SCAN_FOR_PLUGINS()
endif() # NOT WXC_APP
13 changes: 3 additions & 10 deletions Plugin/bitmap_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,14 @@ wxIcon BitmapLoader::GetIcon(const wxBitmap& bmp) const
void BitmapLoader::Initialize(bool darkTheme)
{
wxString zipname;
wxFileName fn;

// Under linux, take into account the --prefix
#ifdef __WXGTK__
wxString bitmapPath = wxString(INSTALL_DIR, wxConvUTF8);
fn = wxFileName(bitmapPath, zipname);
#else
fn = wxFileName(clStandardPaths::Get().GetDataDir(), zipname);
#endif

// Load the bitmaps based on the current theme background colour
wxFileName fnLight(clStandardPaths::Get().GetDataDir(), "codelite-bitmaps-light.zip");
wxFileName fnDark(clStandardPaths::Get().GetDataDir(), "codelite-bitmaps-dark.zip");
wxFileName fnNewZip = darkTheme ? fnDark : fnLight;

clDEBUG() << "Loading bitmap resources:" << fnLight << endl;
clDEBUG() << "Loading bitmap resources:" << fnDark << endl;

#ifdef __WXOSX__
if(fnNewZip.FileExists()) {
clZipReader zip(fnNewZip);
Expand Down
78 changes: 36 additions & 42 deletions wxcrafter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@



if ( WXC_APP )
if(WXC_APP)
message("-- Building wxCrafter as a standalone executable ")
add_definitions( -DSTANDALONE_BUILD=1 )
add_definitions( -DINSTALL_PREFIX=\"${CL_PREFIX}\")
else ( WXC_APP )
else()
message("-- Building wxCrafter as codelite plugin ")
add_definitions( -DWXCAPP=0 )
if (OFFICIAL_CL_BUILD)
message("-- Building wxCrafter for an official CodeLite build")
endif (OFFICIAL_CL_BUILD)

endif ( WXC_APP )
endif(WXC_APP)

# set the plugin name here
if ( WXC_APP )
set( PLUGIN_NAME "wxcrafter")
else ( WXC_APP )
set( PLUGIN_NAME "wxCrafter")
endif ( WXC_APP)
if(WXC_APP)
set(PLUGIN_NAME "wxcrafter")
else()
set(PLUGIN_NAME "wxCrafter")
endif()

set( WXC_DIR "${CL_SRC_ROOT}/wxcrafter")
if(NOT CL_SRC_ROOT)
message(STATUS "Please set CL_SRC_ROOT to CodeLite source directory as in -DCL_SRC_ROOT=...")
message(FATAL_ERROR "Missing CL_SRC_ROOT")
endif()

set(WXC_DIR "${CL_SRC_ROOT}/wxcrafter")

message("-- Generating makefile for wxCrafter")

Expand Down Expand Up @@ -101,7 +99,9 @@ else ( NOT WXC_APP )
add_executable(${PLUGIN_NAME} ${SRCS})
endif ( NOT WXC_APP )

target_precompile_headers(${PLUGIN_NAME} REUSE_FROM PCH)
if(NOT WXC_APP)
target_precompile_headers(${PLUGIN_NAME} REUSE_FROM PCH)
endif()

# Remove the "lib" prefix from the plugin name
set_target_properties(${PLUGIN_NAME} PROPERTIES PREFIX "")
Expand Down Expand Up @@ -131,24 +131,23 @@ if ( NOT WXC_APP )
## wxCrafter as codelite's plugin
CL_INSTALL_PLUGIN(${PLUGIN_NAME})
CL_INSTALL_FILE_SHARED(${WXC_DIR}/wxgui.zip)

else ( NOT WXC_APP )

else ()
set(CPACK_DEB_COMPONENT_INSTALL 1)

## Installing an application
install(TARGETS ${PLUGIN_NAME} DESTINATION ${CL_PREFIX}/bin PERMISSIONS ${EXE_PERM} COMPONENT standalone)
install(FILES "${WXC_DIR}/wxgui.zip" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME} COMPONENT standalone)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/liblibcodelite.so" DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libplugin.so" DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libwxsqlite3.so" DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)
install(FILES "${CL_SRC_ROOT}/wxcrafter/resources/wxc-logo-64.png" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME} COMPONENT standalone)
install(FILES "${CL_SRC_ROOT}/Runtime/config/codelite.xml.default.gtk" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME}/config RENAME codelite.xml.default COMPONENT standalone)

if ( NOT DEBUG_BUILD )
message("-- Will install ${CL_SRC_ROOT}/wxcrafter/wxCrafter.desktop to /usr/share/applications")
install(FILES "${CL_SRC_ROOT}/wxcrafter/wxCrafter.desktop" DESTINATION /usr/share/applications COMPONENT standalone)
endif ( NOT DEBUG_BUILD )
install(FILES "${WXC_DIR}/wxgui.zip" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME} COMPONENT standalone)
install(FILES "${CL_SRC_ROOT}/Runtime/codelite-bitmaps-light.zip" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME} COMPONENT standalone)
install(FILES "${CL_SRC_ROOT}/Runtime/codelite-bitmaps-dark.zip" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME} COMPONENT standalone)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/liblibcodelite.so" DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libplugin.so" DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)
install(FILES "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libwxsqlite3.so" DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)
install(FILES "${CL_SRC_ROOT}/wxcrafter/resources/wxc-logo-64.png" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME} COMPONENT standalone)
install(FILES "${CL_SRC_ROOT}/Runtime/config/codelite.xml.default.gtk" DESTINATION ${CL_PREFIX}/share/${PLUGIN_NAME}/config RENAME codelite.xml.default COMPONENT standalone)

if ( NOT DEBUG_BUILD )
message("-- Will install ${CL_SRC_ROOT}/wxcrafter/wxCrafter.desktop to /usr/share/applications")
install(FILES "${CL_SRC_ROOT}/wxcrafter/wxCrafter.desktop" DESTINATION /usr/share/applications COMPONENT standalone)
endif ( NOT DEBUG_BUILD )

## Install codelite lexer files
install(
Expand All @@ -164,13 +163,8 @@ endif ( NOT DEBUG_BUILD )
## CPack
##############################################
message("-- Generating deb target")
if( ${ARCH} EQUAL 32 )
message("-- CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386")
else ()
message("-- CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
endif ()
message("-- CPACK_DEBIAN_PACKAGE_ARCHITECTURE amd64")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")

#################################################################
## We need to deduce the location of the wx libs to be installed
Expand Down Expand Up @@ -199,13 +193,13 @@ endif ( NOT DEBUG_BUILD )
install(FILES ${wxfilepaths} DESTINATION ${WXC_LIBS_DIR} COMPONENT standalone)

set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_NAME "wxCrafter")
set(CPACK_PACKAGE_NAME "wxCrafter${GTKNAME}")
set(CPACK_PACKAGE_VERSION "2.9")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Eran Ifrah <eran[email protected]>") #required
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Eran Ifrah <eran@codelite.org>") #required
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GUI Rad Tool for wxWidgets")
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_RECOMMENDS "build-essential")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libssh-4, libsqlite3-dev")
INCLUDE(CPack)
endif ( NOT WXC_APP )
endif(NOT WXC_APP)
7 changes: 7 additions & 0 deletions wxcrafter/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#include "main.h"

#include "file_logger.h"
#include "serial_number.h"
#include "wx/frame.h"
#include "wx/toplevel.h"
Expand All @@ -8,6 +10,7 @@
#include "wxgui_bitmaploader.h"
#include "wxgui_defs.h"
#include "wxguicraft_main_view.h"

#include <ColoursAndFontsManager.h>
#include <bitmap_loader.h>
#include <cl_aui_dock_art.h>
Expand Down Expand Up @@ -143,6 +146,10 @@ bool wxcApp::OnInit()
ColoursAndFontsManager::Get().Load();
ColoursAndFontsManager::Get().RestoreDefaults();

// Open log file
FileLogger::OpenLog("wxcrafter.log", FileLogger::Dbg);
clDEBUG() << "wxCrafter started" << endl;

m_wxcPlugin = new wxCrafterPlugin(NULL, m_hiddenMainFrame);
SetTopWindow(m_wxcPlugin->GetMainFrame());
if(m_hiddenMainFrame) {
Expand Down
9 changes: 9 additions & 0 deletions wxcrafter/wxCrafter.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[Desktop Entry]
Name=wxCrafter
Exec=wxcrafter %f
Icon=wxcrafter
Terminal=false
Type=Application
Categories=Development;
StartupNotify=true
Keywords=development;programming;
Loading

0 comments on commit 04ec408

Please sign in to comment.