diff --git a/.github/workflows/build-windows-mingw-tests.yml b/.github/workflows/build-windows-mingw-tests.yml index 046df776b..5de338b54 100644 --- a/.github/workflows/build-windows-mingw-tests.yml +++ b/.github/workflows/build-windows-mingw-tests.yml @@ -30,7 +30,7 @@ jobs: - name: Generate Project Makefiles run: | md build && cd build - cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DENIGMA_ENABLE_TESTS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ + cmake .. -G"Unix Makefiles" -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=Release -DENIGMA_ENABLE_TESTS=ON -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ - name: Build Enigma Tests run: cd build && make EnigmaTests -j%NUMBER_OF_PROCESSORS% diff --git a/.github/workflows/build-windows-mingw.yml b/.github/workflows/build-windows-mingw.yml index 6b700e64c..9d61be8ea 100644 --- a/.github/workflows/build-windows-mingw.yml +++ b/.github/workflows/build-windows-mingw.yml @@ -31,7 +31,7 @@ jobs: - name: Generate Project Makefiles run: | md build && cd build - cmake .. -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DENIGMA_ENABLE_TESTS=OFF -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ + cmake .. -G"Unix Makefiles" -DCMAKE_GENERATOR_PLATFORM=x64 -DCMAKE_BUILD_TYPE=Release -DENIGMA_ENABLE_TESTS=OFF -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ - name: Build Enigma run: cd build && make -j%NUMBER_OF_PROCESSORS% diff --git a/CMakeLists.txt b/CMakeLists.txt index a2744cd78..3b7f20a4c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,19 +6,6 @@ option(ENIGMA_ENABLE_TESTS "Enable/Disable building of tests" OFF) option(ENIGMA_BUILD_DOCS "Build Doxygen API documentation" OFF) ##################################################### -################# Force x64 arch ########################### -if(CMAKE_SYSTEM_NAME STREQUAL "Windows") - # No need to add compile options for Visual Studio, it's handled by the generator platform - if(CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMAKE_GENERATOR_PLATFORM "x64" CACHE STRING "" FORCE) - else() - add_compile_options(/machine:x64) - endif() -elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Darwin") - add_compile_options(-m64) -endif() -##################################################### - ###### Doxygen Documentation ###### if (ENIGMA_BUILD_DOCS) message(STATUS "Building Doxygen docs is enabled") diff --git a/cmake/install.cmake b/cmake/install.cmake index 51691d4c3..ae734ab13 100644 --- a/cmake/install.cmake +++ b/cmake/install.cmake @@ -17,30 +17,46 @@ include(GNUInstallDirs) # Determine the installation directories -if(WIN32) +if (WIN32) set(INSTALL_BASE_DIR "$ENV{ProgramFiles}/Enigma") -else() +else () # Get the user's home directory - if(NOT DEFINED ENV{HOME}) + if (NOT DEFINED ENV{HOME}) message(FATAL_ERROR "The HOME environment variable is not defined.") - endif() + endif () set(USER_DOT_LOCAL_DIR "$ENV{HOME}/.local") set(INSTALL_BASE_DIR "$ENV{HOME}/Enigma") -endif() +endif () # Install the executable to /home/$(whoami)/Enigma/Enigma install(TARGETS Enigma RUNTIME DESTINATION ${INSTALL_BASE_DIR}) # Install res files to /home/$(whoami)/Enigma/res +#install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/ +# DESTINATION ${INSTALL_BASE_DIR}/res +# FILES_MATCHING PATTERN "*") + +# Install other resource files install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/res/ DESTINATION ${INSTALL_BASE_DIR}/res - FILES_MATCHING PATTERN "*") + FILES_MATCHING PATTERN "*" + PATTERN "Enigma.db" EXCLUDE) # Exclude Enigma.db database from this install command, +# we don't want to overwrite user's data on an update +# Check if Enigma.db exists and install it if it doesn't +install(CODE " + if(NOT EXISTS \"${INSTALL_BASE_DIR}/res/database/Enigma.db\") + message(STATUS \"Enigma.db is missing. Installing it from repository's resources...\") + file(COPY \"${CMAKE_CURRENT_SOURCE_DIR}/res/database/Enigma.db\" DESTINATION \"${INSTALL_BASE_DIR}/res/database\") + else() + message(STATUS \"Enigma.db already exists. Skipping.\") + endif() +") # Install .desktop file to /home/$(whoami)/Enigma/Enigma.desktop -if(UNIX AND NOT APPLE) - # Create the .desktop file content +if (UNIX AND NOT APPLE) + # Create the .desktop file content file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/Enigma.desktop" -"[Desktop Entry] + "[Desktop Entry] Type=Application Name=${PROJECT_NAME} Version=${PROJECT_VERSION} @@ -56,4 +72,4 @@ Terminal=false" elseif (WIN32) # TODO create a shortcut of the app in windows -endif() +endif ()