Skip to content

Commit

Permalink
[WIP] Test static build
Browse files Browse the repository at this point in the history
  • Loading branch information
drdanz committed Dec 10, 2024
1 parent 650665b commit 6cb74d4
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build-external-graphviz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- master
- drdanz/test_static_libs
pull_request:
branches:
- master
Expand All @@ -23,6 +24,9 @@ jobs:
- macos-latest
build_type:
- Debug
lib_type:
- Shared
- Static
config:
- qt_version: 6.6.2
qt_modules: qtscxml
Expand Down Expand Up @@ -68,6 +72,7 @@ jobs:
-DBUILD_TESTS=${{ matrix.build_type == 'Debug' }}
-DBUILD_EXAMPLES=ON
-DBUILD_DOCS=${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }}
-DBUILD_STATIC=${{ matrix.lib_type == 'Static' }}
-DWITH_INTERNAL_GRAPHVIZ=OFF
- name: Build Project
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- master
- drdanz/test_static_libs
pull_request:
branches:
- master
Expand All @@ -25,6 +26,9 @@ jobs:
build_type:
- Debug
- Release
lib_type:
- Shared
- Static
config:
- qt_version: 5.15.2
qt_arch: win64_msvc2019_64
Expand Down Expand Up @@ -91,6 +95,7 @@ jobs:
-DBUILD_TESTS=${{ matrix.build_type == 'Debug' }}
-DBUILD_EXAMPLES=ON
-DBUILD_DOCS=${{ matrix.build_type == 'Debug' && runner.os == 'Linux' }}
-DBUILD_STATIC=${{ matrix.lib_type == 'Static' }}
- name: Build Project
run: cmake --build ./build
Expand Down
8 changes: 8 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
# Note: disabling tests also disables building the kdstatemachineeditor test application.
# Default=True
#
# -DBUILD_SHARED=[true|false] # FIXME docs

cmake_minimum_required(VERSION 3.16)

Expand Down Expand Up @@ -76,6 +77,13 @@ else()
option(BUILD_TESTS "Build the test harness" ON)
endif()
option(BUILD_QT6 "Build against Qt 6" OFF)
option(BUILD__STATIC "Build statically" OFF)

if(BUILD_STATIC)
set(BUILD_LIBRARY_MODE "STATIC")
else()
set(BUILD_LIBRARY_MODE "SHARED")
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/ECM/modules")
Expand Down
2 changes: 1 addition & 1 deletion src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ if(GRAPHVIZ_FOUND)
endif()
endif()

add_library(kdstatemachineeditor_core SHARED ${LIB_SRCS})
add_library(kdstatemachineeditor_core ${BUILD_LIBRARY_MODE} ${LIB_SRCS})
add_library(KDSME::Core ALIAS kdstatemachineeditor_core)
target_link_libraries(
kdstatemachineeditor_core
Expand Down
2 changes: 1 addition & 1 deletion src/debuginterface/debuginterfaceclient/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if(NOT BUILD_QT6)
qt5_generate_repc(DEBUGINTERFACECLIENT_SRCS ../debuginterface.rep REPLICA)
endif()

add_library(kdstatemachineeditor_debuginterfaceclient SHARED ${DEBUGINTERFACECLIENT_SRCS})
add_library(kdstatemachineeditor_debuginterfaceclient ${BUILD_LIBRARY_MODE} ${DEBUGINTERFACECLIENT_SRCS})

if(BUILD_QT6)
qt6_add_repc_replicas(kdstatemachineeditor_debuginterfaceclient ../debuginterface.rep)
Expand Down
2 changes: 1 addition & 1 deletion src/view/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
file(GLOB_RECURSE QML_JS_FILES *.qml *.js)

add_library(
kdstatemachineeditor_view SHARED
kdstatemachineeditor_view ${BUILD_LIBRARY_MODE}
command/command.cpp
command/commandfactory.cpp
command/createelementcommand.cpp
Expand Down

0 comments on commit 6cb74d4

Please sign in to comment.