-
Notifications
You must be signed in to change notification settings - Fork 11
Updates to generate windows library #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
c9896e5
0cac485
9754ab2
f123eed
443b63f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # GitHub Actions for genCMPClient | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # Copyright (c) Siemens AG, 2021-2025 | ||
|
|
||
| name: Windows | ||
|
|
||
| on: push | ||
| jobs: | ||
| cmake: | ||
| runs-on: windows-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: cmake | ||
| run: | | ||
| mkdir build | ||
| cd build | ||
| $env:GENCMP_NO_SECUTILS=1; cmake .. | ||
| cmake --build . --config Release | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any simple way of checking that the built library is actually usable? |
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,16 @@ if(NOT DEFINED GENCMPCLIENT_VERSION) | |||||
| endif() | ||||||
| message(STATUS "generic CMP client version " ${GENCMPCLIENT_VERSION}) | ||||||
|
|
||||||
| # Option to build shared or static library (default: SHARED) | ||||||
| option(BUILD_STATIC_LIBS "Build static libraries instead of shared" OFF) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this new option affects only libgencmp, it should better not be called ... |
||||||
| if(BUILD_STATIC_LIBS) | ||||||
| set(GENCMP_LIB_TYPE STATIC) | ||||||
| message(STATUS "Building STATIC library") | ||||||
| else() | ||||||
| set(GENCMP_LIB_TYPE SHARED) | ||||||
| message(STATUS "Building SHARED library") | ||||||
| endif() | ||||||
|
|
||||||
| # set(CMAKE_VERBOSE_MAKEFILE ON) | ||||||
| # set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # needed for sonarCloud scanner when using CMake | ||||||
|
|
||||||
|
|
@@ -133,15 +143,36 @@ if(NOT TARGET OpenSSL::Crypto) # not already done by superordinate module | |||||
| endif() | ||||||
| endif() | ||||||
| message(STATUS "using OpenSSL library ${OPENSSL_CRYPTO_LIBRARY}, ${OPENSSL_SSL_LIBRARY}") | ||||||
| if(NOT EXISTS "${OPENSSL_CRYPTO_LIBRARY}") | ||||||
| message(FATAL_ERROR "OpenSSL crypto library file does not exist: ${OPENSSL_CRYPTO_LIBRARY}") | ||||||
| # Handle cases where OPENSSL_CRYPTO_LIBRARY contains both debug and optimized versions | ||||||
| if(OPENSSL_CRYPTO_LIBRARY MATCHES "optimized|debug") | ||||||
| # Extract the actual library paths from the optimized/debug list | ||||||
| string(REGEX REPLACE ".*optimized;([^;]+).*" "\\1" OPENSSL_CRYPTO_LIB_RELEASE "${OPENSSL_CRYPTO_LIBRARY}") | ||||||
| string(REGEX REPLACE ".*debug;([^;]+).*" "\\1" OPENSSL_CRYPTO_LIB_DEBUG "${OPENSSL_CRYPTO_LIBRARY}") | ||||||
|
|
||||||
| # Check if at least one version exists | ||||||
| set(CRYPTO_LIB_EXISTS FALSE) | ||||||
| if(DEFINED OPENSSL_CRYPTO_LIB_RELEASE AND EXISTS "${OPENSSL_CRYPTO_LIB_RELEASE}") | ||||||
| set(CRYPTO_LIB_EXISTS TRUE) | ||||||
| endif() | ||||||
| if(DEFINED OPENSSL_CRYPTO_LIB_DEBUG AND EXISTS "${OPENSSL_CRYPTO_LIB_DEBUG}") | ||||||
| set(CRYPTO_LIB_EXISTS TRUE) | ||||||
| endif() | ||||||
|
|
||||||
| if(NOT CRYPTO_LIB_EXISTS) | ||||||
| message(FATAL_ERROR "Neither OpenSSL crypto library exists: ${OPENSSL_CRYPTO_LIBRARY}") | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| endif() | ||||||
| else() | ||||||
| # Single library path case | ||||||
| if(NOT EXISTS "${OPENSSL_CRYPTO_LIBRARY}") | ||||||
| message(FATAL_ERROR "OpenSSL crypto library file does not exist: ${OPENSSL_CRYPTO_LIBRARY}") | ||||||
| endif() | ||||||
| endif() | ||||||
|
|
||||||
| # workaround for using local OpenSSL builds by default expecting that | ||||||
| # its dynamic libs have been installed in ./${LIB} when using the libs | ||||||
| # see for binaries dynamically linked to OpenSSL the output of ${LDD} <binary> | ||||||
| if(CMAKE_SYSTEM_NAME MATCHES "Windows") | ||||||
| set(USERS "^(\w:)?\\Users\\") | ||||||
| set(USERS "^([a-zA-Z]:)?\\\\Users\\\\") | ||||||
| set(LIB "bin") | ||||||
| else() | ||||||
| set(USERS "^/(home|Users)/") | ||||||
|
|
@@ -208,13 +239,22 @@ endif() | |||||
|
|
||||||
| add_compile_definitions(DEBUG_UNUSED) | ||||||
| add_compile_definitions(PEDANTIC) | ||||||
| add_compile_options(-pedantic) # -Werror is enabled only for development and CI, using Makefile_v1 without NDEBUG | ||||||
| add_compile_options( | ||||||
| -Wall -Woverflow -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wswitch | ||||||
| -Wsign-compare -Wformat -Wtype-limits -Wundef -Wconversion -Wunused-parameter) | ||||||
| add_compile_options(-Wno-c99-extensions -Wno-language-extension-token -Wno-declaration-after-statement -Wno-expansion-to-defined) | ||||||
| if(NOT DEFINED GENCMP_NO_SECUTILS) | ||||||
| add_compile_options(-Wno-sign-conversion -Wno-shorten-64-to-32 -Wno-shadow) | ||||||
|
|
||||||
| if(MSVC) | ||||||
| # MSVC compiler flags | ||||||
| add_compile_options(/W4) # High warning level | ||||||
| add_compile_definitions(_CRT_SECURE_NO_WARNINGS) | ||||||
| if(NOT DEFINED GENCMP_NO_SECUTILS) | ||||||
| message(FATAL_ERROR "Windows build is not (yet) supported for libSecUtils") | ||||||
| endif() | ||||||
|
Comment on lines
+247
to
+249
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please also mention in README.md that when using CMake, |
||||||
| else() | ||||||
| # GCC/Clang compiler flags | ||||||
| add_compile_options(-pedantic) # -Werror is enabled only for development and CI, using Makefile_v1 without NDEBUG | ||||||
| add_compile_options( | ||||||
| -Wall -Woverflow -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wswitch | ||||||
| -Wsign-compare -Wformat -Wtype-limits -Wundef -Wconversion -Wunused-parameter) | ||||||
| add_compile_options(-Wno-c99-extensions -Wno-language-extension-token -Wno-declaration-after-statement -Wno-expansion-to-defined) | ||||||
|
|
||||||
| endif() | ||||||
| # TODO maybe clean up code and re-enable property | ||||||
| # set_property(TARGET ${LIBGENCMP_NAME} PROPERTY C_STANDARD 90) | ||||||
|
|
@@ -223,7 +263,7 @@ endif() | |||||
| # target_compile_features(${LIBGENCMP_NAME} PRIVATE c_std_90) | ||||||
| # target_compile_features(cmpClient PRIVATE c_std_90) | ||||||
|
|
||||||
| add_library(${LIBGENCMP_NAME} SHARED | ||||||
| add_library(${LIBGENCMP_NAME} ${GENCMP_LIB_TYPE} | ||||||
| "${PROJECT_SOURCE_DIR}/.github/workflows/build.yml" | ||||||
| ${SRC_DIR}/genericCMPClient.c | ||||||
| ) | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far, this tests only building in Release mode a dynamic library.
I suggest adding here one more build using the new static option and the Debug mode (for covering also the Debug mode at the same time; I do not see the need for testing all possible four combinations).