Skip to content

Commit

Permalink
Update CMake, Codelite, config files and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
rozhuk-im committed Mar 8, 2024
1 parent 1caf819 commit 5b7cc40
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 47 deletions.
79 changes: 46 additions & 33 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

############################# INITIAL SECTION ##########################
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10)

project(ssdpd C)

Expand All @@ -21,8 +21,6 @@ set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")

############################# OPTIONS SECTION ##########################

option(ENABLE_COVERAGE "Build with code coverage options [default: OFF]" OFF)
option(ENABLE_FULL_DEBUG "Build with all possible debug [default: OFF]" OFF)
option(INSTALL_PHP_MEDIA_SERVER "Install PHP UPnP/DLNA Media server [default: ON]" OFF)

# Now CMAKE_INSTALL_PREFIX is a base prefix for everything.
Expand Down Expand Up @@ -151,24 +149,54 @@ endif()
try_c_flag(PIPE "-pipe")
try_c_flag(NO_DEL_NULL_PTR_CHKS "-fno-delete-null-pointer-checks")

# Process with warn flags.
if (NOT CMAKE_C_OPT_FLAGS AND ENABLE_FULL_DEBUG)

if (CMAKE_BUILD_TYPE MATCHES "Debug")
# Process with warn flags.
try_c_flag(W "-W")
try_c_flag(WALL "-Wall")
try_c_flag(WPOINTER "-Wpointer-arith")
try_c_flag(WPARAM "-Wno-unused-parameter")
try_c_flag(WFUNCTION "-Wno-unused-function")
try_c_flag(WUNUSED_VAR "-Wno-unused-variable")
try_c_flag(WPOINTER_SIGN "-Wno-pointer-sign")
try_c_flag(WSIGN_COMPARE "-Wno-sign-compare")
try_c_flag(WSTRICT_PROTOTYPES "-Wstrict-prototypes")
try_c_flag(PEDANTIC "-pedantic")
try_c_flag(WNO_UNUSED_CONST "-Wno-unused-const-variable")
try_c_flag(WNULL_DEREFERENCE "-Wnull-dereference")
try_c_flag(WDUPLICATED_COND "-Wduplicated-cond")
try_c_flag(WIMPLICIT_FALLTHROUGH "-Wimplicit-fallthrough")
try_c_flag(WEVERYTHING "-Weverything")
if (NOT C_FLAG_WEVERYTHING)
try_c_flag(WPOINTER "-Wpointer-arith")
try_c_flag(WSTRICT_PROTOTYPES "-Wstrict-prototypes")
try_c_flag(PEDANTIC "-pedantic")
try_c_flag(WNULL_DEREFERENCE "-Wnull-dereference")
try_c_flag(WDUPLICATED_COND "-Wduplicated-cond")
try_c_flag(WIMPLICIT_FALLTHROUGH "-Wimplicit-fallthrough")
endif()

try_c_flag(WCAST_FN_TYPE_STRICT "-Wno-cast-function-type-strict")
try_c_flag(WCAST_QUAL "-Wno-cast-qual")
try_c_flag(WDOCUMENTATION "-Wno-documentation")
try_c_flag(WDOC_UNKNOWN_CMD "-Wno-documentation-unknown-command")
try_c_flag(WPADDED "-Wno-padded")
#try_c_flag(WPOINTER_SIGN "-Wno-pointer-sign")
#try_c_flag(WRESERVED_ID_MACRO "-Wno-reserved-id-macro")
try_c_flag(WRESERVED_IDENTIFIER "-Wno-reserved-identifier")
#try_c_flag(WSIGN_COMPARE "-Wno-sign-compare")
try_c_flag(WSWITCH_ENUM "-Wno-switch-enum")
#try_c_flag(WUNUSED_CONST "-Wno-unused-const-variable")
#try_c_flag(WUNUSED_FUNCTION "-Wno-unused-function")
#try_c_flag(WUNUSED_PARAM "-Wno-unused-parameter")
#try_c_flag(WUNUSED_VAR "-Wno-unused-variable")
try_c_flag(WUNSAFE_BUFFER_USAGE "-Wno-unsafe-buffer-usage")
#try_c_flag(WVARIADIC_MACROS "-Wno-variadic-macros")
#try_c_flag(WGNU_ZERO_VAR_MACRO_ARGS "-Wno-gnu-zero-variadic-macro-arguments")
try_c_flag(WZERO_LENGTH_ARRAY "-Wno-zero-length-array")

set(CMAKE_INSTALL_DO_STRIP FALSE)
set(CMAKE_C_OPT_FLAGS "-g3 -ggdb -O0")
message(STATUS "Adding -DDEBUG to definitions.")
add_definitions(-DDEBUG)
else()
set(CMAKE_INSTALL_DO_STRIP TRUE)
message(STATUS "Adding -DNDEBUG to definitions.")
add_definitions(-DNDEBUG)
endif()

message(STATUS "Building in ${CMAKE_BUILD_TYPE} mode.")
message(STATUS "CMAKE_INSTALL_DO_STRIP is ${CMAKE_INSTALL_DO_STRIP}.")


if (NOT "${CMAKE_C_COMPILER_ID}" MATCHES SunPro)
try_c_flag(STD11 "-std=c11")
if (NOT C_FLAG_STD11)
Expand Down Expand Up @@ -196,23 +224,8 @@ try_linker_flag(ZNOW "-Wl,-z,now")
try_linker_flag(ZNOEXECSTACK "-Wl,-z,noexecstack")


# Optimization flags
if (ENABLE_COVERAGE)
set(CMAKE_C_OPT_FLAGS "-g -O0 -fno-strict-aliasing")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
else()
if (NOT CMAKE_C_OPT_FLAGS)
if (ENABLE_FULL_DEBUG)
set(CMAKE_C_OPT_FLAGS "-g -O0 -fstrict-aliasing")
else()
set(CMAKE_C_OPT_FLAGS "-g -O2 -fstrict-aliasing")
endif()
endif()
endif()


set(CMAKE_C_FLAGS "${CMAKE_C_OPT_FLAGS} ${CMAKE_C_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_OPT_FLAGS}")
# Silently strip whitespace
string(STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS)
string(STRIP "${CMAKE_EXE_LINKER_FLAGS}" CMAKE_EXE_LINKER_FLAGS)
Expand Down
4 changes: 2 additions & 2 deletions nginx/nginx-upnp-full.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Rozhuk Ivan 2009.04 - 2017
### Rozhuk Ivan 2009.04-2024
### nginx configuration file
### PHP UPnP nginx HTTP server

Expand Down Expand Up @@ -63,7 +63,7 @@ http {

server_tokens on;

sendfile on;
sendfile off;
sendfile_max_chunk 64m;
aio off;
read_ahead 128m;
Expand Down
2 changes: 1 addition & 1 deletion php/upnp-server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ php_value[date.timezone] = "UTC"

php_value[pcre.backtrack_limit] = 100000
php_value[pcre.recursion_limit] = 100000
php_flag[pcre.jit] = on
php_flag[pcre.jit] = off

php_admin_value[session.save_handler] = files
php_admin_value[session.save_path] = "/tmp"
Expand Down
9 changes: 8 additions & 1 deletion README.md → readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/rozhuk-im/ssdpd/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/rozhuk-im/ssdpd/?branch=master)


Rozhuk Ivan <[email protected]> 2013 - 2021
Rozhuk Ivan <[email protected]> 2013-2024

SSDPd - Announces UPnP/DLNA device across network.
You can use PHP script, nginx config and static files to
Expand All @@ -18,6 +18,13 @@ BSD licence.
Website: http://www.netlab.linkpc.net/wiki/en:software:ssdpd:index


## Donate
Support the author
* **Buy Me A Coffee:** [!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/rojuc) <br/>
* **PayPal:** [![PayPal](https://srv-cdn.himpfen.io/badges/paypal/paypal-flat.svg)](https://paypal.me/rojuc) <br/>
* **Bitcoin (BTC):** `1AxYyMWek5vhoWWRTWKQpWUqKxyfLarCuz` <br/>


## Features
* can act as UPnP/DLNA ContentDirectory to share multimedia content
* can announce remote UPnP/DLNA devices
Expand Down
22 changes: 12 additions & 10 deletions ssdpd.project
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@
<Description/>
<Dependencies/>
<VirtualDirectory Name="root">
<File Name="readme.md"/>
<File Name="test.txt"/>
<File Name="ssdpd.conf"/>
<File Name="README.md"/>
<File Name="CMakeLists.txt"/>
<File Name="dist.sh"/>
<File Name="www/upnp/descr/root.xml"/>
Expand Down Expand Up @@ -139,10 +139,10 @@
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="clang system" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-g -DDEBUG" C_Options="-Wwrite-strings;-Wsign-compare;-Wpointer-arith;-Wnested-externs;-Wmissing-prototypes;-Wmissing-declarations;-Winline;-Wmain;-Wformat-security;-Wformat;-Weverything;-Wchar-subscripts;-Wcast-align;-fcolor-diagnostics;-fsanitize=safe-stack;-ftrapv;-g -DDEBUG;-D_FORTIFY_SOURCE=2;-fstack-protector-all;-fPIE;-pedantic;-W;-Wall;-Wno-gnu-zero-variadic-macro-arguments;-Wno-variadic-macros;-Wno-padded;-Wno-packed;-Wno-unused-macros;-Wno-format-nonliteral;-Wno-reserved-id-macro;-Wno-date-time" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"/>
<Compiler Options="-g -DDEBUG" C_Options="-ftrapv;-g -DDEBUG;-O0;-fwrapv;-fstack-protector-all;-Wall;-g3 -ggdb;-Wno-reserved-id-macro;-Wno-gnu-zero-variadic-macro-arguments;-Wno-variadic-macros;-Wno-documentation;-Wno-documentation-unknown-command;-Wno-padded;-Wno-cast-qual;-Wno-cast-function-type-strict;-Wno-reserved-identifier;-Wno-unsafe-buffer-usage" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"/>
<Linker Options="-fsanitize=safe-stack" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="$(ProjectPath)/build/src/" Command="$(OutputFile)" CommandArguments="-c /home/rim/docs/Progs/ssdpd/ssdpd.conf.debug" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<General OutputFile="$(IntermediateDirectory)/src/$(ProjectName)" IntermediateDirectory="$(ProjectPath)/$(ConfigurationName)" Command="$(OutputFile)" CommandArguments="-c /home/rim/docs/Progs/ssdpd/ssdpd.conf.debug" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
Expand Down Expand Up @@ -189,7 +189,7 @@ make</BuildCommand>
<Compiler Options="-DNDEBUG -DRELEASE" C_Options="-DNDEBUG -DRELEASE" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0"/>
<Linker Options="-O2" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="$(ProjectPath)/build/src/" Command="$(OutputFile)" CommandArguments="-v -c /home/rim/docs/Progs/ssdpd/ssdpd.conf" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<General OutputFile="$(IntermediateDirectory)/src/$(ProjectName)" IntermediateDirectory="$(ProjectPath)/$(ConfigurationName)" Command="$(OutputFile)" CommandArguments="-v -c /home/rim/docs/Progs/ssdpd/ssdpd.conf" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<BuildSystem Name="Default"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
Expand All @@ -202,17 +202,19 @@ make</BuildCommand>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<Target Name="Configure">mkdir $(ProjectPath)/$(ConfigurationName) &amp;&amp;
cd $(ProjectPath)/$(ConfigurationName) &amp;&amp;
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=true ..

</Target>
<RebuildCommand/>
<CleanCommand>rm -rf build</CleanCommand>
<BuildCommand>mkdir build &amp;&amp;
cd build &amp;&amp;
cmake -G Ninja -D CMAKE_VERBOSE_MAKEFILE=true .. &amp;&amp;
cmake --build . -- -j`getconf NPROCESSORS_ONLN`</BuildCommand>
<CleanCommand>rm -rf $(ProjectPath)/$(ConfigurationName)</CleanCommand>
<BuildCommand>make -C $(ProjectPath)/$(ConfigurationName) -j`getconf NPROCESSORS_ONLN`</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(ProjectPath)</WorkingDirectory>
<WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
Expand Down

0 comments on commit 5b7cc40

Please sign in to comment.