Skip to content

Commit

Permalink
Fix new (WIP) cmake setup to work on OS/X
Browse files Browse the repository at this point in the history
This includes a fix for the semaphore configure check as well as a
couple of compile warnings

Signed-off-by: Kimball Thurston <kdt3rd@gmail.com>
  • Loading branch information
kdt3rd committed Jul 17, 2019
1 parent 9a1ca75 commit 2fe5a26
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 15 deletions.
4 changes: 2 additions & 2 deletions IlmBase/IlmThread/IlmThreadSemaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
# endif
# define NOMINMAX
# include <windows.h>
#elif HAVE_POSIX_SEMAPHORES
#elif defined(HAVE_POSIX_SEMAPHORES)
# include <semaphore.h>
#elif __APPLE__
#elif defined(__APPLE__)
# include <dispatch/dispatch.h>
#else
# ifdef ILMBASE_FORCE_CXX03
Expand Down
2 changes: 1 addition & 1 deletion IlmBase/IlmThread/IlmThreadSemaphoreOSX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
//
//-----------------------------------------------------------------------------

#if __APPLE__
#if defined(__APPLE__)

#include "IlmThreadSemaphore.h"
#include "Iex.h"
Expand Down
20 changes: 11 additions & 9 deletions IlmBase/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ if(Threads_FOUND)

# we have threads, but do we have posix semaphores for sem_init?
# should be in pthreads
check_include_files(semaphore.h ILMBASE_HAVE_SEMAPHORE_H)
if(ILMBASE_HAVE_SEMAPHORE_H AND ILMBASE_HAVE_PTHREAD)
# should just be in libc, so no need for check_library_exists
set(CMAKE_REQUIRED_FLAGS ${CMAKE_THREAD_LIBS_INIT})
check_library_exists(pthread sem_init "" ILMBASE_HAVE_POSIX_SEMAPHORES)
# TODO: remove this once we cleanly have ILMBASE_ prefix on all #defines
if(ILMBASE_HAVE_POSIX_SEMAPHORES)
set(HAVE_POSIX_SEMAPHORES ON)
if(NOT APPLE)
check_include_files(semaphore.h ILMBASE_HAVE_SEMAPHORE_H)
if(ILMBASE_HAVE_SEMAPHORE_H AND ILMBASE_HAVE_PTHREAD)
# should just be in libc, so no need for check_library_exists
set(CMAKE_REQUIRED_FLAGS ${CMAKE_THREAD_LIBS_INIT})
check_library_exists(pthread sem_init "" ILMBASE_HAVE_POSIX_SEMAPHORES)
# TODO: remove this once we cleanly have ILMBASE_ prefix on all #defines
if(ILMBASE_HAVE_POSIX_SEMAPHORES)
set(HAVE_POSIX_SEMAPHORES ON)
endif()
set(CMAKE_REQUIRED_FLAGS)
endif()
set(CMAKE_REQUIRED_FLAGS)
endif()
endif()

Expand Down
11 changes: 8 additions & 3 deletions OpenEXR/IlmImfTest/testBadTypeAttributes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,22 @@ template<class T> void readTiledThing(T & input,bool test)
case ONE_LEVEL :
x_levels = 1;
y_levels = 1;
break;
break;
case MIPMAP_LEVELS :
x_levels = input.numXLevels();
y_levels = 1;
break;
case RIPMAP_LEVELS :
x_levels = input.numXLevels();
y_levels = input.numYLevels();
break;
case NUM_LEVELMODES:
default:
std::cerr << "Invalid tile mode " << int(t.mode) << std::endl;
break;
}
for(int x_level = 0 ; x_level < x_levels ; x_level++)

for(int x_level = 0 ; x_level < x_levels ; x_level++)
{
for(int y_level = 0 ; y_level < y_levels ;y_level++)
{
Expand Down
4 changes: 4 additions & 0 deletions OpenEXR/IlmImfTest/testScanLineApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ writeRead (const Array2D<unsigned int> &pi1,
}
}
break;
case NUM_LEVELMODES:
default:
std::cerr << "Invalid tile mode " << int(mode) << std::endl;
break;
}
}

Expand Down
4 changes: 4 additions & 0 deletions OpenEXR/IlmImfTest/testYca.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ writeReadYca (const char fileName[],
}

break;
case NUM_LINEORDERS:
default:
cerr << "invalid line order " << int(readOrder) << std::endl;
break;
}
}

Expand Down

0 comments on commit 2fe5a26

Please sign in to comment.