Skip to content

Commit

Permalink
Fix windows issues
Browse files Browse the repository at this point in the history
  • Loading branch information
buddly27 committed Sep 15, 2024
1 parent cf7748d commit 82419b9
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ env:
CMAKE_GENERATOR_PLATFORM: x64
CTEST_OUTPUT_ON_FAILURE: True

VERBOSE: 1

# Avoid the just-in-time debugger where possible when running tests.
ARCH_AVOID_JIT: True

jobs:
test-windows:
runs-on: windows-latest
Expand All @@ -26,7 +31,7 @@ jobs:

- uses: actions/setup-python@v5
with:
python-version: 3.12
python-version: 3.11

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
Expand All @@ -36,7 +41,7 @@ jobs:
with:
boost: 1.85.0
oneTBB: 2021.12.0
python: 3.12
python: 3.11
path: C:/Program Files

- name: Configure
Expand Down
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ if (NOT BUILD_SHARED_LIBS)
endif()

if (WIN32)
add_definitions(-DBOOST_ALL_NO_LIB -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DBOOST_PYTHON_NO_PY_SIGNATURES -D_YY_NO_UNISTD_H)

# Make sure WinDef.h does not define min and max macros which
# will conflict with std::min() and std::max().
add_definitions(-DNOMINMAX)
Expand All @@ -49,6 +51,14 @@ if (WIN32)
else()
set(CMAKE_CXX_FLAGS "/Zc:inline ${CMAKE_CXX_FLAGS}")
endif()

# The Visual Studio preprocessor doesn't conform to the C++ standard,
# causing harmless warnings that we can ignore. These are hard to guard, so
# we disable them globally.
# https://developercommunity.visualstudio.com/t/standard-conforming-preprocessor-invalid-warning-c/364698
set(CMAKE_CXX_FLAGS "/wd4003 ${CMAKE_CXX_FLAGS}")

set(CMAKE_CXX_FLAGS "/W3 /WX- /diagnostics:column /MP /O2 /Ob2 /Gm- /EHsc /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:rvalueCast /bigobj /Zm150 ${CMAKE_CXX_FLAGS}")
endif()

# Update build type from environment for CMake < 3.22
Expand Down
5 changes: 2 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
add_library(tf
pxr/tf/initConfig.cpp
pxr/tf/anyUniquePtr.cpp
pxr/tf/anyWeakPtr.cpp
pxr/tf/atomicOfstreamWrapper.cpp
Expand Down Expand Up @@ -26,7 +27,6 @@ add_library(tf
pxr/tf/fileUtils.cpp
pxr/tf/getenv.cpp
pxr/tf/hash.cpp
pxr/tf/initConfig.cpp
pxr/tf/iterator.cpp
pxr/tf/mallocTag.cpp
pxr/tf/notice.cpp
Expand Down Expand Up @@ -155,9 +155,8 @@ set_target_properties(tf
)

target_compile_definitions(tf
PUBLIC
TF_EXPORTS=1
PRIVATE
TF_EXPORTS=1
MFB_PACKAGE_MODULE=Tf
MFB_PACKAGE_NAME=tf
MFB_ALT_PACKAGE_NAME=tf
Expand Down
2 changes: 1 addition & 1 deletion test/denseHashMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static void Run()
TF_AXIOM(i0++->first == keys[1]);

printf("inserting using insert(range)\n");
std::vector< std::pair<int, std::string> > morekeys;
std::vector< std::pair<size_t, std::string> > morekeys;
for(size_t i=100; i<200; i++)
morekeys.push_back(std::make_pair(i, "hello"));
_map.insert(morekeys.begin(), morekeys.end());
Expand Down
2 changes: 1 addition & 1 deletion test/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Test_TfHash()
std::map<int, uint32_t> mint = {{-1, 1}, {2, 3}, {-4, 5}};
printf("hash(map<int, uint32_t>): %zu\n", h(mint));

std::pair<int, float> intfloat = {1, 2.34};
std::pair<int, float> intfloat = {1, static_cast<float>(2.34)};
printf("hash(pair<int, float>): %zu\n", h(intfloat));

std::vector<std::pair<int, float>> vp { intfloat, intfloat, intfloat };
Expand Down

0 comments on commit 82419b9

Please sign in to comment.