forked from flux-framework/flux-sched
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: dockerfile updates for golang-focal for cmake
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
13 changed files
with
107 additions
and
28 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
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,15 +1,17 @@ | ||
{ | ||
"name": "Flux Sched Developer Environment", | ||
"dockerFile": "Dockerfile", | ||
"context": "../", | ||
"name": "Flux Sched Developer Environment", | ||
"dockerFile": "Dockerfile", | ||
"context": "../", | ||
|
||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash" | ||
} | ||
} | ||
"customizations": { | ||
"vscode": { | ||
"settings": { | ||
"terminal.integrated.defaultProfile.linux": "bash" | ||
}, | ||
"extensions": [ | ||
"ms-vscode.cmake-tools" | ||
] | ||
} | ||
}, | ||
"postStartCommand": "git config --global --add safe.directory /workspaces/flux-sched" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
set(CUSTOM_GO_PATH "${CMAKE_SOURCE_DIR}/resource/reapi/bindings/go") | ||
set(GOPATH "${CMAKE_CURRENT_BINARY_DIR}/go") | ||
|
||
# This probably isn't necessary, although if we could build fluxcli into it maybe | ||
file(MAKE_DIRECTORY ${GOPATH}) | ||
|
||
# GO_GET will retrieve a go module that needs to be installed | ||
function(GO_GET TARG) | ||
add_custom_target(${TARG} env GOPATH=${GOPATH} go get ${ARGN}) | ||
endfunction(GO_GET) | ||
|
||
# ADD_GO_INSTALLABLE_PROGRAM builds a custom go program (primarily for testing) | ||
function(ADD_GO_INSTALLABLE_PROGRAM NAME MAIN_SRC CGO_CFLAGS CGO_LIBRARY_FLAGS) | ||
message(STATUS "GOPATH: ${GOPATH}") | ||
message(STATUS "CGO_LDFLAGS (before): ${CGO_LIBRARY_FLAGS}") | ||
message(STATUS "TEST_FLAGS: ${TEST_FLAGS}") | ||
get_filename_component(MAIN_SRC_ABS ${MAIN_SRC} ABSOLUTE) | ||
add_custom_target(${NAME}) | ||
|
||
# string(REPLACE <match-string> <replace-string> <out-var> <input>...) | ||
STRING(REPLACE ";" " " CGO_LDFLAGS "${CGO_LIBRARY_FLAGS}") | ||
|
||
# set(ENV{<variable>} [<value>]) as environment OR without CMake variable | ||
# Note that I couldn't get this to work (the spaces are always escaped) so I hard coded for now | ||
# We need a solution that takes the CGO_LIBRARY_FLAGS arg, and can pass (with spaces not escaped) to add_custom_command | ||
SET ($ENV{CGO_LDFLAGS} "${CGO_LDFLAGS}") | ||
message(STATUS "CGO_LDFLAGS (after): ${CGO_LDFLAGS}") | ||
# SET (CMAKE_GO_FLAGS "${CGO_LDFLAGS}") | ||
|
||
add_custom_command(TARGET ${NAME} | ||
COMMAND GOPATH=${GOPATH}:${CUSTOM_GO_PATH} GOOS=linux G0111MODULE=off CGO_CFLAGS="${CGO_CFLAGS}" CGO_LDFLAGS='-L${CMAKE_BINARY_DIR}/resource/reapi/bindings -L${CMAKE_BINARY_DIR}/resource/libjobspec/ -ljobspec_conv -lreapi_cli -L${CMAKE_BINARY_DIR}/resource -lresource -lflux-idset -lstdc++ -lczmq -ljansson -lhwloc -lboost_system -lflux-hostlist -lboost_graph -lyaml-cpp' go build -ldflags '-w' | ||
-o "${CMAKE_CURRENT_SOURCE_DIR}/${NAME}" | ||
${CMAKE_GO_FLAGS} ${MAIN_SRC} | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} | ||
DEPENDS ${MAIN_SRC_ABS} | ||
COMMENT "Building Go library") | ||
foreach(DEP ${ARGN}) | ||
add_dependencies(${NAME} ${DEP}) | ||
endforeach() | ||
|
||
add_custom_target(${NAME}_all ALL DEPENDS ${NAME}) | ||
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${NAME} DESTINATION bin) | ||
endfunction(ADD_GO_INSTALLABLE_PROGRAM) |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
add_subdirectory( src ) |
4 changes: 2 additions & 2 deletions
4
...urce/reapi/bindings/go/src/fluxcli/go.mod → resource/reapi/bindings/go/go.mod
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,3 +1,3 @@ | ||
module github.com/flux-framework/flux-sched/resource/reapi/bindings/go/src/fluxcli | ||
module github.com/flux-framework/flux-sched/resource/reapi/bindings/go | ||
|
||
go 1.19 | ||
go 1.19 |
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 @@ | ||
add_subdirectory( test ) |
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,17 @@ | ||
set(TARGET main) | ||
set(SRCS main.go) | ||
set(CGO_CFLAGS "-I${CMAKE_BINARY_DIR}/resource/reapi/bindings/c") | ||
|
||
# This is currently passed but not used because when passed into add_custom_command the spaces are escaped | ||
set(CGO_LIBRARY_FLAGS "-L${CMAKE_BINARY_DIR}/resource/reapi/bindings;-lreapi_cli;-L${CMAKE_BINARY_DIR}/resource;-lresource;-lflux-idset;-lstdc++;-lczmq;-ljansson;-lhwloc;-lboost_system;-lflux-hostlist;-lboost_graph;-lyaml-cpp") | ||
|
||
# This ensures the main binary is cleaned up | ||
set_directory_properties( | ||
PROPERTIES | ||
ADDITIONAL_CLEAN_FILES "${CMAKE_CURRENT_BINARY_DIR}/main" | ||
) | ||
|
||
# GO_GET(go_redis github.com/hoisie/redis) | ||
# main main.go | ||
# We add the dependencies at the end so the build can run in parallel and we don't try to build this before they are ready! | ||
ADD_GO_INSTALLABLE_PROGRAM(${TARGET} ${SRCS} "${CGO_CFLAGS}" "${CGO_LIBRARY_FLAGS}" jobspec_conv reapi_module reapi_cli resource flux::core) |
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
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