diff options
| -rw-r--r-- | CMakeLists.txt | 15 | ||||
| -rw-r--r-- | CMakePresets.json | 2 | ||||
| -rw-r--r-- | CONTRIBUTION.md | 35 |
3 files changed, 36 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 49d2ab2f4..6793a9f6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,6 +87,7 @@ option(SLANG_EMBED_STDLIB "Build slang with an embedded version of the stdlib") option(SLANG_ENABLE_FULL_IR_VALIDATION "Enable full IR validation (SLOW!)") option(SLANG_ENABLE_ASAN "Enable ASAN (address sanitizer)") +option(SLANG_ENABLE_PREBUILT_BINARIES "Enable using prebuilt binaries" ON) option(SLANG_ENABLE_GFX "Enable gfx targets" ON) option(SLANG_ENABLE_SLANGD "Enable language server target" ON) option(SLANG_ENABLE_SLANGC "Enable standalone compiler target" ON) @@ -385,7 +386,7 @@ if(SLANG_SLANG_LLVM_FLAVOR STREQUAL "FETCH_BINARY") endif() set(slang_llvm_dest_object - ${CMAKE_BINARY_DIR}/$<CONFIG>/${library_subdir}/${slang_llvm_filename} + ${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir}/${slang_llvm_filename} ) add_custom_command( OUTPUT ${slang_llvm_dest_object} @@ -445,6 +446,18 @@ elseif(SLANG_SLANG_LLVM_FLAVOR STREQUAL "USE_SYSTEM_LLVM") # pulling in libLLVM.so) endif() +if(SLANG_ENABLE_PREBUILT_BINARIES) + if(CMAKE_SYSTEM_NAME MATCHES "Windows") + add_custom_target( + copy-prebuilt-binaries ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CMAKE_SOURCE_DIR}/external/slang-binaries/bin/windows-x64 + ${CMAKE_BINARY_DIR}/$<CONFIG>/${runtime_subdir} + VERBATIM + ) + endif() +endif() + if(SLANG_ENABLE_GFX) # # `platform` contains all the platform abstractions for a GUI application. diff --git a/CMakePresets.json b/CMakePresets.json index c23fbada1..de1959c28 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -2,7 +2,7 @@ "version": 6, "cmakeMinimumRequired": { "major": 3, - "minor": 20, + "minor": 25, "patch": 0 }, "configurePresets": [ diff --git a/CONTRIBUTION.md b/CONTRIBUTION.md index 594e32a9f..fb5f9e5e2 100644 --- a/CONTRIBUTION.md +++ b/CONTRIBUTION.md @@ -73,28 +73,35 @@ Please follow the instructions of how to [Building Slang from Source](docs/build For a quick reference, follow the instructions below. #### Windows -Find where the premake executable is. The location may change when we upgrade Premake. -``` -C:\git\slang> where /r external\slang-binaries\premake premake*.exe -``` +Download and install CMake from [CMake.org/download](https://cmake.org/download) -Run the premake with the following command line options after replacing "PREMAKE" with the result from the previous command. +Run CMake with the following command to generate a Visual Studio 2022 Solution: ``` -# For VisualStudio 2019 -C:\git\slang> PREMAKE vs2019 --deps=true --arch=x64 -# For VisualStudio 2017 -C:\git\slang> PREMAKE vs2017 --deps=true --arch=x64 +# For VisualStudio 2022 +C:\git\slang> cmake.exe --preset vs2022 ``` Open slang.sln with VisualStudio IDE and build it for "x64". +Or you can build with a following command: +``` +C:\git\slang> cmake.exe --build --preset release +``` + #### Linux -Find where the premake is and run it with gmake2 option. +Install CMake and Ninja. +``` +$ sudo apt-get install cmake ninja-build +``` + +Run CMake with a following command to generate Makefile: +``` +$ cmake --preset default +``` + +Build with a following command: ``` -$ PREMAKE="$(find external/slang-binaries/premake -type f -iname 'premake5' | grep bin/linux-64)" -$ chmod u+x "$PREMAKE" -$ "$PREMAKE" gmake2 --deps=true --arch=x64 -$ make config=release_x64 +$ cmake --build --preset release ``` ### Making Changes |
