-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from tmmsartor/main
Various updates
- Loading branch information
Showing
16 changed files
with
982 additions
and
602 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
name: build | ||
|
||
on: [push, pull_request] | ||
permissions: write-all | ||
|
||
on: push | ||
|
||
jobs: | ||
build: | ||
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} | ||
runs-on: ${{ matrix.os }} | ||
timeout-minutes: 60 | ||
permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created | ||
actions: write | ||
contents: read | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: | ||
- '1.10' | ||
- '1.10.4' | ||
os: | ||
- windows-2022 | ||
- ubuntu-20.04 | ||
#- macos-11 | ||
- macos-12 | ||
- macos-14 | ||
arch: | ||
- x64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: ${{ matrix.version }} | ||
|
@@ -33,22 +35,26 @@ jobs: | |
julia --startup-file=no --project=compiler -e 'using Pkg; Pkg.instantiate()' | ||
julia --startup-file=no --project=compiler compiler/build.jl foo | ||
# Upload as release asset | ||
- uses: vimtor/[email protected] | ||
#- uses: vimtor/[email protected] | ||
# with: | ||
# files: foo/ | ||
# recursive: true | ||
# dest: foo.zip | ||
- name: zip_with_symlinks | ||
run: | | ||
zip --symlinks -r foo.zip foo/ | ||
- uses: actions/[email protected] | ||
with: | ||
files: foo/ | ||
recursive: true | ||
dest: foo.zip | ||
name: madnlp-jl${{ matrix.version}}-${{ matrix.os }}-${{ matrix.arch }} | ||
path: foo.zip | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
- name: Upload files to a GitHub release | ||
uses: svenstaro/[email protected] | ||
with: | ||
overwrite: true | ||
tag: v0.1 | ||
tag: nightly-${{ env.GITHUB_REF_SLUG }} | ||
file: foo.zip | ||
asset_name: madnlp-jl${{ matrix.version}}-${{ matrix.os }}-${{ matrix.arch }}.zip | ||
prerelease: true | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
name: madnlp-jl${{ matrix.version}}-${{ matrix.os }}-${{ matrix.arch }} | ||
path: foo | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
build/ | ||
.ccls-cache | ||
compile_commands.json | ||
.*.sw[a-z] | ||
target/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "MadNLP.jl"] | ||
path = MadNLP.jl | ||
url = https://github.com/tmmsartor/MadNLP.jl.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,91 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(MadNLP_C VERSION 1.0.0) # Adjust the version as necessary | ||
project(MadNLP_C VERSION 0.1.0) # Adjust the version as necessary | ||
|
||
set(Julia_EXECUTABLE julia) | ||
message(CHECK_START "Check Julia Executable") | ||
set(JULIA_EXECUTABLE "julia" CACHE STRING "Julia executable default") | ||
if (JULIA_EXECUTABLE STREQUAL "julia") | ||
execute_process( | ||
COMMAND which julia | ||
OUTPUT_STRIP_TRAILING_WHITESPACE | ||
OUTPUT_VARIABLE JULIA_EXECUTABLE_PARSED | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
set(JULIA_EXECUTABLE ${JULIA_EXECUTABLE_PARSED} CACHE STRING "Julia executable" FORCE) | ||
endif() | ||
message(CHECK_PASS ${JULIA_EXECUTABLE}) | ||
|
||
message(CHECK_START "Check Julia binary dir") | ||
set(JULIA_BIN_DIR "nd" CACHE STRING "Julia runtime binary dir default") | ||
if (JULIA_BIN_DIR STREQUAL "nd") | ||
execute_process( | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no -e "print(dirname(Sys.BINDIR))" | ||
OUTPUT_VARIABLE JULIA_BIN_DIR_PARSED | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
set(JULIA_BIN_DIR ${JULIA_BIN_DIR_PARSED} CACHE STRING "Julia runtime binary dir" FORCE) | ||
endif() | ||
message(CHECK_PASS ${JULIA_BIN_DIR}) | ||
|
||
message(CHECK_START "Check MadNLP.jl version") | ||
set(MADNLP_VERSION "nd" CACHE STRING "MadNLP Julia Library Version") | ||
if (MADNLP_VERSION STREQUAL "nd") | ||
execute_process( | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ -e "using Pkg; Pkg.instantiate();m=Pkg.dependencies();v=m[findfirst(v->v.name==\"MadNLP\",m)].version; print(v);" | ||
OUTPUT_VARIABLE MADNLP_VERSION_PARSED | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
set(MADNLP_VERSION ${MADNLP_VERSION_PARSED} CACHE STRING "MadNLP Julia Library Version" FORCE) | ||
endif() | ||
message(CHECK_PASS ${MADNLP_VERSION}) | ||
|
||
set(MADNLP_C_FULLNAME madnlp_c-${MADNLP_VERSION}-${PROJECT_VERSION}) | ||
set(BUILD_SCRIPT ${PROJECT_SOURCE_DIR}/compiler/build.jl) | ||
|
||
add_custom_command( | ||
OUTPUT FOO | ||
COMMAND ${Julia_EXECUTABLE} --startup-file=no --project=compiler -e "using Pkg; Pkg.instantiate()" | ||
OUTPUT ${PROJECT_BINARY_DIR}/MadNLP_env_status.txt | ||
DEPENDS ${PROJECT_SOURCE_DIR}/Manifest.toml | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ -e "using Pkg; Pkg.instantiate()" | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ -e "using Pkg; Pkg.status()" > ${PROJECT_BINARY_DIR}/MadNLP_env_status.txt | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMENT "Instantiating Julia packages" | ||
COMMENT "Instantiate Julia packages" | ||
VERBATIM | ||
) | ||
|
||
add_custom_command( | ||
OUTPUT ${PROJECT_BINARY_DIR}/MadNLP_C_parses.txt | ||
DEPENDS ${PROJECT_SOURCE_DIR}/Manifest.toml | ||
DEPENDS ${PROJECT_BINARY_DIR}/MadNLP_env_status.txt | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=./ compiler/generate_precompile.jl > ${PROJECT_BINARY_DIR}/MadNLP_C_parses.txt | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMENT "Parses Julia packages" | ||
VERBATIM | ||
) | ||
|
||
add_custom_command( | ||
OUTPUT ${PROJECT_BINARY_DIR}/PackageCompiler_env_status.txt | ||
DEPENDS ${PROJECT_BINARY_DIR}/MadNLP_C_parses.txt | ||
DEPENDS ${PROJECT_SOURCE_DIR}/compiler/Manifest.toml | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=compiler -e "using Pkg; Pkg.instantiate()" | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=compiler -e "using Pkg; Pkg.status()" > ${PROJECT_BINARY_DIR}/PackageCompiler_env_status.txt | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMENT "Instantiate Julia build packages" | ||
VERBATIM | ||
) | ||
|
||
add_custom_command( | ||
OUTPUT ${PROJECT_BINARY_DIR}/library_precompilation_dummy.txt | ||
DEPENDS ${PROJECT_BINARY_DIR}/PackageCompiler_env_status.txt | ||
DEPENDS ${PROJECT_SOURCE_DIR}/src/MadNLP_C.jl | ||
DEPENDS ${PROJECT_SOURCE_DIR}/compiler/build.jl | ||
DEPENDS ${PROJECT_SOURCE_DIR}/compiler/generate_precompile.jl | ||
DEPENDS ${PROJECT_SOURCE_DIR}/.git/modules/MadNLP.jl/HEAD | ||
COMMAND echo 1 > ${PROJECT_BINARY_DIR}/library_precompilation_dummy.txt | ||
COMMAND ${JULIA_EXECUTABLE} --startup-file=no --project=compiler ${BUILD_SCRIPT} ${PROJECT_BINARY_DIR}/${MADNLP_C_FULLNAME} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
COMMENT "Create Madnlp precompiled library sysimage" | ||
VERBATIM | ||
) | ||
|
||
add_custom_target(madnlp_c ALL | ||
DEPENDS ${PROJECT_BINARY_DIR}/library_precompilation_dummy.txt | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
Project.toml is manually created | ||
Manifest.toml is generated automatically from | ||
julia> using Pkg | ||
julia> Pkg.activate(".") | ||
julia> Pkg.instantiate() | ||
|
||
|
||
something similar in compiler | ||
|
||
|
||
julia --startup-file=no --project=compiler compiler/build.jl foo | ||
``` | ||
julia --startup-file=no --project=. -e "using Pkg; Pkg.instantiate()" | ||
julia --startup-file=no --project=compiler -e "using Pkg; Pkg.instantiate()" | ||
julia --startup-file=no --project=compiler compiler/build.jl target/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.