libssh2 now included. CMake build cleaned up.

This commit is contained in:
Scott Duensing 2022-12-20 18:13:47 -06:00
parent b2905df911
commit c218812ef7
5 changed files with 47 additions and 27 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@
crapForLater/
thirdparty/scintilla/
thirdparty/lexilla/
thirdparty/libssh2-1.10.0/
ui/generated/
cmake-build-debug/
flatpak-build/

View file

@ -21,6 +21,8 @@
cmake_minimum_required(VERSION 3.22)
include(FindPkgConfig)
project(joeydev LANGUAGES C VERSION 1.0)
# There are also version numbers in:
@ -60,40 +62,37 @@ add_custom_target(GENERATE_UI_HEADERS
BYPRODUCTS
${CMAKE_SOURCE_DIR}/thirdparty/scintilla/bin/scintilla.a
${CMAKE_SOURCE_DIR}/thirdparty/lexilla/bin/liblexilla.a
${CMAKE_SOURCE_DIR}/thirdparty/libssh2-1.10.0/src/libssh2.a
)
add_dependencies(${CMAKE_PROJECT_NAME} GENERATE_UI_HEADERS)
# Find dependencies.
# GTK+ 3.0 is a PITA. This will be fixed in CMake 3.25 when FindGTK3 finally shows up.
execute_process(COMMAND pkg-config --cflags gtk+-3.0
OUTPUT_VARIABLE OUT_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(STRIP ${OUT_TMP_VAR} GTK3_CFLAGS)
execute_process(COMMAND pkg-config --libs gtk+-3.0
OUTPUT_VARIABLE OUT_TMP_VAR
OUTPUT_STRIP_TRAILING_WHITESPACE
)
string(STRIP ${OUT_TMP_VAR} GTK3_LIBRARIES)
pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
# Compile Options.
include_directories(
${GTK3_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
include
ui/generated
thirdparty/libssh2-1.10.0/include
thirdparty/scintilla/include
thirdparty/lexilla/include
thirdparty/memwatch
)
add_definitions(
${GTK3_CFLAGS}
-Wall
-Wno-unknown-pragmas
-O2
${GTK3_CFLAGS}
)
target_link_directories(${CMAKE_PROJECT_NAME} PUBLIC
${GTK3_LIBRARY_DIRS}
)
@ -101,7 +100,14 @@ target_link_libraries(${CMAKE_PROJECT_NAME}
-rdynamic
${CMAKE_SOURCE_DIR}/thirdparty/scintilla/bin/scintilla.a
${CMAKE_SOURCE_DIR}/thirdparty/lexilla/bin/liblexilla.a
${CMAKE_SOURCE_DIR}/thirdparty/libssh2-1.10.0/src/libssh2.a
${GTK3_LIBRARIES}
# -lgpg-error
# -lssl
# -lcrypto
# -ldl
# -pthread
# -lz
-lm
-lstdc++
)

View file

@ -55,6 +55,10 @@ modules:
path: thirdparty/lexilla520.tgz
dest: thirdparty/
- type: file
path: thirdparty/libssh2-1.10.0.tar.gz
dest: thirdparty/
- type: file
path: CMakeLists.txt

BIN
thirdparty/libssh2-1.10.0.tar.gz vendored Normal file

Binary file not shown.

View file

@ -27,26 +27,35 @@ ROOT=$1
pushd "${ROOT}" || exit &> /dev/null
if [[ ! -f thirdparty/scintilla/bin/scintilla.a ]]; then
pushd thirdparty || exit &> /dev/null
if [[ ! -f scintilla/bin/scintilla.a ]]; then
echo Building Dependency: Scintilla...
tar xzf scintilla531.tgz
pushd scintilla/gtk || exit &> /dev/null
GTK3=1 make
popd || true &> /dev/null
popd || true &> /dev/null
fi
if [[ ! -f thirdparty/lexilla/bin/liblexilla.a ]]; then
pushd thirdparty || exit &> /dev/null
if [[ ! -f lexilla/bin/liblexilla.a ]]; then
echo Building Dependency: Lexilla...
tar xzf lexilla520.tgz
pushd lexilla/src || exit &> /dev/null
make
popd || true &> /dev/null
fi
if [[ ! -f libssh2-1.10.0/src/libssh2.a ]]; then
echo Building Dependency: libssh2...
tar xzf libssh2-1.10.0.tar.gz
pushd libssh2-1.10.0 || exit &> /dev/null
cmake -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DENABLE_ZLIB_COMPRESSION=ON -G Ninja -S . -B .
ninja
popd || true &> /dev/null
fi
popd || true &> /dev/null
echo Generating UI Embedded Code...
mkdir -p ui/generated
glib-compile-resources \