Skip to content

Commit 0d5bc28

Browse files
authored
Make build area more closely resemble dist area (#1161)
Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 0961da8 commit 0d5bc28

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ message (STATUS "Project install prefix = ${CMAKE_INSTALL_PREFIX}")
3030
message (STATUS "Configuration types = ${CMAKE_CONFIGURATION_TYPES}")
3131
message (STATUS "Build type = ${CMAKE_BUILD_TYPE}")
3232

33+
# Make the build area layout look a bit more like the final dist layout
34+
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
35+
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
36+
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
37+
3338
if ("${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
3439
message (FATAL_ERROR "Not allowed to run in-source build!")
3540
endif ()

src/liboslexec/CMakeLists.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,17 @@ install_targets (${local_lib})
220220
# Unit tests
221221
if (OSL_BUILD_TESTS)
222222
add_executable (accum_test accum_test.cpp)
223-
target_link_libraries ( accum_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
224-
add_test (unit_accum "${CMAKE_BINARY_DIR}/src/liboslexec/accum_test")
223+
target_link_libraries (accum_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
224+
set_target_properties (accum_test PROPERTIES FOLDER "Unit Tests")
225+
add_test (unit_accum ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/accum_test)
225226

226227
add_executable (dual_test dual_test.cpp)
227-
target_link_libraries ( dual_test PRIVATE ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
228-
add_test (unit_dual "${CMAKE_BINARY_DIR}/src/liboslexec/dual_test")
228+
target_link_libraries (dual_test PRIVATE ${OPENIMAGEIO_LIBRARIES} ${ILMBASE_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
229+
set_target_properties (dual_test PROPERTIES FOLDER "Unit Tests")
230+
add_test (unit_dual ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dual_test)
229231

230232
add_executable (llvmutil_test llvmutil_test.cpp)
231-
target_link_libraries ( llvmutil_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
232-
add_test (unit_llvmutil "${CMAKE_BINARY_DIR}/src/liboslexec/llvmutil_test")
233+
target_link_libraries (llvmutil_test PRIVATE oslexec ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
234+
set_target_properties (llvmutil_test PROPERTIES FOLDER "Unit Tests")
235+
add_test (unit_llvmutil ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/llvmutil_test)
233236
endif ()

src/liboslnoise/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,5 @@ if (OSL_BUILD_TESTS)
3333
add_executable (oslnoise_test oslnoise_test.cpp)
3434
set_target_properties (oslnoise_test PROPERTIES FOLDER "Unit Tests")
3535
target_link_libraries (oslnoise_test PRIVATE oslnoise)
36-
add_test (unit_oslnoise oslnoise_test)
36+
add_test (unit_oslnoise ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/oslnoise_test)
3737
endif()

testsuite/runtest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def text_diff (fromfile, tofile, diff_file=None):
147147

148148

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

0 commit comments

Comments
 (0)