Skip to content
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

391 Isolate cmake files of example #392

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ message(STATUS "----------------------> AREG project CMake Status Report Begin <
message(STATUS "=======================================================================================")
message(STATUS "AREG: >>> CMAKE_SOURCE_DIR = \'${CMAKE_SOURCE_DIR}\', build type \'${CMAKE_BUILD_TYPE}\'")
message(STATUS "AREG: >>> Build ...........: \'${CMAKE_SYSTEM_NAME}\' system, \'${AREG_BITNESS}\'-bit platform, \'${AREG_PROCESSOR}\' CPU")
message(STATUS "AREG: >>> Compiler ........: \'${CMAKE_CXX_COMPILER}\', ID \'${AREG_COMPILER_FAMILY}\', C++${CMAKE_CXX_STANDARD}")
message(STATUS "AREG: >>> Compiler ........: \'${CMAKE_CXX_COMPILER}\'")
message(STATUS "AREG: >>> Compiler Version : C++ standard \'c++${CMAKE_CXX_STANDARD}\', compiler family \'${AREG_COMPILER_FAMILY}\'")
message(STATUS "AREG: >>> Binary output ...: \'${CMAKE_RUNTIME_OUTPUT_DIRECTORY}\', extension '${CMAKE_EXECUTABLE_SUFFIX}'")
message(STATUS "AREG: >>> Generated files .: \'${AREG_GENERATE_DIR}\' directory")
message(STATUS "AREG: >>> Packages ........: \'${FETCHCONTENT_BASE_DIR}\' directory")
Expand Down
2 changes: 1 addition & 1 deletion areg-sdk.sln
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "logobserver", "framework\lo
{FBC5BEAE-01B9-4943-A5CB-0D3DE2067EB3} = {FBC5BEAE-01B9-4943-A5CB-0D3DE2067EB3}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "thirdparty\sqlite3.vcxproj", "{A19D14E3-19FE-46FE-91CA-0BAD1CDB91C5}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aregsqlite3", "thirdparty\sqlite3.vcxproj", "{A19D14E3-19FE-46FE-91CA-0BAD1CDB91C5}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "thirdparty", "thirdparty", "{BB98F00E-A26C-48A8-AE2A-CEECB9E3FFB1}"
ProjectSection(SolutionItems) = preProject
Expand Down
2 changes: 1 addition & 1 deletion conf/cmake/clang.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2022-2023 Aregtech
# ###########################################################################

message(STATUS "AREG: >>> Preparing compiler settings for `clang` with '${AREG_OS}' API")
message(STATUS "AREG: >>> Preparing settings for CLang compiler and with '${AREG_OS}' API")

if (AREG_OS STREQUAL "Windows")

Expand Down
824 changes: 283 additions & 541 deletions conf/cmake/functions.cmake

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion conf/cmake/gnu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
# Copyright 2022-2023 Aregtech
# ###########################################################################

message(STATUS "AREG: >>> Preparing compiler settings for `GNU` and POSIX API, Cygwin = '${CYGWIN}'")
message(STATUS "AREG: >>> Preparing settings for GNU compiler and POSIX API, Cygwin = '${CYGWIN}'")

if (CYGWIN)
set(AREG_COMPILER_FAMILY "cygwin")
else()
set(AREG_COMPILER_FAMILY "gnu")
endif()

# POSIX API
add_definitions(-DPOSIX)
Expand Down
8 changes: 4 additions & 4 deletions conf/cmake/install.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ install(FILES
# configure and copy servicing script files.
if ((WIN32) OR (CYGWIN))

configure_file("${AREG_EXPORTS_DIR}/logger.service.install.bat.in" "exports/logger.service.install.bat" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logger.service.uninstall.bat.in" "exports/logger.service.uninstall.bat" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.install.bat.in" "exports/mcrouter.service.install.bat" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.uninstall.bat.in" "exports/mcrouter.service.uninstall.bat" @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logger.service.install.bat.in" exports/logger.service.install.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/logger.service.uninstall.bat.in" exports/logger.service.uninstall.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.install.bat.in" exports/mcrouter.service.install.bat @ONLY)
configure_file("${AREG_EXPORTS_DIR}/mcrouter.service.uninstall.bat.in" exports/mcrouter.service.uninstall.bat @ONLY)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/exports/logger.service.install.bat"
"${CMAKE_CURRENT_BINARY_DIR}/exports/logger.service.uninstall.bat"
Expand Down
2 changes: 1 addition & 1 deletion conf/cmake/msvc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2022-2023 Aregtech
# ###########################################################################

message(STATUS "AREG: >>> Preparing compiler settings for `MSVC` and Win32 API")
message(STATUS "AREG: >>> Preparing settings for MSVC compiler and with Win32 API")

# Visual Studio C++, Windows / Win32 API
set(AREG_DEVELOP_ENV "Win32")
Expand Down
77 changes: 27 additions & 50 deletions conf/cmake/user.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,17 @@ set(AREG_CXX_COMPILER)
# C compiler, possible values: gcc, clang, clang-cl, cl
set(AREG_C_COMPILER)

# Check the compiler option.
# Check and set the simple and shortest way to set the compiler
# Check the compiler option and set compiler family and specific compiler commands accordingly.
if(DEFINED AREG_COMPILER_FAMILY AND NOT ${AREG_COMPILER_FAMILY} STREQUAL "")

message(STATUS "AREG: >>> User selected C/C++ compiler family \'${AREG_COMPILER_FAMILY}\'")
if(${AREG_COMPILER_FAMILY} STREQUAL "gnu")
set(AREG_CXX_COMPILER "g++")
set(AREG_C_COMPILER "gcc")
elseif(${AREG_COMPILER_FAMILY} STREQUAL "cygwin")

# Map the AREG_COMPILER_FAMILY to the respective compiler commands
if(${AREG_COMPILER_FAMILY} MATCHES "gnu|cygwin")
set(AREG_CXX_COMPILER "g++")
set(AREG_C_COMPILER "gcc")
set(AREG_COMPILER_FAMILY "gnu") # Normalize family to "gnu" for consistency
elseif(${AREG_COMPILER_FAMILY} STREQUAL "llvm")
if (WIN32)
if(WIN32)
set(AREG_CXX_COMPILER "clang-cl")
set(AREG_C_COMPILER "clang-cl")
else()
Expand All @@ -100,65 +98,44 @@ if(DEFINED AREG_COMPILER_FAMILY AND NOT ${AREG_COMPILER_FAMILY} STREQUAL "")
set(AREG_CXX_COMPILER "cl")
set(AREG_C_COMPILER "cl")
else()
message(WARNING "AREG: >>> Unrecognized compiler family ${AREG_COMPILER_FAMILY}, supported values: \'gnu\', \'llvm\', \'cygwin\', \'msvc\'")
message(WARNING "AREG: >>> Unrecognized compiler family \'${AREG_COMPILER_FAMILY}\', supported values: \'gnu\', \'llvm\', \'cygwin\', \'msvc\'")
endif()

elseif(DEFINED AREG_COMPILER AND NOT ${AREG_COMPILER} STREQUAL "")
message(STATUS "AREG: >>> User selected C/C++ compiler \'${AREG_COMPILER}\'")

set(AREG_CXX_COMPILER "${AREG_COMPILER}")
set(AREG_C_COMPILER "${AREG_COMPILER}")

if (${AREG_COMPILER} STREQUAL "g++" OR ${AREG_COMPILER} STREQUAL "gcc")
# GNU compiler

# Make sure that C-compiler is properly set
if (${AREG_COMPILER} STREQUAL "g++")
set(AREG_C_COMPILER "gcc")
endif()

if (CYGWIN)
set(AREG_COMPILER_FAMILY "cygwin")
else()
set(AREG_COMPILER_FAMILY "gnu")
endif()
# Set both C and C++ compilers based on AREG_COMPILER
set(AREG_CXX_COMPILER "${AREG_COMPILER}")
set(AREG_C_COMPILER "${AREG_COMPILER}")

elseif (${AREG_COMPILER} STREQUAL "c++" OR ${AREG_COMPILER} STREQUAL "cc")
# GNU compiler

# Make sure that C-compiler is properly set
if (${AREG_COMPILER} STREQUAL "c++")
set(AREG_C_COMPILER "cc")
# Handle specific compiler identification
if(${AREG_COMPILER} MATCHES "g\\+\\+|gcc|c\\+\\+|cc")
if(${AREG_COMPILER} MATCHES "g\\+\\+|c\\+\\+")
set(AREG_C_COMPILER "gcc") # Ensure C-compiler is gcc if C++ compiler is used
endif()

# Detect Cygwin or GNU
if (CYGWIN)
set(AREG_COMPILER_FAMILY "cygwin")
set(AREG_COMPILER_FAMILY "cygwin")
else()
set(AREG_COMPILER_FAMILY "gnu")
endif()

elseif (${AREG_COMPILER} STREQUAL "clang-cl" OR ${AREG_COMPILER} STREQUAL "clang++" OR ${AREG_COMPILER} STREQUAL "clang")
# Clang compiler

# Make sure that C-compiler is properly set
if (${AREG_COMPILER} STREQUAL "clang-cl")
set(AREG_C_COMPILER "clang-cl")
elseif (${AREG_COMPILER} STREQUAL "clang++")
set(AREG_C_COMPILER "clang")
elseif(${AREG_COMPILER} MATCHES "clang-cl|clang\\+\\+|clang")
if(${AREG_COMPILER} STREQUAL "clang-cl")
set(AREG_C_COMPILER "clang-cl")
elseif(${AREG_COMPILER} STREQUAL "clang++")
set(AREG_C_COMPILER "clang")
endif()

set(AREG_COMPILER_FAMILY "llvm")

elseif (${AREG_COMPILER} STREQUAL "cl")
set(AREG_COMPILER_FAMILY "msvc")
set(AREG_COMPILER_FAMILY "llvm")
elseif(${AREG_COMPILER} STREQUAL "cl")
set(AREG_COMPILER_FAMILY "msvc")
else()
set(AREG_COMPILER_FAMILY)
message(WARNING "AREG: >>> Unrecognized compiler ${AREG_COMPILER}, supported compilers: \'gcc\', \'g++\', 'cc', \'c++\',\'clang\', \'clang++\', \'clang-cl\', \'cl\'")
message(WARNING "AREG: >>> Unrecognized compiler \'${AREG_COMPILER}\', supported compilers: \'gcc\', \'g++\', \'cc\', \'c++\', \'clang\', \'clang++\', \'clang-cl\', \'cl\'")
endif()

else()

message(STATUS "AREG: >>> No compiler is selected, will use system default")

message(STATUS "AREG: >>> No compiler is selected, using system default.")
endif()

# Set build configuration. Set "Debug" for debug build, and "Release" for release build.
Expand Down
6 changes: 1 addition & 5 deletions examples/00_helloservice/00_clientproc.vcxproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" Condition="'$(AregSdkRoot)'==''">
<Import Project="$(SolutionDir)\msvc_setup.props"/>
<Import Project="$(SolutionDir)\msvc_setup.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(AregSdkRoot)\conf\msvc\compile.props" Label="LocalAppCompileSettings" />
Expand Down Expand Up @@ -29,10 +29,6 @@
<ClInclude Include="common\src\ClientComponent.hpp" />
<ClInclude Include="common\src\ServiceComponent.hpp" />
</ItemGroup>
<ItemGroup>
<Text Include="multiprocess\clientproc\CMakeLists.txt" />
<Text Include="multiprocess\clientproc\src\CMakeLists.txt" />
</ItemGroup>
<ItemDefinitionGroup Condition="'$(ConfigShortName)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
4 changes: 0 additions & 4 deletions examples/00_helloservice/00_clientproc.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="multiprocess\clientproc\CMakeLists.txt" />
<Text Include="multiprocess\clientproc\src\CMakeLists.txt" />
</ItemGroup>
</Project>
4 changes: 0 additions & 4 deletions examples/00_helloservice/00_onethread.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
<ClInclude Include="common\src\ClientComponent.hpp" />
<ClInclude Include="common\src\ServiceComponent.hpp" />
</ItemGroup>
<ItemGroup>
<Text Include="onethread\CMakeLists.txt" />
<Text Include="onethread\src\CMakeLists.txt" />
</ItemGroup>
<ItemDefinitionGroup Condition="'$(ConfigShortName)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
4 changes: 0 additions & 4 deletions examples/00_helloservice/00_onethread.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="onethread\CMakeLists.txt" />
<Text Include="onethread\src\CMakeLists.txt" />
</ItemGroup>
</Project>
12 changes: 4 additions & 8 deletions examples/00_helloservice/00_serviceproc.vcxproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" Condition="'$(AregSdkRoot)'==''">
<Import Project="$(SolutionDir)\msvc_setup.props"/>
</ImportGroup>
<ImportGroup Label="PropertySheets">
<ImportGroup Label="PropertySheets" Condition="'$(AregSdkRoot)'==''">
<Import Project="$(SolutionDir)\msvc_setup.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(AregSdkRoot)\conf\msvc\compile.props" Label="LocalAppCompileSettings" />
</ImportGroup>
<PropertyGroup Label="Globals">
Expand All @@ -29,10 +29,6 @@
<ClInclude Include="common\src\ClientComponent.hpp" />
<ClInclude Include="common\src\ServiceComponent.hpp" />
</ItemGroup>
<ItemGroup>
<Text Include="multiprocess\serviceproc\CMakeLists.txt" />
<Text Include="multiprocess\serviceproc\src\CMakeLists.txt" />
</ItemGroup>
<ItemDefinitionGroup Condition="'$(ConfigShortName)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
4 changes: 0 additions & 4 deletions examples/00_helloservice/00_serviceproc.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="multiprocess\serviceproc\CMakeLists.txt" />
<Text Include="multiprocess\serviceproc\src\CMakeLists.txt" />
</ItemGroup>
</Project>
12 changes: 4 additions & 8 deletions examples/00_helloservice/00_twothreads.vcxproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" Condition="'$(AregSdkRoot)'==''">
<Import Project="$(SolutionDir)\msvc_setup.props"/>
</ImportGroup>
<ImportGroup Label="PropertySheets">
<ImportGroup Label="PropertySheets" Condition="'$(AregSdkRoot)'==''">
<Import Project="$(SolutionDir)\msvc_setup.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(AregSdkRoot)\conf\msvc\compile.props" Label="LocalAppCompileSettings" />
</ImportGroup>
<PropertyGroup Label="Globals">
Expand All @@ -29,10 +29,6 @@
<ClInclude Include="common\src\ClientComponent.hpp" />
<ClInclude Include="common\src\ServiceComponent.hpp" />
</ItemGroup>
<ItemGroup>
<Text Include="twothreads\CMakeLists.txt" />
<Text Include="twothreads\src\CMakeLists.txt" />
</ItemGroup>
<ItemDefinitionGroup Condition="'$(ConfigShortName)'=='Debug'">
<ClCompile>
<PreprocessorDefinitions>IMPORT_SHARED_SYMBOLS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down
4 changes: 0 additions & 4 deletions examples/00_helloservice/00_twothreads.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,4 @@
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Text Include="twothreads\CMakeLists.txt" />
<Text Include="twothreads\src\CMakeLists.txt" />
</ItemGroup>
</Project>
33 changes: 23 additions & 10 deletions examples/00_helloservice/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,26 @@
addServiceInterface(00_generated res HelloService)

# add projects
macro_declare_project_ex(00_pubclient "clientproc" "multiprocess/clientproc")
macro_declare_project_ex(00_pubservice "serviceproc" "multiprocess/serviceproc")
macro_declare_project_ex(00_onethread "onethread" "onethread")
macro_declare_project_ex(00_twothreads "twothreads" "twothreads")

# add executables
addExecutableEx(${project_clientproc} "" "${clientproc_src}" 00_generated)
addExecutableEx(${project_serviceproc} "" "${serviceproc_src}" 00_generated)
addExecutableEx(${project_onethread} "" "${onethread_src}" 00_generated)
addExecutableEx(${project_twothreads} "" "${twothreads_src}" 00_generated)
macro_example_declare_runnable(00_pubclient 00_generated
common/src/ClientComponent.cpp
common/src/ServiceComponent.cpp
multiprocess/clientproc/src/main.cpp
)

macro_example_declare_runnable(00_pubservice 00_generated
common/src/ClientComponent.cpp
common/src/ServiceComponent.cpp
multiprocess/serviceproc/src/main.cpp
)

macro_example_declare_runnable(00_onethread 00_generated
common/src/ClientComponent.cpp
common/src/ServiceComponent.cpp
onethread/src/main.cpp
)

macro_example_declare_runnable(00_twothreads 00_generated
common/src/ClientComponent.cpp
common/src/ServiceComponent.cpp
twothreads/src/main.cpp
)

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion examples/00_helloservice/onethread/CMakeLists.txt

This file was deleted.

5 changes: 0 additions & 5 deletions examples/00_helloservice/onethread/src/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion examples/00_helloservice/twothreads/CMakeLists.txt

This file was deleted.

5 changes: 0 additions & 5 deletions examples/00_helloservice/twothreads/src/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion examples/01_hello/01_hello.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
<Text Include="src\CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.md" />
Expand Down
1 change: 0 additions & 1 deletion examples/01_hello/01_hello.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
<Text Include="src\CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<None Include="ReadMe.md" />
Expand Down
3 changes: 1 addition & 2 deletions examples/01_hello/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
macro_declare_project_ex(01_hello hello "src")
addExecutable(${project_hello} "${hello_src}")
macro_example_declare_runnable(01_hello src/main.cpp)
3 changes: 0 additions & 3 deletions examples/01_hello/src/CMakeLists.txt

This file was deleted.

Loading
Loading