Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes Overrides.toml issues on Windows and when using nested CMake projects. #165

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
/out/build/x64-Debug
/CMakeSettings.json
/build
/.vscode
/.vscode
*.exe
*.obj
*.lib
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,23 @@ if(WIN32)
DEPENDS install
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/..
)
set(ENV{HOME} $ENV{USERPROFILE}) #on windows the home directory is in USERPROFILE, but libcxxwrap-julia doesn't know this and uses HOME instead.
endif()

set(OVERRIDES_PATH "$ENV{HOME}/.julia/artifacts/Overrides.toml" CACHE FILEPATH "Path to the Overrides file")
set(OVERRIDE_ROOT "${CMAKE_CURRENT_BINARY_DIR}" CACHE PATH "Path to the installation or build directory to use")
set(OVERRIDE_ROOT "${CMAKE_BINARY_DIR}" CACHE PATH "Path to the installation or build directory to use") #DLLs are output to CMAKE_BINARY_DIR not CMAKE_CURRENT_BINARY_DIR
option(APPEND_OVERRIDES_TOML "Append an entry to the Overrides.toml file to make Julia use the libcxxwrap in the current dir" OFF)

if(APPEND_OVERRIDES_TOML)
write_file(${OVERRIDES_PATH} "
[3eaa8342-bff7-56a5-9981-c04077f7cee7]
libcxxwrap_julia = \"${OVERRIDE_ROOT}\"
" APPEND)
message("Entry added to ${OVERRIDES_PATH}: CxxWrap will use ${OVERRIDE_ROOT}")
endif()

set(JlCxx_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) #this allows find_package(JlCxx) to work from the top level CMake file

# include(CMakePrintHelpers)
# cmake_print_variables(CMAKE_BINARY_DIR CMAKE_CURRENT_BINARY_DIR OVERRIDE_ROOT)
# cmake_print_properties(TARGETS cxxwrap_julia cxxwrap_julia_stl PROPERTIES BINARY_DIR INCLUDE_DIRECTORIES LINK_LIBRARIES)
Loading