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

refactor build scripts #3

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion hello_cxx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)
project(Hello)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
find_package(Julia REQUIRED)

add_executable(hello hello.cpp)
Expand Down
9 changes: 9 additions & 0 deletions hello_gcc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cmake_minimum_required(VERSION 3.20)
project(Hello LANGUAGES C)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
find_package(Julia REQUIRED)

add_executable(hello main.c)
target_include_directories(hello PUBLIC ${Julia_INCLUDE_DIRS})
target_link_libraries(hello ${Julia_LIBRARY})
7 changes: 4 additions & 3 deletions hello_gcc/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
JULIA_DIR=`julia -e 'print(dirname(Sys.BINDIR))'`
g++ -fPIC -I$JULIA_DIR/include/julia -L$JULIA_DIR/lib -Wl,-rpath,$JULIA_DIR/lib main.c -ljulia
./a.out
# Get Julia installation paths
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Release
cmake --build ./build --config Release -j `nproc`
./build/hello
Loading