Skip to content

Commit

Permalink
Fixes for #9145. (#9150)
Browse files Browse the repository at this point in the history
  - Explicitly add OpenSceneGraph incldue directories for OMEditLib.
    OpenSceneGraph might not always be installed in to system include directories.
    Make sure OMEditLIB can find it always.

  - Add `include(CheckCCompilerFlag)` to the our cmake utilities file. This
    is a frequently used functionality and it is fair to have it included
    by default.

  - Use CMAKE_SHARED_LIBRARY_PREFIX and CMAKE_SHARED_LIBRARY_SUFFIX to compute
    the name of the OMSimulator library. It can be different in different
    Unix systems, e.g., on MacOS we should expect `libOMSimulator.dynlib`

  - Add CMAKE_VERSION to the configuration report just for ease of debugging.
  • Loading branch information
mahge committed Jun 27, 2022
1 parent 613355e commit 0d73963
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Expand Up @@ -28,6 +28,7 @@ include(cmake/omc_check_exists.cmake)
# well as linux. See the file for more info.
include(cmake/OMCPThreads.cmake)

omc_add_to_report(CMAKE_VERSION)
# Add the compiler ids to the report for convenience.
omc_add_to_report(CMAKE_C_COMPILER_ID)
omc_add_to_report(CMAKE_CXX_COMPILER_ID)
Expand Down
2 changes: 2 additions & 0 deletions OMEdit/OMEditLIB/CMakeLists.txt
Expand Up @@ -268,6 +268,8 @@ set_source_files_properties(${OMCompiler_SOURCE_DIR}/Compiler/Script/OpenModelic
add_library(OMEditLib STATIC ${OMEDITLIB_SOURCES} ${OMEDITLIB_HEADERS})

target_include_directories(OMEditLib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# OpenSceneGraph does not provide imported targets yet. Add includes manually.
target_include_directories(OMEditLib PUBLIC ${OPENSCENEGRAPH_INCLUDE_DIRS})

# qmake adds -DUNICODE by defult (As far as I can gather).
# So add it for CMake as well to avoid having to modify the code.
Expand Down
1 change: 1 addition & 0 deletions cmake/omc_utils.cmake
@@ -1,5 +1,6 @@
include(FeatureSummary)
include(CMakePrintHelpers)
include(CheckCCompilerFlag)

macro(omc_add_to_report var)
cmake_print_variables(${var})
Expand Down
4 changes: 3 additions & 1 deletion omsimulator.cmake
Expand Up @@ -71,8 +71,10 @@ else()
set(OMSIMULATORLIB_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/OMSimulator/lib/)
endif()

set(LIB_OMSIMULATOR_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}OMSimulator${CMAKE_SHARED_LIBRARY_SUFFIX})

set_target_properties(libOMSimulator PROPERTIES
IMPORTED_LOCATION ${OMSIMULATORLIB_LOCATION}/libOMSimulator.so
IMPORTED_LOCATION ${OMSIMULATORLIB_LOCATION}/${LIB_OMSIMULATOR_NAME}
)


Expand Down

0 comments on commit 0d73963

Please sign in to comment.