diff --git a/.clang-format b/.clang-format new file mode 120000 index 0000000..a935b83 --- /dev/null +++ b/.clang-format @@ -0,0 +1 @@ +ACE/.clang-format \ No newline at end of file diff --git a/.env_add.sh b/.env_add.sh new file mode 100644 index 0000000..ede5f87 --- /dev/null +++ b/.env_add.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +export X11_BASE_ROOT=$PWD +export TAOX11_ROOT=$X11_BASE_ROOT/taox11 +export ACE_ROOT=$X11_BASE_ROOT/ACE/ACE +export TAO_ROOT=$X11_BASE_ROOT/ACE/TAO + +export MPC_BASE=$TAOX11_ROOT/bin/MPC +export MPC_ROOT=$X11_BASE_ROOT/ACE/MPC + +export LD_LIBRARY_PATH=$X11_BASE_ROOT/lib:$ACE_ROOT/lib:/usr/lib: +export PATH=$X11_BASE_ROOT/bin:$TAOX11_ROOT/bin:$ACE_ROOT/bin:$HOME/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +export RIDL_BE_PATH=:$TAOX11_ROOT/ +export RIDL_BE_SELECT=c++11 +export RIDL_ROOT=$X11_BASE_ROOT/ridl/lib + +export BZIP2_ROOT=/usr +export SSL_ROOT=/usr +export ZLIB_ROOT=/usr + diff --git a/.gitignore b/.gitignore index 92885f7..1b4064f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ build .* *~ -ACE +ACE/ +ACE_TAO/ *C.h *C.inl *C.cpp @@ -20,6 +21,7 @@ GNUmakefile* *.pdb *.Build.CppClean.log *.dll +*.dylib *.lib *.iobj *.ipdb @@ -28,8 +30,16 @@ GNUmakefile* *.exe *.kdev4 *.so* +*.log commit.txt taox11/html taox11/latex +taox11/ *.gcno -workspace.mwc* \ No newline at end of file +workspace.mwc* +ciaox11/ +dancex11/ +ridl/ +taox11/ +stage/ +/lib/* diff --git a/ACE_Auto_Ptr.patch b/ACE_Auto_Ptr.patch new file mode 100644 index 0000000..0001f59 --- /dev/null +++ b/ACE_Auto_Ptr.patch @@ -0,0 +1,13 @@ +diff --git a/ACE/ace/Auto_Ptr.h b/ACE/ace/Auto_Ptr.h +index 01236ce8198..f4b71dabad9 100644 +--- a/ACE/ace/Auto_Ptr.h ++++ b/ACE/ace/Auto_Ptr.h +@@ -70,7 +70,7 @@ ACE_END_VERSIONED_NAMESPACE_DECL + + #if !defined (ACE_LACKS_AUTO_PTR) + #include +-using std::auto_ptr; ++//XXX using std::auto_ptr; + #else /* !ACE_LACKS_AUTO_PTR */ + + ACE_BEGIN_VERSIONED_NAMESPACE_DECL diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9b01217 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,207 @@ +cmake_minimum_required(VERSION 3.16...3.23) +# +# see https://cmake.org/cmake/help/latest/index.html for introduction +# +# cmake -B ../build -G Ninja -S . +# DESTDIR=../stage cmake --install ../build --prefix / +# +option(CMAKE_EXPORT_COMPILE_COMMANDS "for clang-tidy" ON) + +project( + itaox11 + VERSION 2.2.0 + LANGUAGES CXX +) + +# ================================ +# add dependencies +# ================================ +include(cmake/GlobalSettings.cmake) + +include(GenerateTaoIdl) +include(GNUInstallDirs) + +add_library(itaox11 INTERFACE) + +# FIXME: not useable! see $HOME/Workspace/cpp/axcioma/stage/include +set(TAOX11_INCLUDE_DIRS $ENV{TAOX11_ROOT} $ENV{TAOX11_ROOT}/orbsvcs # + $ENV{ACE_ROOT} $ENV{TAO_ROOT} $ENV{TAO_ROOT}/orbsvcs +) +foreach(dir_ ${TAOX11_INCLUDE_DIRS}) + cmake_path(GET dir_ FILENAME filename) + if("${filename}" STREQUAL "taox11") + message(STATUS "install dir ${dir_}/tao/x11") + install( + DIRECTORY ${dir_}/tao/x11 # Note: without trailing / + DESTINATION include/tao + FILES_MATCHING + PATTERN "*.h" + PATTERN "*.cpp" # Note: we need tao/x11/logger/logstream_t.cpp + ) + elseif("${filename}" STREQUAL "orbsvcs") + message(STATUS "install dir ${dir_}/orbsvcs") + install( + DIRECTORY ${dir_}/orbsvcs # Note: without trailing / + DESTINATION include # or TYPE INCLUDE + FILES_MATCHING + PATTERN "*.h" + ) + else() + set(INCLUDE_DIR $) + message(STATUS "install dir ${dir_}/${INCLUDE_DIR}/") + install( + DIRECTORY ${dir_}/${INCLUDE_DIR} # Note: without trailing / + DESTINATION include # or TYPE INCLUDE + FILES_MATCHING + PATTERN "*.shobj" EXCLUDE + # FIXME: FILES_MATCHING REGEX ".*/\.shobj$" EXCLUDE + PATTERN "*.h" + PATTERN "*.inl" + PATTERN "*.pidl" + PATTERN "*.cpp" + ) + endif() +endforeach() +list(TRANSFORM TAOX11_INCLUDE_DIRS PREPEND "$") +message(TRACE "${TAOX11_INCLUDE_DIRS}") + +# original header: target_include_directories(itaox11 SYSTEM INTERFACE ${TAOX11_INCLUDE_DIRS}) +target_include_directories( + itaox11 SYSTEM INTERFACE ${TAOX11_INCLUDE_DIRS} $ +) + +# the installed stage/usr/include subdirs: +# include/ace +# include/tao/x11 +# include/orbsvcs +# include/MgmtLocalAPI + +# see $HOME/Workspace/cpp/axcioma/stage/lib +set(TAOX11_LIBRARIES + taox11_portable_server + taox11_cosnaming_stub + taox11_anytypecode + TAO_PortableServer + TAO_AnyTypeCode + taox11 + TAO + x11_logger + ACE +) +target_link_libraries(itaox11 INTERFACE ${TAOX11_LIBRARIES}) +# TODO: Prevent use of original libs! CK +# XXX target_link_options(itaox11 INTERFACE -L$ENV{X11_BASE_ROOT}/stage/lib) +# Note: It must NOT be an absolute path! CK +target_link_directories( + itaox11 INTERFACE $ $ +) +target_compile_features(itaox11 INTERFACE cxx_std_17) + +message(TRACE "X11_BASE_ROOT=$ENV{X11_BASE_ROOT}") +foreach(lib_ ${TAOX11_LIBRARIES}) + find_library( + ${lib_}_LIB + NAMES ${lib_} + NO_DEFAULT_PATH + PATHS $ENV{X11_BASE_ROOT}/stage/lib REQUIRED + ) + message(STATUS "install lib ${${lib_}_LIB}") + # NOTE: this installs only symlinks witch are not useable! install(FILES ${${lib_}_LIB} TYPE LIB)! CK +endforeach() + +# Note: install all libs, more than yet used, but with symlinks to dll's +install(DIRECTORY $ENV{X11_BASE_ROOT}/stage/lib/ TYPE LIB) +# NOTE: with / means contents (*.so *.lib *.a pkgconfig)! CK +install(DIRECTORY $ENV{RIDL_ROOT}/ DESTINATION lib) + +# stage/usr/lib +# ├── ridl +# └── x86_64-linux-gnu +# ├── cmake +# │   ├── idl2cpp +# │   └── itaox11 +# ├── idl2cpp +# └── pkgconfig + +install( + DIRECTORY $ENV{X11_BASE_ROOT}/bin/ + TYPE BIN + USE_SOURCE_PERMISSIONS +) +install( + DIRECTORY $ENV{X11_BASE_ROOT}/stage/bin/ + TYPE BIN + USE_SOURCE_PERMISSIONS +) + +# stage/usr/bin +# ├── ace_gperf +# ├── brix11 +# ├── brix11.bat +# ├── fuzzers +# ├── ridlc +# ├── ridlc.bat +# ├── tao_catior +# ├── tao_cosnaming +# └── tao_idl + +if(APPLE) # "think different", indeed! CK + # see + # https://opensource.apple.com/source/clang/clang-703.0.31/src/tools/clang/docs/MSVCCompatibility.rst.auto.html + target_compile_options(itaox11 INTERFACE -fdelayed-template-parsing) + target_compile_definitions(itaox11 INTERFACE ACE_HAS_IPV6 ACE_HAS_VERSIONED_NAMESPACE=1 ACE_HAS_CUSTOM_EXPORT_MACROS=0) + target_compile_definitions(itaox11 INTERFACE __ACE_INLINE__) +elseif(UNIX) + # see https://clang.llvm.org/docs/ClangCommandLineReference.html + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + # Parse templated function definitions at the end of the translation unit + target_compile_options(itaox11 INTERFACE -fdelayed-template-parsing) + target_compile_definitions(itaox11 INTERFACE ACE_HAS_CUSTOM_EXPORT_MACROS=0) + else() + target_compile_definitions(itaox11 INTERFACE ACE_HAS_VERSIONED_NAMESPACE=1) + endif() + target_compile_definitions(itaox11 INTERFACE _GNU_SOURCE) + # Give inline C++ member functions hidden visibility by default + target_compile_options(itaox11 INTERFACE -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-aliasing) + target_compile_definitions(itaox11 INTERFACE __ACE_INLINE__) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + target_compile_options(itaox11 INTERFACE /bigobj) + target_compile_definitions( + itaox11 INTERFACE _CONSOLE _CRT_NONSTDC_NO_WARNINGS _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE + _CRT_NONSTDC_NO_DEPRECATE _WINSOCK_DEPRECATED_NO_WARNINGS #NO! CK ACE_AS_STATIC_LIBS + ) + target_compile_options( + itaox11 + INTERFACE /JMC + /GR + /GS + /Gd + /fp:precise + /Zc:inline + /Zc:wchar_t + /Zc:forScope + /ZI + /Gm- + /nologo + /Ob1 + ) + target_link_options(itaox11 INTERFACE /FORCE:MULTIPLE) +endif() + +CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.9.0") + +packageProject( + NAME itaox11 + VERSION ${PROJECT_VERSION} + NAMESPACE Axcioma + BINARY_DIR ${PROJECT_BINARY_DIR} + INCLUDE_DIR include + INCLUDE_DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + INCLUDE_HEADER_PATTERN "*.h" + COMPATIBILITY SameMajorVersion + DISABLE_VERSION_SUFFIX YES +) + +include(CPack) + diff --git a/brix11/lib/brix11/brix/common/cmds/bootstrap.rb b/brix11/lib/brix11/brix/common/cmds/bootstrap.rb index e25bc61..e81780d 100644 --- a/brix11/lib/brix11/brix/common/cmds/bootstrap.rb +++ b/brix11/lib/brix11/brix/common/cmds/bootstrap.rb @@ -64,7 +64,7 @@ def run(argv) Sys.in_dir(bse['dir']) do tag = bse['tag'] || options[:bootstrap][:tags][bse['id']] || 'master' rc, _, _ = Exec.runcmd('git', 'clone', bse['repo'], '.') - BRIX11.log_fatal("Failed to clone #{bse['id']} repository : #{bse['repo']}") unless rc + BRIX11.show_msg("Failed to clone #{bse['id']} repository : #{bse['repo']}") unless rc rc,_, _ = Exec.runcmd('git', 'checkout', tag) BRIX11.log_fatal("Failed to checkout #{bse['id']} repository tag : #{tag}") unless rc end diff --git a/build-taox11-for-osx.sh b/build-taox11-for-osx.sh new file mode 100755 index 0000000..b27a15a --- /dev/null +++ b/build-taox11-for-osx.sh @@ -0,0 +1,105 @@ +#!/bin/bash +# +# adapted from: +# https://github.com/RemedyIT/axcioma/blob/master/.github/workflows/linux.yml +# + +set -e +set -u + +export LANG=C +export CC=clang +export CXX=clang++ + +export WORKSPACE=$(realpath ..) +export X11_BASE_ROOT="${WORKSPACE}/axcioma" +export INSTALL_PREFIX="${X11_BASE_ROOT}/stage" + +source .env_add.sh + +set -x + +export BRIX11_VERBOSE=1 +export BRIX11_NUMBER_OF_PROCESSORS=6 + +# TODO: force to build only taox11! CK +rm -rf ciaox11 dancex11 +rm -f ./*.log + +"${X11_BASE_ROOT}/bin/brix11" bootstrap taox11 + +############################################################ +# patch to build ACE with -std=c++17 +cd "${ACE_ROOT}" && git stash && patch -p2 < ../../ACE_Auto_Ptr.patch +cd "${X11_BASE_ROOT}" +############################################################ + +"${X11_BASE_ROOT}/bin/brix11" configure -W aceroot="${ACE_ROOT}" -W taoroot="${TAO_ROOT}" -W mpcroot="${MPC_ROOT}" + +# Print brix11 configuration +"${X11_BASE_ROOT}/bin/brix11" --version +"${X11_BASE_ROOT}/bin/brix11" env -- configure -P 2>&1 | tee configure.log + +############################################################ +# gen GNUmakefile from workspace.mwc +# see taox11/tao/x11/taox11.mpc +# and ACE/ACE/ace/ace_for_tao.mpc +# NO! "${X11_BASE_ROOT}/bin/brix11" gen build workspace.mwc -- gen build ${TAOX11_ROOT}/examples -- gen build ${TAOX11_ROOT}/orbsvcs/tests -- gen build ${TAOX11_ROOT}/tests +############################################################ + +# FIXME: quickfixes for OSX +# ACE/ACE/include/makeinclude/platform_gcc_clang_common.GNU +# ACE/ACE/include/makeinclude/platform_clang_common.GNU +# ACE/ACE/include/makeinclude/platform_macosx_common.GNU +# ACE/ACE/include/makeinclude/platform_macosx.GNU +echo 'include $(ACE_ROOT)/include/makeinclude/platform_macosx.GNU' > +${platform_file} > "${ACE_ROOT}/include/makeinclude/platform_macros.GNU" + +# ACE/ACE/ace/config.h +# ACE/ACE/ace/config-macosx.h +# ACE/ACE/ace/config-macosx-mojave.h +# ACE/ACE/ace/config-macosx-highsierra.h +# ACE/ACE/ace/config-macosx-sierra.h +# ACE/ACE/ace/config-macosx-elcapitan.h +# ACE/ACE/ace/config-macosx-yosemite.h +# ACE/ACE/ace/config-macosx-mavericks.h +# ACE/ACE/ace/config-macosx-mountainlion.h +# ACE/ACE/ace/config-macosx-lion.h +# ACE/ACE/ace/config-macosx-leopard.h +echo '#include "ace/config-macosx.h"' > "${ACE_ROOT}/ace/config.h" +# patch to build ACE with -std=c++20 +echo '#define throw() noexcept' >> "${ACE_ROOT}/ace/config.h" + +# ACE/ACE/bin/MakeProjectCreator/config/default.features +echo 'ipv6=1' > "${ACE_ROOT}/bin/MakeProjectCreator/config/default.features" +echo 'versioned_namespace=1' >> "${ACE_ROOT}/bin/MakeProjectCreator/config/default.features" +echo 'acetaompc=1' >> "${ACE_ROOT}/bin/MakeProjectCreator/config/default.features" +echo 'inline=1' >> "${ACE_ROOT}/bin/MakeProjectCreator/config/default.features" +echo 'optimize=1' >> "${ACE_ROOT}/bin/MakeProjectCreator/config/default.features" + +# generate all GNUmakefile's +# see workspace.mwc +perl "${TAOX11_ROOT}/bin/mwc.pl" -type gnuace "${X11_BASE_ROOT}/workspace.mwc" -workers ${BRIX11_NUMBER_OF_PROCESSORS} +perl "${TAOX11_ROOT}/bin/mwc.pl" -type gnuace "${TAOX11_ROOT}/orbsvcs/tests" -workers ${BRIX11_NUMBER_OF_PROCESSORS} +perl "${TAOX11_ROOT}/bin/mwc.pl" -type gnuace "${TAOX11_ROOT}/examples" -workers ${BRIX11_NUMBER_OF_PROCESSORS} +perl "${TAOX11_ROOT}/bin/mwc.pl" -type gnuace "${TAOX11_ROOT}/tests" -workers ${BRIX11_NUMBER_OF_PROCESSORS} + +# make all +make c++20=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} 2>&1 | tee make-all.log +make c++20=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${TAOX11_ROOT}/orbsvcs/tests" 2>&1 | tee -a make-all.log +make c++20=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${TAOX11_ROOT}/examples" 2>&1 | tee -a make-all.log +make c++20=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${TAOX11_ROOT}/tests" 2>&1 | tee -a make-all.log + +# make tests +"${X11_BASE_ROOT}/bin/brix11" run list -l taox11/bin/taox11_tests.lst -r taox11 2>&1 | tee run-list.log + +# install +make -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${X11_BASE_ROOT}" install 2>&1 | tee make-install.log + +find "${INSTALL_PREFIX}/include" -type d -name home -prune -print0 | xargs -0 tree +find "${INSTALL_PREFIX}/include" -type d -name home -prune -print0 | xargs -0 rm -rf + +#FIXME: remove the installed include garbage! CK +rm -rf "${INSTALL_PREFIX}/include" + +exit 0 diff --git a/build-taox11-on-linux.sh b/build-taox11-on-linux.sh new file mode 100755 index 0000000..3d348a4 --- /dev/null +++ b/build-taox11-on-linux.sh @@ -0,0 +1,70 @@ +#!/bin/bash +# +# adapted from: +# https://github.com/RemedyIT/axcioma/blob/master/.github/workflows/linux.yml +# + +set -e +set -u + +export LANG=C +export CC=gcc +export CXX=g++ + +export WORKSPACE=$(realpath ..) +export X11_BASE_ROOT="${WORKSPACE}/axcioma" +export INSTALL_PREFIX="${X11_BASE_ROOT}/stage" + +source .env_add.sh + +set -x + +export BRIX11_VERBOSE=1 +export BRIX11_NUMBER_OF_PROCESSORS=6 + +# TODO: force to build only taox11! CK +rm -rf ciaox11 dancex11 +rm -f ./*.log + +"${X11_BASE_ROOT}/bin/brix11" bootstrap taox11 + +############################################################ +# patch to build ACE with -std=c++17 +cd "${ACE_ROOT}" && git stash && patch -p2 < ../../ACE_Auto_Ptr.patch +cd "${X11_BASE_ROOT}" +############################################################ + +"${X11_BASE_ROOT}/bin/brix11" configure -W aceroot="${ACE_ROOT}" -W taoroot="${TAO_ROOT}" -W mpcroot="${MPC_ROOT}" + +# Print brix11 configuration +"${X11_BASE_ROOT}/bin/brix11" --version +"${X11_BASE_ROOT}/bin/brix11" env -- configure -P 2>&1 | tee configure.log + +"${X11_BASE_ROOT}/bin/brix11" gen build workspace.mwc -- gen build "${TAOX11_ROOT}/examples" -- gen build "${TAOX11_ROOT}/orbsvcs/tests" -- gen build "${TAOX11_ROOT}/tests" + +# ACE/ACE/ace/config.h +#FIXME: NO! echo '#define throw() noexcept' >> ${ACE_ROOT}/ace/config.h + +#NO! "${X11_BASE_ROOT}/bin/brix11" make -N -d ${X11_BASE_ROOT} -- make -N -d ${TAOX11_ROOT}/examples -- make -N -d ${TAOX11_ROOT}/orbsvcs/tests -- make -N -d ${TAOX11_ROOT}/tests 2>&1 | tee make-all.log + +# make all +make c++17=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${X11_BASE_ROOT}" 2>&1 | tee make-all.log +make c++17=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${TAOX11_ROOT}/orbsvcs/tests" 2>&1 | tee -a make-all.log +make c++17=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${TAOX11_ROOT}/examples" 2>&1 | tee -a make-all.log +make c++17=1 -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${TAOX11_ROOT}/tests" 2>&1 | tee -a make-all.log + +#TODO: workaround to prevent problems with WSL and windows firewall! CK +grep -E "^127.0.1.1\s+$HOSTNAME" /etc/hosts && echo "change to 127.0.0.1!" && exit 1 +# make tests +"${X11_BASE_ROOT}/bin/brix11" run list -l taox11/bin/taox11_tests.lst -r taox11 2>&1 | tee run-list.log + +# install +make -j ${BRIX11_NUMBER_OF_PROCESSORS} -C "${X11_BASE_ROOT}" install 2>&1 | tee make-install.log + +find "${INSTALL_PREFIX}/include" -type d -name home -prune -print0 | xargs -0 tree +find "${INSTALL_PREFIX}/include" -type d -name home -prune -print0 | xargs -0 rm -rf + +#FIXME: remove the installed include garbage! CK +rm -rf "${INSTALL_PREFIX}/include" + +exit 0 diff --git a/cmake/CPM.cmake b/cmake/CPM.cmake new file mode 100644 index 0000000..2db867b --- /dev/null +++ b/cmake/CPM.cmake @@ -0,0 +1,20 @@ +set(CPM_DOWNLOAD_VERSION 0.35.0) + +if(CPM_SOURCE_CACHE) + # Expand relative path. This is important if the provided path contains a tilde (~) + get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE) + set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +elseif(DEFINED ENV{CPM_SOURCE_CACHE}) + set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +else() + set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") +endif() + +if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION})) + message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}") + file(DOWNLOAD https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake + ${CPM_DOWNLOAD_LOCATION} + ) +endif() + +include(${CPM_DOWNLOAD_LOCATION}) diff --git a/cmake/GenerateTaoIdl.cmake b/cmake/GenerateTaoIdl.cmake new file mode 100644 index 0000000..bf2cdde --- /dev/null +++ b/cmake/GenerateTaoIdl.cmake @@ -0,0 +1,192 @@ +## TAO IDL +# Define a macro to generate IDL output +# After this macro is called, +# +# !!IMPORTANT!! To set the exports, the following +# variables must be set before calling this macro: +# EXPORT_NAME (e.g. mylib_Export ) and +# EXPORT_FILE (e,g. mylib_Export.h ) +# +# Upon completion of this macro, the following variables will exist +# +# TAO_IDL_GENERATED - all files generated (add this to your target) +# +# TAO_IDL_GENERATED_HEADERS - generated header files (used for include +# file install) +# +# To add additional includes to the tao_idl command line, add them +# to TAO_IDL_INCLUDES before calling the macro: +# set( TAO_IDL_INCLUDES -I/my/foo/include ${TAO_IDL_INCLUDES ) +# +############################################################# +macro(TAO_WRAP_IDL) + + option(IDL_OUTPUT_IN_SOURCE_DIR "" OFF) + if(NOT IDL_OUTPUT_IN_SOURCE_DIR) + # in-source files need to see out-of-source files + include_directories(${CMAKE_CURRENT_BINARY_DIR}) + endif() + + # on unix, set the LD_LIBRARY_PATH explicitly for tao_idl + # and the PATH so tao_idl can use gperf + # ----------------------------------------------------- + set(TAO_LIB_VAR "") + set(TAO_BIN_VAR "") + if(UNIX) + set(LD_PATH_VAR LD_LIBRARY_PATH) + if(APPLE) # "think different", indeed + set(LD_PATH_VAR DYLD_LIBRARY_PATH) + endif() + set(ORIGINAL_PATH $ENV{PATH}) + set(ORIGINAL_LD_PATH $ENV{${LD_PATH_VAR}}) + set(TAO_LIB_VAR "${LD_PATH_VAR}=${ORIGINAL_LD_PATH}:${ACE_ROOT_DIR}/lib") + set(TAO_BIN_VAR "PATH=${ORIGINAL_PATH}:${ACE_ROOT_DIR}/bin") + endif() + + # the generated files need to reference the *_Export files, + # so copy them to the out-of-source tree to avoid nasty + # include path referencing mess + # ----------------------------------------------------- + if(EXPORT_FILE) + message(STATUS "Copying ${EXPORT_FILE} file to out-of-source tree... (GenerateTaoIdl)") + exec_program( + "${CMAKE_COMMAND}" ARGS -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/${EXPORT_FILE}" + "${CMAKE_CURRENT_BINARY_DIR}/${EXPORT_FILE}" + ) + endif() + + set(IDL_CHDR "C.h") + set(IDL_CINL "CP.h") + set(IDL_CSRC "C.cpp") + set(IDL_SHDR "S.h") + set(IDL_SINL "SP.h") + set(IDL_SSRC "S.cpp") + + set(TAO_IDL_VER_FLAGS "") + + if("$ENV{RIDL_ROOT}" STREQUAL "") + message(FATAL_ERROR "RIDL_ROOT not set!") + endif() + find_program(TAO_IDL_COMMAND NAMES ridlc REQUIRED) + + if("$ENV{TAOX11_ROOT}" STREQUAL "") + message(FATAL_ERROR "TAOX11_ROOT not set!") + endif() + + # newer versions of TAO (ACE version 5.8.1+) default to generating errors + # for anonymous types. -aw overrides this and makes it a warning + # Nice of them to add new compiler flags as a "patch" update... + if(ACE_VERSION VERSION_GREATER 5.8.0) + # TODO set(TAO_IDL_VER_FLAGS -w -aw -Cw) + endif() + + # FIXME: -in To generate <>s for standard #include'd files (non-changing files) + # TODO list(APPEND TAO_IDL_FLAGS ${TAO_IDL_VER_FLAGS} -in -Wb,pre_include=ace/pre.h -Wb,post_include=ace/post.h) + list( + APPEND + TAO_IDL_FLAGS + ${TAO_IDL_VER_FLAGS} + -in + -Wb,pre_include=ace/pre.h + -Wb,post_include=ace/post.h + -Ssi + -Sci + -Gos + -DGEN_IDL_MAKE_DEPS + ) + message(TRACE "TAO_IDL_FLAGS = ${TAO_IDL_FLAGS}") + + # TODO we should to some system introspection to narrow this list down + # XXX set(TAO_IDL_INCLUDES -I$ENV{TAOX11_ROOT} -I${TAO_ROOT_INCLUDE} -I${TAO_ROOT_INCLUDE}/tao + # XXX -I${TAO_ROOT_INCLUDE}/orbsvcs + # XXX -I${TAO_ROOT_INCLUDE}/orbsvcs/orbsvcs ${TAO_IDL_INCLUDES} + # XXX ) + + # add a custom command set for idl files + # ----------------------------------------------------- + foreach(idl_filename ${ARGN}) + + # get the basename (i.e. "NAME Without Extension") + get_filename_component(IDL_BASE ${idl_filename} NAME_WE) + get_filename_component(IDL_DEP_PATH ${idl_filename} ABSOLUTE) + get_filename_component(IDL_SRC_DIR ${IDL_DEP_PATH} DIRECTORY) + file(RELATIVE_PATH IDL_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${IDL_SRC_DIR}) + #message(WARNING "IDL_PATH=${IDL_PATH}") + + if(IDL_OUTPUT_IN_SOURCE_DIR) + set(SRCDIR ${IDL_SRC_DIR}) + set(OOSDIR ${IDL_SRC_DIR}) + else() # NOTE: OutOffSource Directory used! CK + set(SRCDIR ${IDL_SRC_DIR}) + set(OOSDIR ${CMAKE_CURRENT_BINARY_DIR}/${IDL_PATH}) + #message(WARNING "OOSDIR=${OOSDIR}") + endif() + + set(IDL_OUTPUT_HEADERS ${OOSDIR}/${IDL_BASE}${IDL_CHDR} ${OOSDIR}/${IDL_BASE}${IDL_CINL} + ${OOSDIR}/${IDL_BASE}${IDL_SHDR} + ) + # newer versions of TAO don't generate servant inline files + # not sure what version this happened at, the version + # below is a guess + # XXX if(ACE_VERSION VERSION_LESS 6.0.2) + # XXX message(FATAL_ERROR "ACE_VERSION: ${ACE_VERSION} VERSION_LESS 6.0.2") + list(APPEND IDL_OUTPUT_HEADERS ${OOSDIR}/${IDL_BASE}${IDL_SINL}) + # XXX endif() + + set(IDL_OUTPUT_SOURCES ${OOSDIR}/${IDL_BASE}${IDL_CSRC} ${OOSDIR}/${IDL_BASE}${IDL_SSRC}) + set(IDL_OUTPUT_FILES ${IDL_OUTPUT_HEADERS} ${IDL_OUTPUT_SOURCES}) + + if(EXPORT_NAME) + if(NOT EXTRA_TAO_IDL_ARGS MATCHES ".*export_macro=\"${EXPORT_NAME}\"") + set(EXTRA_TAO_IDL_ARGS ${EXTRA_TAO_IDL_ARGS} -Wb,export_macro="${EXPORT_NAME}") + endif() + endif() + + if(EXPORT_FILE) + if(NOT EXTRA_TAO_IDL_ARGS MATCHES ".*export_include=\"${EXPORT_FILE}\"") + set(EXTRA_TAO_IDL_ARGS ${EXTRA_TAO_IDL_ARGS} -Wb,export_include="${EXPORT_FILE}") + endif() + endif() + + # output files depend on at least the corresponding idl + set(DEPEND_FILE_LIST ${SRCDIR}/${IDL_BASE}.idl) + + file(READ ${idl_filename} IDL_FILE_CONTENTS LIMIT 2048) + #message(WARNING "IDL_FILE_CONTENTS = ${IDL_FILE_CONTENTS}") + + # look for other dependencies + foreach(idl_dep_full_filename ${ARGN}) + get_filename_component(IDL_DEP_BASE ${idl_dep_full_filename} NAME_WE) + if(IDL_FILE_CONTENTS MATCHES ${IDL_DEP_BASE}\\.idl AND NOT idl_dep_full_filename STREQUAL idl_filename) + #message(STATUS "${idl_filename} depends on ${idl_dep_full_filename}") + list(APPEND DEPEND_FILE_LIST ${idl_dep_full_filename}) + endif() + endforeach() + + option(IDL_DEBUG_DEPENDENCIES "" OFF) + if(IDL_DEBUG_DEPENDENCIES) + message(STATUS "--------------------------------------") + message(STATUS " IDL_OUTPUT_FILES=${IDL_OUTPUT_FILES}") + message(STATUS " DEPEND_FILE_LIST=${DEPEND_FILE_LIST}") + message(STATUS " TAO_BIN_VAR=${TAO_BIN_VAR}") + message(STATUS " TAO_LIB_VAR=${TAO_LIB_VAR}") + message(STATUS " TAO_IDL_COMMAND=${TAO_IDL_COMMAND}") + message(STATUS " TAO_IDL_FLAGS=${TAO_IDL_FLAGS}") + message(STATUS "EXTRA_TAO_IDL_ARGS=${EXTRA_TAO_IDL_ARGS}") + endif() + + # setup the command + # ----------------------------------------------------- + add_custom_command( + OUTPUT ${IDL_OUTPUT_FILES} + DEPENDS ${DEPEND_FILE_LIST} + COMMAND ${TAO_BIN_VAR} ${TAO_LIB_VAR} ${TAO_IDL_COMMAND} ARGS ${TAO_IDL_FLAGS} ${EXTRA_TAO_IDL_ARGS} + -I${CMAKE_CURRENT_SOURCE_DIR} ${TAO_IDL_INCLUDES} -o ${OOSDIR} ${IDL_DEP_PATH} + ) + + list(APPEND TAO_IDL_GENERATED_HEADERS ${IDL_OUTPUT_HEADERS}) + list(APPEND TAO_IDL_GENERATED ${IDL_OUTPUT_FILES}) + + endforeach() + +endmacro() diff --git a/cmake/GlobalSettings.cmake b/cmake/GlobalSettings.cmake new file mode 100644 index 0000000..ca84f0e --- /dev/null +++ b/cmake/GlobalSettings.cmake @@ -0,0 +1,33 @@ +include_guard(GLOBAL) + +# require a C++ standard +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 17) + option(CMAKE_CXX_EXTENSIONS "" NO) + option(CMAKE_CXX_STANDARD_REQUIRED "" YES) +endif() + +# NOTE: only for MSVC build shared libs (DLL) +include(CMakeDependentOption) +cmake_dependent_option(BUILD_SHARED_LIBS "Build shared instead of static library" YES "MSVC" NO) + +option(BUILD_SHARED_LIBS "Build shared Libraries" NO) +option(USE_POSTFIX "Use postfix for debug" YES) +if(USE_POSTFIX) + set(CMAKE_DEBUG_POSTFIX d) +endif() + +list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + +# set this variable to specify a common place where CMake should put all +# libraries and executables (instead of CMAKE_CURRENT_BINARY_DIR) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) + +# ================================ +# add dependencies +# ================================ +include(CPM) + +CPMUsePackageLock(package-lock.cmake) diff --git a/include/.keep b/include/.keep new file mode 100644 index 0000000..e69de29