-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* better cmake usage * update CMakeLists.txt * update lgtm.yml * update lgtm.yml * update lgtm.yml * update lgtm.yml * update travis and cmakelists.txt
- Loading branch information
Showing
10 changed files
with
118 additions
and
60 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
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,73 +1,76 @@ | ||
add_executable(nephtys_client) | ||
################################### nephtys_client_shared_deps | ||
add_library(nephtys_client_shared_deps INTERFACE) | ||
|
||
set(nephtys_client_sources | ||
target_link_libraries(nephtys_client_shared_deps INTERFACE | ||
CONAN_PKG::sfml CONAN_PKG::entt CONAN_PKG::jsonformoderncpp CONAN_PKG::doom_strong_types | ||
$<$<CXX_COMPILER_ID:GNU>:-static-libstdc++> | ||
$<$<CXX_COMPILER_ID:GNU>:stdc++fs> | ||
$<$<CXX_COMPILER_ID:Clang>:>) | ||
target_sources(nephtys_client_shared_deps INTERFACE | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/config/config.cpp | ||
$<$<PLATFORM_ID:Linux>:${CMAKE_CURRENT_SOURCE_DIR}/src/resources/details/linux/app_image_real_path.cpp> | ||
) | ||
$<$<PLATFORM_ID:Linux>:${CMAKE_CURRENT_SOURCE_DIR}/src/resources/details/linux/app_image_real_path.cpp>) | ||
|
||
target_sources(nephtys_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp ${nephtys_client_sources}) | ||
target_compile_options(nephtys_client PUBLIC | ||
target_compile_options(nephtys_client_shared_deps INTERFACE | ||
$<$<AND:$<CONFIG:Release>,$<CXX_COMPILER_ID:Clang>>:-O2 -march=native -Wall -Wextra -Wfatal-errors> | ||
$<$<AND:$<CONFIG:Release>,$<CXX_COMPILER_ID:GNU>>:-O2 -march=native -Wall -Wextra -Wfatal-errors> | ||
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:GNU>>:-O0 -g -Wall -Wextra -Wfatal-errors> | ||
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:Clang>>:-O0 -g -Wall -Wextra -Wfatal-errors> | ||
$<$<AND:$<CONFIG:Debug>,$<CXX_COMPILER_ID:MSVC>>:/Zi /FS /DEBUG /Od /MP /MDd /Oy- /W4 /permissive- /std:c++latest> | ||
$<$<AND:$<CONFIG:Release>,$<CXX_COMPILER_ID:MSVC>>:/O2 -DNDEBUG /MP /W4 /permissive- /std:c++latest>) | ||
target_link_libraries(nephtys_client PRIVATE CONAN_PKG::sfml CONAN_PKG::entt CONAN_PKG::jsonformoderncpp CONAN_PKG::doom_strong_types | ||
$<$<CXX_COMPILER_ID:GNU>:-static> | ||
$<$<CXX_COMPILER_ID:GNU>:stdc++fs> | ||
$<$<CXX_COMPILER_ID:Clang>:>) | ||
target_include_directories(nephtys_client PRIVATE | ||
|
||
target_include_directories(nephtys_client_shared_deps INTERFACE | ||
${CMAKE_CURRENT_SOURCE_DIR}/include | ||
${PROJECT_SOURCE_DIR}/common/include) | ||
|
||
##Properties | ||
get_target_property(nephtys_client_libraries nephtys_client LINK_LIBRARIES) | ||
get_target_property(nephtys_client_output_directory nephtys_client RUNTIME_OUTPUT_DIRECTORY) | ||
get_target_property(nephtys_client_include_directories nephtys_client INCLUDE_DIRECTORIES) | ||
if (USE_ASAN) | ||
message("-- ASAN Enabled, Configuring...") | ||
target_compile_options(nephtys_client_shared_deps INTERFACE | ||
$<$<AND:$<CONFIG:Debug>,$<NOT:$<CXX_COMPILER_ID:MSVC>>>:-fsanitize=address -fno-omit-frame-pointer>) | ||
target_link_options(nephtys_client_shared_deps INTERFACE | ||
$<$<AND:$<CONFIG:Debug>,$<NOT:$<CXX_COMPILER_ID:MSVC>>>:-fsanitize=address -fno-omit-frame-pointer>) | ||
endif () | ||
|
||
################################### nephtys_client | ||
add_executable(nephtys_client) | ||
target_sources(nephtys_client PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp) | ||
target_link_libraries(nephtys_client PRIVATE nephtys_client_shared_deps) | ||
if (LINUX) | ||
get_target_property(nephtys_client_runtime_directory nephtys_client RUNTIME_OUTPUT_DIRECTORY) | ||
set_target_properties(nephtys_client PROPERTIES | ||
RUNTIME_OUTPUT_DIRECTORY ${nephtys_client_runtime_directory}/AppDir/usr/bin | ||
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${nephtys_client_runtime_directory}/AppDir/usr/bin | ||
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${nephtys_client_runtime_directory}/AppDir/usr/bin) | ||
message("runtime_directory nephtys_client: ${nephtys_client_runtime_directory}") | ||
|
||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/assets/config/game_config.json | ||
${nephtys_client_runtime_directory}/AppDir/usr/share/assets/config/game_config.json COPYONLY) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/linux/org.nephtys.client.desktop | ||
${nephtys_client_runtime_directory}/AppDir/usr/share/applications/org.nephtys.client.desktop COPYONLY) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/linux/org.nephtys.client.appdata.xml | ||
${nephtys_client_runtime_directory}/AppDir/usr/share/metainfo/org.nephtys.client.appdata.xml COPYONLY) | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/data/linux/nephtys_icon.png | ||
${nephtys_client_runtime_directory}/AppDir/usr/share/icons/hicolor/128x128/nephtys_icon.png COPYONLY) | ||
if (AUTO_BUILD_APPIMAGE) | ||
add_custom_command(TARGET nephtys_client | ||
POST_BUILD COMMAND | ||
bash -c | ||
"${PROJECT_SOURCE_DIR}/tools/linux/linuxdeploy-x86_64.AppImage --appdir ${nephtys_client_runtime_directory}/AppDir --output appimage" | ||
$<TARGET_FILE:nephtys_client> | ||
WORKING_DIRECTORY ${nephtys_client_runtime_directory}) | ||
endif () | ||
endif () | ||
######################################################################## | ||
|
||
##! Test | ||
add_executable(nephtys-client-test) | ||
target_sources(nephtys-client-test PUBLIC | ||
${nephtys_client_sources} | ||
${CMAKE_CURRENT_SOURCE_DIR}/test/test_client.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/src/config/config.test.cpp | ||
$<$<PLATFORM_ID:Linux>:${CMAKE_CURRENT_SOURCE_DIR}/src/resources/details/linux/app_image_real_path.test.cpp>) | ||
target_link_libraries(nephtys-client-test PRIVATE CONAN_PKG::doctest ${nephtys_client_libraries}) | ||
target_include_directories(nephtys-client-test PRIVATE ${nephtys_client_include_directories}) | ||
$<$<PLATFORM_ID:Linux>:${CMAKE_CURRENT_SOURCE_DIR}/src/resources/details/linux/app_image_real_path.test.cpp> | ||
) | ||
target_link_libraries(nephtys-client-test PRIVATE CONAN_PKG::doctest PRIVATE nephtys_client_shared_deps) | ||
|
||
if (NEPHTYS_COVERAGE) | ||
target_compile_options(nephtys-client-test PUBLIC --coverage -fprofile-arcs -ftest-coverage) | ||
target_link_options(nephtys-client-test PUBLIC --coverage -fprofile-arcs -ftest-coverage) | ||
endif () | ||
|
||
##! Config file | ||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/assets/config/game_config.json | ||
${nephtys_client_output_directory}/share/assets/config/game_config.json COPYONLY) | ||
|
||
if (LINUX) | ||
##! Install | ||
install(TARGETS | ||
nephtys_client | ||
DESTINATION bin | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/org.nephtys.client.desktop | ||
DESTINATION share/applications/ | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/org.nephtys.client.appdata.xml | ||
DESTINATION share/metainfo/ | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/config/game_config.json | ||
DESTINATION share/assets/config/ | ||
) | ||
|
||
install( | ||
FILES ${CMAKE_CURRENT_SOURCE_DIR}/assets/nephtys_icon.png | ||
DESTINATION share/icons/hicolor/128x128/apps | ||
) | ||
endif () |
File renamed without changes
File renamed without changes.
File renamed without changes.
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,46 @@ | ||
macro(download_app_image) | ||
if (LINUX) | ||
## We need appimage | ||
if (NOT EXISTS ${PROJECT_SOURCE_DIR}/tools/linux/linuxdeploy-x86_64.AppImage) | ||
file(DOWNLOAD | ||
https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | ||
${PROJECT_SOURCE_DIR}/tools/linuxdeploy-x86_64.AppImage | ||
SHOW_PROGRESS | ||
) | ||
endif () | ||
if (EXISTS ${PROJECT_SOURCE_DIR}/tools/linuxdeploy-x86_64.AppImage) | ||
file(COPY | ||
${PROJECT_SOURCE_DIR}/tools/linuxdeploy-x86_64.AppImage DESTINATION | ||
${PROJECT_SOURCE_DIR}/tools/linux/ | ||
FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ) | ||
endif () | ||
if (EXISTS ${PROJECT_SOURCE_DIR}/tools/linuxdeploy-x86_64.AppImage) | ||
file(REMOVE ${PROJECT_SOURCE_DIR}/tools/linuxdeploy-x86_64.AppImage) | ||
endif () | ||
endif () | ||
endmacro() | ||
|
||
macro(init_env) | ||
if (UNIX AND NOT APPLE) | ||
set(LINUX TRUE) | ||
endif () | ||
endmacro() | ||
|
||
macro(exec_conan) | ||
if (NOT EXISTS conanbuildinfo.cmake) | ||
message("Conan need to be executed") | ||
execute_process(COMMAND conan install ../ | ||
RESULT_VARIABLE CMD_ERROR | ||
OUTPUT_FILE CMD_OUTPUT) | ||
MESSAGE( STATUS "CMD_ERROR:" ${CMD_ERROR}) | ||
MESSAGE( STATUS "CMD_OUTPUT:" ${CMD_OUTPUT}) | ||
else () | ||
message("Conan doesn't need to be executed") | ||
endif () | ||
endmacro() | ||
|
||
macro(init_nephtys) | ||
init_env() | ||
exec_conan() | ||
download_app_image() | ||
endmacro() |
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -rf tools cmake-build-* appimage_build deploy_linux |
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