Skip to content

Commit

Permalink
made cmake build type release
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemapfel committed Mar 8, 2022
1 parent af508c9 commit 206b462
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/libjluna*.so
/libjluna_c_adapter*.so
/libjluna*.*
/libjluna_c_adapter*.*
/.src/include_julia.inl
/.benchmark/results/
/docs/bckp.txt
Expand Down
44 changes: 40 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16)
project(jluna)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_BUILD_TYPE Release)

# compiler support
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION STRGREATER_EQUAL "12.0.0")
Expand Down Expand Up @@ -131,13 +131,21 @@ add_library(jluna_c_adapter SHARED
.src/c_adapter.cpp
)

target_include_directories(jluna_c_adapter
PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}>
# users should include julia on their own
PUBLIC $<BUILD_INTERFACE:${JULIA_INCLUDE}>
)

target_compile_features(jluna_c_adapter PUBLIC cxx_std_20)
target_link_libraries(jluna_c_adapter PUBLIC $<BUILD_INTERFACE:${JULIA_LIB}>)

set_target_properties(jluna_c_adapter PROPERTIES
LINKER_LANGUAGE C
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}
)

target_link_libraries(jluna_c_adapter ${JULIA_LIB})
target_link_libraries(jluna jluna_c_adapter ${JULIA_LIB})
target_link_libraries(jluna PUBLIC jluna_c_adapter)

### EXECUTABLES ###

Expand All @@ -151,4 +159,32 @@ target_link_libraries(JLUNA_TEST jluna ${JULIA_LIB})
# .benchmark/main.cpp
# .benchmark/benchmark.hpp
#)
#target_link_libraries(JLUNA_BENCHMARK jluna ${JULIA_LIB})
#target_link_libraries(JLUNA_BENCHMARK jluna ${JULIA_LIB})

### INSTALL ###

# TODO: ConfigVersion.cmake
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/jluna-config.cmake [[
if (NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION STRGREATER_EQUAL "12.0.0") OR (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION STRGREATER_EQUAL "10.0.0")))
message(FATAL_ERROR "Currently, the only supported compilers are G++10, G++11 (recommended) and Clang-12")
endif()
include("${CMAKE_CURRENT_LIST_DIR}/jluna-targets.cmake")
]])

install(FILES
${CMAKE_CURRENT_BINARY_DIR}/jluna-config.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jluna
)

install(TARGETS jluna jluna_c_adapter EXPORT jluna_targets)

install(EXPORT jluna_targets
FILE jluna-targets.cmake
NAMESPACE jluna::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/jluna
)

install(FILES jluna.hpp ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jluna)
install(DIRECTORY include .src DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/jluna)

target_include_directories(jluna INTERFACE $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/jluna>)

0 comments on commit 206b462

Please sign in to comment.