Skip to content

Commit

Permalink
Fixed Some Windows CMake Issues
Browse files Browse the repository at this point in the history
- Fixed using dll instead of lib files when CMake has to build ACE/TAO.
- Fixed static not linking
- Added static windows build to GHA that builds ACE/TAO
- CTest should now output logs on failures in GHA
  • Loading branch information
iguessthislldo committed Sep 30, 2023
1 parent 410c7a4 commit 5d40bb4
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 15 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ concurrency:
env:
TRIGGERING_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
VCPKG_INSTALLED_DIR: ${{ github.workspace }}\vcpkg\installed
CTEST_OUTPUT_ON_FAILURE: ON

jobs:

Expand Down Expand Up @@ -12895,3 +12896,50 @@ jobs:
run: |
cd OpenDDS\build
ctest -C Debug
build_cmake_w22_stat:

runs-on: windows-2022

steps:
- name: Checkout OpenDDS
uses: actions/checkout@v3
with:
path: OpenDDS
submodules: true
- name: Checkout MPC
uses: actions/checkout@v3
with:
repository: DOCGroup/MPC
path: MPC
- name: Checkout ACE_TAO
uses: actions/checkout@v3
with:
repository: DOCGroup/ACE_TAO
ref: ace6tao2
path: OpenDDS/ACE_TAO
- name: set up msvc env
uses: ilammy/msvc-dev-cmd@v1
- name: Configure
shell: cmd
run: |
cd OpenDDS
cmake -B build^
-DCMAKE_UNITY_BUILD=TRUE^
-DBUILD_SHARED_LIBS=FALSE^
-DCMAKE_BUILD_TYPE=Debug^
-DOPENDDS_ACE=${{ github.workspace }}\OpenDDS\ACE_TAO\ACE^
-DOPENDDS_MPC=${{ github.workspace }}\MPC^
-DOPENDDS_BUILD_TESTS=TRUE^
-DOPENDDS_CMAKE_VERBOSE=all
- uses: ammaraskar/[email protected]
- name: Build
shell: cmd
run: |
cd OpenDDS
cmake --build build
- name: Run Tests
shell: cmd
run: |
cd OpenDDS\build
ctest -C Debug
28 changes: 19 additions & 9 deletions cmake/ace_group.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,25 @@ if(OPENDDS_XERCES3)
endif()

function(_opendds_vs_force_static)
# See https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
set(${flag_var} "${${flag_var}}" PARENT_SCOPE)
endif()
endforeach()
# Make sure the MSVC runtime library, which is similar to libc of other
# systems, is the same kind everywhere. Normally we shouldn't make global
# changes, but if we don't do this, MSVC won't link the programs if the
# runtimes of compiled objects are different.
if(CMAKE_VERSION VERSION_LESS 3.15.0)
# See https://gitlab.kitware.com/cmake/community/wikis/FAQ#dynamic-replace
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
set(${flag_var} "${${flag_var}}" PARENT_SCOPE)
endif()
endforeach()
else()
# The above doesn't seem to work anymore, so use this newer setting to
# force it globally.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>" CACHE INTERNAL "" FORCE)
endif()
endfunction()

if(MSVC AND OPENDDS_STATIC)
Expand Down
7 changes: 4 additions & 3 deletions cmake/scrape_vs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
if ($pf_line =~ /<OutputFile>(\$\(OutDir\))?(.*)<\/OutputFile>$/) {
my $out_dir = $1;
my $output_file = $2;
$output_file =~ s/d?.dll/d.dll/;
$output_file =~ s/d?\.dll/d.dll/;
$output_file =~ s/\.dll$/.lib/;
if ($out_dir) {
my $dir = $output_file =~ /.exe/ ? 'bin' : 'lib';
$loc = File::Spec->catfile($values{ace}, $dir, $output_file);
Expand All @@ -64,11 +65,11 @@
}
}
if (!defined($loc)) {
print STDERR ("Didn't get OutputFile from $pf\n");
# print STDERR ("Didn't get OutputFile from $pf\n");
next;
}

print STDERR ("$name $pf $loc\n");
# print STDERR ("$name $pf $loc\n");
$projects{$name} = {
name => $name,
loc => $loc,
Expand Down
4 changes: 1 addition & 3 deletions dds/DCPS/RTPS/MessageParser.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/*
*
*
* Distributed under the OpenDDS License.
* See: http://www.opendds.org/license.html
*/
Expand All @@ -9,7 +7,7 @@
#define OPENDDS_DCPS_RTPS_MESSAGEPARSER_H

#include "RtpsCoreTypeSupportImpl.h"

#include "rtps_export.h"

OPENDDS_BEGIN_VERSIONED_NAMESPACE_DECL

Expand Down

0 comments on commit 5d40bb4

Please sign in to comment.