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

Create a cmake import target Axcioma::itaox11 #120

Closed
wants to merge 17 commits into from
Closed
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
1 change: 1 addition & 0 deletions .clang-format
21 changes: 21 additions & 0 deletions .env_add.sh
Original file line number Diff line number Diff line change
@@ -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

14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
build
.*
*~
ACE
ACE/
ACE_TAO/
*C.h
*C.inl
*C.cpp
Expand All @@ -20,6 +21,7 @@ GNUmakefile*
*.pdb
*.Build.CppClean.log
*.dll
*.dylib
*.lib
*.iobj
*.ipdb
Expand All @@ -28,8 +30,16 @@ GNUmakefile*
*.exe
*.kdev4
*.so*
*.log
commit.txt
taox11/html
taox11/latex
taox11/
*.gcno
workspace.mwc*
workspace.mwc*
ciaox11/
dancex11/
ridl/
taox11/
stage/
/lib/*
13 changes: 13 additions & 0 deletions ACE_Auto_Ptr.patch
Original file line number Diff line number Diff line change
@@ -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 <memory>
-using std::auto_ptr;
+//XXX using std::auto_ptr;
#else /* !ACE_LACKS_AUTO_PTR */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL
207 changes: 207 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 $<LOWER_CASE:${filename}>)
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 "$<BUILD_INTERFACE:")
list(TRANSFORM TAOX11_INCLUDE_DIRS APPEND ">")
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} $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

# 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 $<BUILD_INTERFACE:$ENV{X11_BASE_ROOT}/stage/lib> $<INSTALL_INTERFACE:${CMAKE_INSTALL_LIBDIR}>
)
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/[email protected]")

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)

2 changes: 1 addition & 1 deletion brix11/lib/brix11/brix/common/cmds/bootstrap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
105 changes: 105 additions & 0 deletions build-taox11-for-osx.sh
Original file line number Diff line number Diff line change
@@ -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
Loading