Skip to content

Commit

Permalink
Make build area more closely resemble dist area (#1161)
Browse files Browse the repository at this point in the history
Signed-off-by: Larry Gritz <lg@larrygritz.com>
  • Loading branch information
lgritz committed May 2, 2020
1 parent 0961da8 commit 0d5bc28
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ message (STATUS "Project install prefix = ${CMAKE_INSTALL_PREFIX}")
message (STATUS "Configuration types = ${CMAKE_CONFIGURATION_TYPES}")
message (STATUS "Build type = ${CMAKE_BUILD_TYPE}")

# Make the build area layout look a bit more like the final dist layout
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
message (FATAL_ERROR "Not allowed to run in-source build!")
endif ()
Expand Down
15 changes: 9 additions & 6 deletions src/liboslexec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,17 @@ install_targets (${local_lib})
# Unit tests
if (OSL_BUILD_TESTS)
add_executable (accum_test accum_test.cpp)
target_link_libraries ( accum_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
add_test (unit_accum "${CMAKE_BINARY_DIR}/src/liboslexec/accum_test")
target_link_libraries (accum_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
set_target_properties (accum_test PROPERTIES FOLDER "Unit Tests")
add_test (unit_accum ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/accum_test)

add_executable (dual_test dual_test.cpp)
target_link_libraries ( dual_test PRIVATE ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
add_test (unit_dual "${CMAKE_BINARY_DIR}/src/liboslexec/dual_test")
target_link_libraries (dual_test PRIVATE ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
set_target_properties (dual_test PROPERTIES FOLDER "Unit Tests")
add_test (unit_dual ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dual_test)

add_executable (llvmutil_test llvmutil_test.cpp)
target_link_libraries ( llvmutil_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
add_test (unit_llvmutil "${CMAKE_BINARY_DIR}/src/liboslexec/llvmutil_test")
target_link_libraries (llvmutil_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
set_target_properties (llvmutil_test PROPERTIES FOLDER "Unit Tests")
add_test (unit_llvmutil ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvmutil_test)
endif ()
2 changes: 1 addition & 1 deletion src/liboslnoise/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ if (OSL_BUILD_TESTS)
add_executable (oslnoise_test oslnoise_test.cpp)
set_target_properties (oslnoise_test PROPERTIES FOLDER "Unit Tests")
target_link_libraries (oslnoise_test PRIVATE oslnoise)
add_test (unit_oslnoise oslnoise_test)
add_test (unit_oslnoise ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/oslnoise_test)
endif()
2 changes: 1 addition & 1 deletion testsuite/runtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def text_diff (fromfile, tofile, diff_file=None):


def osl_app (app):
apath = os.path.join(OSL_BUILD_DIR, "src", app)
apath = os.path.join(OSL_BUILD_DIR, "bin")
if (platform.system () == 'Windows'):
# when we use Visual Studio, built applications are stored
# in the app/$(OutDir)/ directory, e.g., Release or Debug.
Expand Down

0 comments on commit 0d5bc28

Please sign in to comment.