diff --git a/.github/actions/test-khiops-install/action.yml b/.github/actions/test-khiops-install/action.yml new file mode 100644 index 000000000..a44d7c275 --- /dev/null +++ b/.github/actions/test-khiops-install/action.yml @@ -0,0 +1,72 @@ +--- +name: Test Khiops Installation +description: Tests a Khiops installation on the Iris dataset +runs: + using: composite + steps: + # Python install: we don't use the setup-python action because of the following error: + # python3: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by python3) + - name: Python setup for Linux + if: runner.os == 'Linux' + shell: bash + run: | + if [ -d "/etc/apt" ] + then + apt-get install -y python3 > /dev/null + else + yum install -y python3.11 + fi + echo "PYTHON=python3" >> "$GITHUB_ENV" + - name: Python setup for Windows or macOS + if: runner.os == 'Windows' || runner.os == 'macOS' + shell: bash + run: echo "PYTHON=python" >> "$GITHUB_ENV" + - name: Set the name for the khiops laucher script + shell: bash + run: | + if [[ $RUNNER_OS == "Windows" ]] + then + # Put the full path in windows since bash doesn't find ".cmd" files + # in the path even if they are there + modl_path=$(which MODL) + khiops_bin_dir=$(dirname "$modl_path") + KHIOPS_SCRIPT="$khiops_bin_dir/khiops.cmd" + KHIOPS_CC_SCRIPT="$khiops_bin_dir/khiops_coclustering.cmd" + echo "KHIOPS_SCRIPT=$KHIOPS_SCRIPT" >> "$GITHUB_ENV" + echo "KHIOPS_CC_SCRIPT=$KHIOPS_CC_SCRIPT" >> "$GITHUB_ENV" + else + echo "KHIOPS_SCRIPT=khiops" >> "$GITHUB_ENV" + echo "KHIOPS_CC_SCRIPT=khiops_coclustering" >> "$GITHUB_ENV" + fi + - name: Check Khiops installation + shell: bash + run: | + "$KHIOPS_SCRIPT" -v + "$KHIOPS_CC_SCRIPT" -v + - name: Run Khiops tests + shell: bash + run: | + cd test/LearningTest/TestKhiops/Standard/Iris/ + "$KHIOPS_SCRIPT" -b -i test.prm -e results/err.txt + cd - + - name: Run Khiops Coclustering tests + shell: bash + run: | + cd test/LearningTest/TestCoclustering/Standard/Iris/ + "$KHIOPS_CC_SCRIPT" -b -i test.prm -e results/err.txt + cd - + - name: Check the test results + shell: bash + run: |- + touch test/LearningTest/TestCoclustering/Standard/Iris/results/time.log + touch test/LearningTest/TestKhiops/Standard/Iris/results/time.log + echo "Check test results" + cd test/LearningTest/cmd/python/ + $PYTHON test_khiops.py Khiops nul Standard + $PYTHON test_khiops.py Coclustering nul Standard + $PYTHON apply_command.py errors ../../TestKhiops/Standard/ Iris | tee /tmp/khiops-log.txt + $PYTHON apply_command.py errors ../../TestCoclustering/Standard/ Iris | tee /tmp/coclustering-log.txt + if (grep -q error /tmp/khiops-log.txt || grep -q error /tmp/coclustering-log.txt); then + echo "::error::Errors in Khiops run" + false + fi diff --git a/.github/actions/test-khiops/action.yml b/.github/actions/test-khiops/action.yml deleted file mode 100644 index ca8b71e02..000000000 --- a/.github/actions/test-khiops/action.yml +++ /dev/null @@ -1,51 +0,0 @@ ---- -name: Test Khiops package -description: Action to test Khiops package on iris dataset -runs: - using: composite - steps: - - name: Check Khiops installation - shell: bash - run: | - khiops -v - khiops_coclustering -v - - name: Run Khiops tests - shell: bash - run: | - cd test/LearningTest/TestKhiops/Standard/Iris/ - khiops -b -i test.prm -e results/err.txt - cd - - - name: Run Khiops Coclustering tests - shell: bash - run: | - cd test/LearningTest/TestCoclustering/Standard/Iris/ - khiops_coclustering -b -i test.prm -e results/err.txt - cd - - # Installation of python, we don't use the setup-python action because whe have the error: - # python3: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by python3) - - name: Setup python - shell: bash - run: | - if [ "$RUNNER_OS" == "Linux" ] - then - if [ -d "/etc/apt" ] - then - apt-get install -y python3 > /dev/null - else - yum install -y python3.11 - fi - fi - - name: Check results - shell: bash - run: |- - touch test/LearningTest/TestCoclustering/Standard/Iris/results/time.log - touch test/LearningTest/TestKhiops/Standard/Iris/results/time.log - cd test/LearningTest/cmd/python/ - python3 test_khiops.py Khiops nul Standard - python3 test_khiops.py Coclustering nul Standard - python3 apply_command.py errors ../../TestKhiops/Standard/ Iris | tee /tmp/khiops-log.txt - python3 apply_command.py errors ../../TestCoclustering/Standard/ Iris | tee /tmp/coclustering-log.txt - if (grep -q error /tmp/khiops-log.txt || grep -q error /tmp/coclustering-log.txt); then - echo "::error::Errors in Khiops run" - false - fi diff --git a/.github/workflows/build-containers.yml b/.github/workflows/build-linux-pack-containers.yml similarity index 72% rename from .github/workflows/build-containers.yml rename to .github/workflows/build-linux-pack-containers.yml index 68c2195aa..a52b160ea 100644 --- a/.github/workflows/build-containers.yml +++ b/.github/workflows/build-linux-pack-containers.yml @@ -1,9 +1,9 @@ --- -name: Build development containers +name: Build Linux containers for packaging on: workflow_dispatch: jobs: - build-container: + build-packaging-container: runs-on: ubuntu-latest strategy: fail-fast: false @@ -24,13 +24,11 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build the image and push it to the registry + id: docker-build uses: docker/build-push-action@v2 with: - # relative path to the place where source code with Dockerfile is located - context: ./packaging/dockerfiles - file: ./packaging/dockerfiles/Dockerfile.${{ matrix.os }} - # Note: tags must be lower-case + file: ./packaging/dockerfiles/linux/Dockerfile.${{ matrix.os }} tags: ghcr.io/khiopsml/khiops/khiopsdev-${{ matrix.os }}:latest push: true - name: Display the image digest - run: echo ${{ steps.docker_build.outputs.digest }} + run: echo ${{ steps.docker-build.outputs.digest }} diff --git a/.github/workflows/pack-debian.yml b/.github/workflows/pack-debian.yml index 58eb8c6e7..deb9dc467 100644 --- a/.github/workflows/pack-debian.yml +++ b/.github/workflows/pack-debian.yml @@ -2,6 +2,8 @@ name: Create Debian package on: workflow_dispatch: + pull_request: + paths: ['**CMakeLists.txt', '**.cmake'] jobs: build-deb-package: runs-on: ubuntu-latest @@ -24,7 +26,7 @@ jobs: echo "VERSION_CODENAME=$VERSION_CODENAME" >> "$GITHUB_ENV" - name: Configure CMake run: | - cmake --preset linux-gcc-release -DTESTING=OFF + cmake --preset linux-gcc-release -DBUILD_JARS=ON - name: Build Khiops binaries run: | cmake --build --preset linux-gcc-release --parallel \ @@ -90,8 +92,8 @@ jobs: run: | khiops -v khiops_coclustering -v - - name: Test Khiops and Khiops Coclustering - uses: ./.github/actions/test-khiops + - name: Test Khiops installation + uses: ./.github/actions/test-khiops-install test-kni-deb: needs: build-deb-package runs-on: ubuntu-latest diff --git a/.github/workflows/pack-macos.yml b/.github/workflows/pack-macos.yml index a0fe1cc1f..87a1228f6 100644 --- a/.github/workflows/pack-macos.yml +++ b/.github/workflows/pack-macos.yml @@ -15,7 +15,6 @@ jobs: with: preset-name: ${{env.PRESET_NAME}} targets: MODL MODL_Coclustering KhiopsNativeInterface - override-flags: -DBUILD_JARS=OFF -DTESTING=OFF - name: Build package with CPack run: cd build/${{env.PRESET_NAME}} && cpack -G ZIP - name: Upload artifacts diff --git a/.github/workflows/pack-nsis.yml b/.github/workflows/pack-nsis.yml new file mode 100644 index 000000000..48bb34b14 --- /dev/null +++ b/.github/workflows/pack-nsis.yml @@ -0,0 +1,112 @@ +--- +name: Build NSIS Windows installer +on: + workflow_dispatch: + pull_request: + paths: + - '**CMakeLists.txt' + - packaging/windows/nsis/*.nsh + - packaging/windows/nsis/*.nsi + push: + tags: [v*] +jobs: + build-nsis-installer: + outputs: + khiops-package-version: ${{ steps.get-version.outputs.khiops-package-version }} + name: Build NSIS Windows installer + runs-on: windows-latest + steps: + - name: Obtain checkout ref + shell: bash + run: | + # We take the "pull request head" ref (by default it is a merged one) + if [[ "${{ github.event_name }}" == "pull_request" ]] + then + CHECKOUT_REF="${{ github.event.pull_request.head.sha }}" + # Otherwise the default checkout action ref + else + CHECKOUT_REF="${{ github.ref_name }}" + fi + echo "CHECKOUT_REF=$CHECKOUT_REF" >> $GITHUB_ENV + echo "Checkout ref: $CHECKOUT_REF" + - name: Checkout sources + uses: actions/checkout@v4.1.0 + with: + ref: ${{ env.CHECKOUT_REF }} + - name: Put the package version on the environment and output + id: get-version + shell: bash + run: | + # Build the versions + KHIOPS_PACKAGE_VERSION="$(./scripts/khiops-package-version ${{ env.CHECKOUT_REF }})" + KHIOPS_PACKAGE_REDUCED_VERSION="$(echo $KHIOPS_PACKAGE_VERSION | cut -d'-' -f1)" + echo "KHIOPS_PACKAGE_VERSION=$KHIOPS_PACKAGE_VERSION" >> "$GITHUB_ENV" + echo "KHIOPS_PACKAGE_REDUCED_VERSION=$KHIOPS_PACKAGE_REDUCED_VERSION" >> "$GITHUB_ENV" + echo "khiops-package-version=$KHIOPS_PACKAGE_VERSION" >> "$GITHUB_OUTPUT" + - name: Download Windows install assets + uses: robinraju/release-downloader@v1.8 + with: + repository: khiopsml/khiops-win-install-assets + latest: true + - name: Extract Windows installer assets and load assets-info.env + shell: bash + run: | + assets_tar_gz=$(ls khiops-win-install-assets*.tar.gz) + tar -zxvf "$assets_tar_gz" + cat assets/assets-info.env >> "$GITHUB_ENV" + - name: Build Khiops binaries + uses: ./.github/actions/build-khiops + with: + preset-name: windows-msvc-release + targets: MODL MODL_Coclustering norm_jar khiops_jar + override-flags: -DTESTING=OFF -DBUILD_JARS=ON + - name: Build NSIS package + shell: pwsh + run: |- + cd ./packaging/windows/nsis + makensis ` + /DKHIOPS_VERSION=${{ env.KHIOPS_PACKAGE_VERSION }} ` + /DKHIOPS_REDUCED_VERSION=${{ env.KHIOPS_PACKAGE_REDUCED_VERSION }} ` + /DKHIOPS_WINDOWS_BUILD_DIR=..\..\..\build\windows-msvc-release ` + /DJRE_INSTALLER_PATH=..\..\..\assets\${{ env.JRE_FILENAME }} ` + /DJRE_VERSION=${{ env.JRE_VERSION }} ` + /DMSMPI_INSTALLER_PATH=..\..\..\assets\${{ env.MSMPI_FILENAME }} ` + /DMSMPI_VERSION=${{ env.MSMPI_VERSION }} ` + /DKHIOPS_VIZ_INSTALLER_PATH=..\..\..\assets\${{ env.KHIOPS_VIZ_FILENAME }} ` + /DKHIOPS_COVIZ_INSTALLER_PATH=..\..\..\assets\${{ env.KHIOPS_COVIZ_FILENAME }} ` + /DKHIOPS_SAMPLES_DIR=..\..\..\assets\samples ` + /DKHIOPS_DOC_DIR=..\..\..\assets\doc ` + khiops.nsi + - name: Upload installer as an artifact + uses: actions/upload-artifact@v3.1.2 + with: + name: khiops-installer + path: ./packaging/windows/nsis/khiops-${{ env.KHIOPS_PACKAGE_VERSION }}-setup.exe + test-nsis-installer: + name: Test NSIS Windows installer + needs: build-nsis-installer + runs-on: windows-2019 + steps: + - name: Download NSIS installer artifact + uses: actions/download-artifact@v3.0.2 + with: + name: khiops-installer + - name: Install Khiops + shell: pwsh + run: | + # Execute the installer + $ErrorActionPreference = 'Stop' + $ProgressPreference = 'SilentlyContinue' + Start-Process ` + -FilePath .\khiops-${{ needs.build-nsis-installer.outputs.khiops-package-version }}-setup.exe ` + -ArgumentList '/S' ` + -Wait + # Add Khiops and MPI to the path + $Env:Path += ";${Env:ProgramFiles}\khiops\bin;${Env:ProgramFiles}\Microsoft MPI\Bin" + echo "PATH=${Env:PATH}" >> ${Env:GITHUB_ENV} + echo ${Env:GITHUB_ENV} + type ${Env:GITHUB_ENV} + - name: Checkout the khiops sources + uses: actions/checkout@v3 + - name: Test the installation + uses: ./.github/actions/test-khiops-install diff --git a/.github/workflows/pack-rpm.yml b/.github/workflows/pack-rpm.yml index 9fb9becbd..3bea38fb4 100644 --- a/.github/workflows/pack-rpm.yml +++ b/.github/workflows/pack-rpm.yml @@ -2,6 +2,8 @@ name: Create RPM package on: workflow_dispatch: + pull_request: + paths: ['**CMakeLists.txt', '**.cmake'] jobs: build-rpm-package: runs-on: ubuntu-latest @@ -28,7 +30,7 @@ jobs: source /etc/profile.d/modules.sh module load mpi/mpich-x86_64 echo "MPI_SUFFIX=$MPI_SUFFIX" >> "$GITHUB_ENV" - cmake --preset linux-gcc-release -DTESTING=OFF + cmake --preset linux-gcc-release -DBUILD_JARS=ON - name: Build Khiops binaries run: | cmake --build --preset linux-gcc-release --parallel \ @@ -88,8 +90,8 @@ jobs: - name: Install Khiops Desktop (with java) run: | yum install -y ./artifacts/khiops-* - - name: Test Khiops and Khiops Coclustering - uses: ./.github/actions/test-khiops + - name: Test Khiops installation + uses: ./.github/actions/test-khiops-install test-kni-rpm: needs: build-rpm-package runs-on: ubuntu-latest @@ -105,7 +107,7 @@ jobs: steps: - name: Put OS info on the environment run: | - source /etc/os-release + source /etc/os-release echo "ID=$ID" >> "$GITHUB_ENV" VERSION=$(echo $PLATFORM_ID | cut -d":" -f2) echo "VERSION=$VERSION" >> "$GITHUB_ENV" @@ -117,10 +119,10 @@ jobs: - name: Install KNI package run: | yum update -y - yum install -y ./artifacts/kni* + yum install -y ./artifacts/kni* - name: Checkout sources uses: actions/checkout@v3 with: sparse-checkout: .github - - name: Test KNI package + - name: Test KNI package installation uses: ./.github/actions/test-kni diff --git a/.github/workflows/pre-commit-checks.yml b/.github/workflows/pre-commit-checks.yml index 8ed60fdd9..ecacff0b3 100644 --- a/.github/workflows/pre-commit-checks.yml +++ b/.github/workflows/pre-commit-checks.yml @@ -2,7 +2,6 @@ name: Run pre-commit checks on: pull_request: - push: workflow_dispatch: jobs: pre-commit-checks: diff --git a/.github/workflows/run-standard-tests.yml b/.github/workflows/run-standard-tests.yml index d834e2616..cb6e54ccb 100644 --- a/.github/workflows/run-standard-tests.yml +++ b/.github/workflows/run-standard-tests.yml @@ -14,7 +14,7 @@ env: KhiopsBatchMode: true jobs: # Build the project on each platform for all targets to ensure that all sources and cmake files are correct - # The useful binaries are cached for the current run_id. It will be restored only in the same run of the + # The useful binaries are cached for the current run_id. It will be restored only in the same run of the # build. The cached binaries are delete in the last job (cleanup-cache) build-full-project: strategy: @@ -34,7 +34,6 @@ jobs: uses: ./.github/actions/build-khiops with: preset-name: ${{ env.PRESET_NAME }} - override-flags: -DTESTING=OFF - name: Cache binaries id: cache-binaries-unix uses: actions/cache@v3 @@ -109,8 +108,8 @@ jobs: if [[ "${{ matrix.build-setup.os }}" == 'windows-2022' ]]; then export EXT=".exe" fi - if [[ "${{ matrix.running-mode }}" == "parallel" ]] ; then - export KhiopsMPIProcessNumber=3 + if [[ "${{ matrix.running-mode }}" == "parallel" ]] ; then + export KhiopsMPIProcessNumber=3 fi if [[ "${{ matrix.config }}" == "release" ]] ; then python $TEST_PY Khiops ${BIN_PATH}/MODL${EXT} Standard diff --git a/.github/workflows/run-unit-tests.yml b/.github/workflows/run-unit-tests.yml index abfb18f82..369e90b12 100644 --- a/.github/workflows/run-unit-tests.yml +++ b/.github/workflows/run-unit-tests.yml @@ -2,9 +2,23 @@ name: Run Unit Tests on: workflow_dispatch: - push: + pull_request: + paths: + - '**CMakeLists.txt' + - src/**.h + - src/**.cpp + - src/**.java + - src/**.dd + - src/**.inc + - src/**.lex + - src/**.yac + - test/**.h + - test/**.cpp jobs: run-unit-tests: + defaults: + run: + shell: bash strategy: fail-fast: false matrix: @@ -25,31 +39,41 @@ jobs: with: preset-name: ${{ matrix.build-setup.cmake-preset }} targets: norm_test parallel_test parallel_mpi_test learning_test KNITest - override-flags: -DBUILD_JARS=OFF + override-flags: -DTESTING=ON - name: Run Unit Tests for the Norm Module - if: success() || failure() - run: build/${{ matrix.build-setup.cmake-preset }}/bin/norm_test --gtest_output="xml:${{github.workspace}}/reports/report-norm.xml" + run: | + build/${{ matrix.build-setup.cmake-preset }}/bin/norm_test \ + --gtest_output="xml:reports/report-norm.xml" - name: Run Unit Tests for the Parallel Module if: success() || failure() - run: build/${{ matrix.build-setup.cmake-preset }}/bin/parallel_test --gtest_output="xml:${{github.workspace}}/reports/report-parallel.xml" + run: | + build/${{ matrix.build-setup.cmake-preset }}/bin/parallel_test \ + --gtest_output="xml:reports/report-parallel.xml" - name: Run Unit Tests for the Parallel MPI Module in serial if: success() || failure() - run: build/${{ matrix.build-setup.cmake-preset }}/bin/parallel_mpi_test --gtest_output="xml:${{github.workspace}}/reports/report-parallel-mpi-serial.xml" + run: | + build/${{ matrix.build-setup.cmake-preset }}/bin/parallel_mpi_test \ + --gtest_output="xml:reports/report-parallel-mpi-serial.xml" - name: Run Unit Tests for the Parallel MPI Module in parallel if: success() || failure() - run: mpiexec -n 4 build/${{ matrix.build-setup.cmake-preset }}/bin/parallel_mpi_test - --gtest_output="xml:${{github.workspace}}/reports/report-parallel-mpi-parallel.xml" + run: | + mpiexec -n 4 build/${{ matrix.build-setup.cmake-preset }}/bin/parallel_mpi_test \ + --gtest_output="xml:reports/report-parallel-mpi-parallel.xml" - name: Run Unit Tests for the Learning Module if: success() || failure() - run: build/${{ matrix.build-setup.cmake-preset }}/bin/learning_test --gtest_output="xml:${{github.workspace}}/reports/report-learning.xml" + run: | + build/${{ matrix.build-setup.cmake-preset }}/bin/learning_test \ + --gtest_output="xml:reports/report-learning.xml" - name: Run Unit Tests for the KNI Module if: success() || failure() - run: build/${{ matrix.build-setup.cmake-preset }}/bin/KNITest --gtest_output="xml:${{github.workspace}}/reports/report-kni.xml" - - name: Create Unit Test Reports - uses: dorny/test-reporter@v1 + run: | + build/${{ matrix.build-setup.cmake-preset }}/bin/KNITest \ + --gtest_output="xml:reports/report-kni.xml" + - name: Create Unit Test Reports Dashboards + uses: phoenix-actions/test-reporting@v12 if: success() || failure() with: - name: Unit Tests - path: ${{github.workspace}}/reports/report-*.xml + name: Unit Tests Reports (${{ matrix.build-setup.os }}) reporter: jest-junit + path: reports/report-*.xml path-replace-backslashes: 'true' # Necessary for windows paths diff --git a/.github/workflows/update-kni-tutorial.yml b/.github/workflows/update-kni-tutorial.yml index 1dfb9a140..a08faaeea 100644 --- a/.github/workflows/update-kni-tutorial.yml +++ b/.github/workflows/update-kni-tutorial.yml @@ -6,16 +6,14 @@ jobs: update-repo: runs-on: ubuntu-latest permissions: - contents: write # To push a branch + contents: write # To push a branch steps: - - name: Checkout khiops sources + - name: Checkout Khiops sources uses: actions/checkout@v3 with: path: khiops - name: Put Khiops version on the environment - run: | - KHIOPS_VERSION=$(grep "KHIOPS_VERSION" khiops/src/Learning/KWUtils/KWKhiopsVersion.h | cut -d"(" -f2 | cut -d")" -f1) - echo "KHIOPS_VERSION=${KHIOPS_VERSION}" >> "$GITHUB_ENV" + run: echo "KHIOPS_VERSION=$(./khiops/scripts/khiops-version)" >> "$GITHUB_ENV" - name: Checkout KNI-tutorial uses: actions/checkout@v3 with: @@ -26,7 +24,7 @@ jobs: # README.md and *.c files are generated by cmake configure - name: Update local KNI-tutorial run: | - cmake -B khiops/build -S khiops -DMPI=OFF -DBUILD_JARS=OFF -DBUILD_LEX_YACC=OFF -DTESTING=OFF + cmake -B khiops/build -S khiops -DMPI=OFF -DBUILD_JARS=OFF -DBUILD_LEX_YACC=OFF -DTESTING=OFF cp khiops/build/tmp/kni.README.md tutorial/README.md cp khiops/build/tmp/KNIRecodeFile.c tutorial/cpp/ cp khiops/build/tmp/KNIRecodeMTFiles.c tutorial/cpp/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 45757fbc6..fd1e17c5d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,15 +11,16 @@ project( Khiops LANGUAGES CXX VERSION ${VERSION} - HOMEPAGE_URL "khiops.com") + HOMEPAGE_URL "https://khiops.org") # Specify CMake policies cmake_policy(SET CMP0015 NEW) cmake_policy(SET CMP0048 NEW) cmake_policy(SET CMP0053 NEW) -cmake_policy(SET CMP0063 NEW) cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0058 NEW) +cmake_policy(SET CMP0063 NEW) +cmake_policy(SET CMP0083 NEW) # Do not add warning flags for MSVC cmake_policy(SET CMP0092 NEW) @@ -91,7 +92,7 @@ if(IS_FEDORA_LIKE) endif(DEFINED ENV{MPI_SUFFIX}) endif(IS_FEDORA_LIKE) -# Set built products location: +# Set the location of the built artifacts: # # - Shared and static library target directory: lib # - Executable target directory: bin @@ -107,14 +108,6 @@ message(STATUS "Libraries will be stored in ${CMAKE_BINARY_DIR}/lib/") # Set module path for the project set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/packaging") -# Use "-fPIC" / "-fPIE" for all targets by default, including static libs -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - -# CMake doesn't add "-pie" by default for executables (CMake issue #14983) -if(NOT MSVC OR NOT APPLE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") -endif() - set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) @@ -123,7 +116,7 @@ if(CMAKE_BUILD_TYPE EQUAL "Debug") set(LLVM_REQUIRES_RTTI 1) endif() -# Process dependencies Find MPI if required +# Process dependencies: Find MPI if required if(MPI) find_package(MPI 2.0 REQUIRED) message( @@ -142,23 +135,34 @@ elseif(C11) set(CMAKE_CXX_STANDARD_REQUIRED ON) endif() -# Message the current C++ configuration -message(STATUS "CMake generator is: ${CMAKE_GENERATOR}") -message(STATUS "CMake compiler is: ${CMAKE_CXX_COMPILER_ID}") -message(STATUS "CMake C++ standard is: ${CMAKE_CXX_STANDARD}") - # Find Bison/Flex if required if(BUILD_LEX_YACC) find_package(BISON REQUIRED) find_package(FLEX REQUIRED) endif() -# Find Java +# Find Java if required if(BUILD_JARS) find_package(Java REQUIRED COMPONENTS Development) + include(UseJava) + set(KHIOPS_BUILD_JAR_DIR "${CMAKE_BINARY_DIR}/jars") + message(STATUS "Java JARs will be stored at ${KHIOPS_BUILD_JAR_DIR}") + # Note: For final builds we recommend to use java 1.8 to ensure that the jar is compatible with all posterior java + # versions (from # 1.8 to the most recent ones). The following setting accomplish that: + # + # - find_package(Java 1.8 EXACT REQUIRED COMPONENTS Development) endif() -# MSVC: Eliminate some options the old CMake way because VS sets them with default values +# Check for support of position independent code/executable +include(CheckPIESupported) +check_pie_supported() + +# Message the current C++ configuration +message(STATUS "CMake generator is: ${CMAKE_GENERATOR}") +message(STATUS "CMake compiler is: ${CMAKE_CXX_COMPILER_ID}") +message(STATUS "CMake C++ standard is: ${CMAKE_CXX_STANDARD}") + +# MSVC: Eliminate some options the old CMake way because VS sets them with undesired default values # # - the C++ exception flags # - the runtime information flags @@ -176,15 +180,16 @@ function(set_khiops_options target) get_target_property(target_type ${target} TYPE) message(STATUS "Setting up ${target_type} ${target}") - # General compiler definitions + # General compiler properties and definitions + set_property(TARGET ${target} PROPERTY POSITION_INDEPENDENT_CODE TRUE) target_compile_definitions(${target} PRIVATE UNICODE _UNICODE) if(MPI) target_compile_definitions(${target} PRIVATE USE_MPI) endif() - target_compile_definitions(${target} PRIVATE $<$:NOALL>) target_compile_definitions(${target} PRIVATE $<$:__ALPHA__>) + # Delegate to specialized function for Windows and Unix-like if(MSVC) set_msvc_khiops_options(${target}) else() @@ -287,14 +292,35 @@ function(display_variables) endforeach() endfunction() +# This function set up a JAR target. Arguments: +# +# - NAME: Name of the JAR target +# - IMAGES: Paths of the image files to include in the JAR +function(add_khiops_jar) + # Parse the function arguments + set(options "") + set(oneValueArgs "NAME") + set(multiValueKwargs "JAVA_FILES" "IMAGES") + cmake_parse_arguments(ADD_KHIOPS_JAR "${options}" "${oneValueArgs}" "${multiValueKwargs}" ${ARGN}) + + # Add the JAR target with its resources and install + message(STATUS "Setting up JAR ${ADD_KHIOPS_JAR_NAME}.jar") + add_jar( + "${ADD_KHIOPS_JAR_NAME}_jar" ${ADD_KHIOPS_JAR_JAVA_FILES} + OUTPUT_NAME ${ADD_KHIOPS_JAR_NAME} RESOURCES NAMESPACE "images" ${ADD_KHIOPS_JAR_IMAGES} + OUTPUT_DIR "${CMAKE_BINARY_DIR}/jars" COMPONENT KHIOPS) + install_jar("${ADD_KHIOPS_JAR_NAME}_jar" DESTINATION usr/share/khiops) +endfunction() + # Add targets for Norm Parallel and Learning modules add_subdirectory(src/Norm) add_subdirectory(src/Parallel) add_subdirectory(src/Learning) +# Testing settings if(TESTING) + # Disable gMock from the building of googletest set(BUILD_GMOCK OFF) - set(INSTALL_GTEST OFF) # Fetch googletest from its Git repo include(FetchContent) @@ -317,19 +343,21 @@ if(TESTING) set_property(TARGET gtest_main PROPERTY MSVC_RUNTIME_LIBRARY MultiThreadedDebug) endif() + # Include and enable googletest include(GoogleTest) enable_testing() + # Add testing targets add_subdirectory(test/Norm) add_subdirectory(test/Parallel) add_subdirectory(test/Parallel-mpi) add_subdirectory(test/Learning) add_subdirectory(test/KNITest) add_subdirectory(test/Utils) - endif(TESTING) # Exclude googletest from the installation set(INSTALL_GTEST OFF) +# Add packaging directory for CPack scripts include(packaging) diff --git a/CMakePresets.json b/CMakePresets.json index 5a7a9a7d7..32bbe6a2a 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -13,8 +13,8 @@ "generator": "Ninja", "cacheVariables": { "MPI": "ON", - "TESTING": "ON", - "BUILD_JARS": "ON", + "TESTING": "OFF", + "BUILD_JARS": "OFF", "BUILD_LEX_YACC": "OFF", "C11": "ON" }, diff --git a/packaging/common/images/khiops.ico b/packaging/common/images/khiops.ico new file mode 100644 index 000000000..4be84ba01 Binary files /dev/null and b/packaging/common/images/khiops.ico differ diff --git a/packaging/common/images/khiops_coclustering.ico b/packaging/common/images/khiops_coclustering.ico new file mode 100644 index 000000000..4d479036e Binary files /dev/null and b/packaging/common/images/khiops_coclustering.ico differ diff --git a/packaging/common/khiops/README.txt b/packaging/common/khiops/README.txt index 64499d254..d471bb99d 100644 --- a/packaging/common/khiops/README.txt +++ b/packaging/common/khiops/README.txt @@ -1,7 +1,7 @@ Khiops 10.0 =========== - (c) 2021 Orange Labs - All rights reserved. - www.khiops.com + (c) 2023 Orange - All rights reserved. + https://khiops.org Khiops is a fully automatic tool for mining large multi-table databases, winner of several data mining challenges. @@ -30,23 +30,23 @@ Main features Khiops 10.0 - what's new - New algorithm for Selective Naive Bayes predictor - . improved accuracy using a direct optimization of variable weights, - . improved interpretability and faster deployment time, with less variables selected, - . faster training time, using the new algorithm and exploiting parallelization, + - improved accuracy using a direct optimization of variable weights, + - improved interpretability and faster deployment time, with less variables selected, + - faster training time, using the new algorithm and exploiting parallelization, - Improved random forests - . faster and more accurate preprocessing, - . biased random selection of variable to better deal with large numbers of variables, + - faster and more accurate preprocessing, + - biased random selection of variable to better deal with large numbers of variables, - Management of sparse data - . fully automatic, - . potentially faster algorithms in case of many constructed variables, + - fully automatic, + - potentially faster algorithms in case of many constructed variables, - New visualization tool - . available on any platform: windows, linux, mac, both in standalone and using a browser + - available on any platform: windows, linux, mac, both in standalone and using a browser - Parallelization on clusters of machine - . available on Hadoop (Yarn, HDFS) + - available on Hadoop (Yarn, HDFS) - New version of pykhiops - . more compliant with python PEP8 standard, using snake case - . distributed as a python package - . new features are available: see pykhiops release notes + - more compliant with python PEP8 standard, using snake case + - distributed as a python package + - new features are available: see pykhiops release notes Upward compatibility with Khiops 9 - dictionaries of Khiops 9 are readable with Khiops 10 @@ -54,87 +54,70 @@ Upward compatibility with Khiops 9 - python scripts using pykhiops 9 are running, with warnings for the deprecated features - scenarios of Khiops 9 are compatible, with warnings for the deprecated features - removed features in Khiops 10, that still work when used from former python scripts or scenarios: - . MAP Naive Bayes is removed - . Naive Bayes predictor is removed - . Preprocessing options MODLEqualWdth, MODLEqualFrequency and MODLBasic are removed + - MAP Naive Bayes is removed + - Naive Bayes predictor is removed + - Preprocessing options MODLEqualWidth, MODLEqualFrequency and MODLBasic are removed - deprecated features, that still work but will be removed in next versions after Khiops 10: - . pykhiops 9 is replaced by pykhiops 10 (see migration guide within pykhiops release notes) - - -Technical prerequisite ----------------------- -Configuration: - PC Windows (Seven and higher), 64 bits - Linux (supported distributions: see www.khiops.com), 64 bits - -Windows software: - Java Runtime Environment V7 or higher, Adobe AIR runtime V30.0, MS MPI 9 - Automatic detection and silent installation during the Khiops installation process on Windows - For specific installation (other than default installation), ask "get Java" or - "get Adobe AIR" on your web search engine to obtain the installer for each - prerequisite component, and proceed with a manual installation - For silent installation, run installer with /S option, and /D=installationDir to choose - a specific installation directory + - pykhiops 9 is replaced by pykhiops 10 (see migration guide within pykhiops release notes) + + +Technical prerequisites +----------------------- +Configuration: + - PC Windows (Seven and higher), 64 bits + - Linux (supported distributions: see https://khiops.org), 64 bits + +Windows software: + - Java Runtime Environment V7 or higher + - Automatic detection and silent installation during the Khiops installation process on Windows + - For specific installation (other than default installation), search "get Java" on your search + engine to obtain the installer for each prerequisite component, and proceed with a manual + installation + - For a silent installation, run the installer with /S option, and /D=installationDir to choose a + specific installation directory. Linux software: Java Runtime Environment V7 or higher, mpich (>3.0), libstdc++6 Automatic detection and silent installation during the Khiops installation process -Software key, provided during the installation process. - -Other configurations: contact us +Other configurations (ex. macOS): see https://khiops.org Khiops files on Windows ----------------------- -Root directory: - readme.txt: this file - whatsnewV10.0.txt: detailed release notes - install.txt: installation process - KhiopsLicense.pdf: license file - Short-cuts to Khiops components - -bin directory: - executable, batch files and libraries - -doc directory: - reference guides and tutorial for Khiops components - start with KhiopsTutorial.pdf - -python directory: - python library for Khiops (pykhiops) and samples of use of this library - see python/readme.txt +Install location (usually C:\Program Files\khiops): + - README.txt: this file + - WHATSNEW.txt: detailed release notes + - LICENSE.txt: license file + - Shortcuts to Khiops components + - bin sub-directory: + - executable, batch files and libraries + - doc sub-directory: + - reference guides and tutorial for Khiops components + - start with KhiopsTutorial.pdf + +Other locations: + - %USERPROFILE%\khiops_data\lastrun directory (usually C:\Users\\khiops_data\lastrun): + - contains scenario and log files for last run of Khiops and Khiops Coclustering + + - %PUBLIC%\khiops_data\samples (usually C:\Users\Public\khiops_data\samples) + - directory tree with database samples (database files `.txt` and + dictionary files `.kdic`) see samples/README.txt -samples directory: - directory tree with database samples (database file (.txt) and dictionary file (.kdic)) - see samples/readme.txt - -key directory: - to store Khiops and Khiops Coclustering license files - -lastrun directory: - contains scenario and log files for last run of Khiops and Khiops Coclustering - - - Khiops files on Linux --------------------- - -/usr/bin : - executable, batch files +/usr/bin: + - executable, batch files /usr/share/doc/khiops: - reference guides and tutorial for Khiops components - start with KhiopsTutorial.pdf - readme.txt: this file - whatsnewV10.0.txt: detailed release notes - samples directory: - directory tree with database samples (database file (.txt) and dictionary file (.kdic)) - see samples/readme.txt - -/opt/khiops/key/: - to store Khiops and Khiops Coclustering license files + - reference guides and tutorial for Khiops components + - start with KhiopsTutorial.pdf + - README.txt: this file + - WHATSNEW.txt: detailed release notes + - samples directory: + directory tree with database samples (database files `.txt` and dictionary files `.kdic`) + see samples/README.txt /tmp/khiops/$USER: - contains scenario and log files for last run of Khiops and Khiops Coclustering \ No newline at end of file + - contains scenario and log files for last run of Khiops and Khiops Coclustering diff --git a/packaging/common/khiops/whatsnewV10.1.txt b/packaging/common/khiops/WHATSNEW.txt similarity index 81% rename from packaging/common/khiops/whatsnewV10.1.txt rename to packaging/common/khiops/WHATSNEW.txt index 5120a0701..e16612289 100644 --- a/packaging/common/khiops/whatsnewV10.1.txt +++ b/packaging/common/khiops/WHATSNEW.txt @@ -1,59 +1,79 @@ -Khiops 10.1.5 release notes -=========================== +========================================== +Release Notes for Khiops 10 Version Series +========================================== + +Version 10.2.0 +============== +**Announcement**: This is a special release marking the open-sourcing of the Khiops AutoML suite. +New Features: +- Khiops can now be built in macOS. Currently only a conda package is available for installing (more + information at https://khiops.org) + +Bug fix: +- Fix a bug in the calculation of descriptive stats for huge databases +- Fix clusters having negative typicalities in coclustering + + +Version 10.1.5 +============== +Bug fix: +- KhiopsNativeInterface crashes with java under Linux. Signals are not intercepted anymore in KNI. + +Version 10.1.4 +============== +Bug fix: +- in the sorting algorithm: it could produce corrupted files when the separators of the input and + output files are different. + +Version 10.1.3 +============== Bug fix: -- KhiopsNativeInterface crashes with java under linux. - Signals are not intercepted anymore in KNI. - -Khiops 10.1.4 release notes -=========================== -Bug fix: -- in the sorting algorithm: it could produce corrupted files when the separators of the input - and output files are different. - -Khiops 10.1.3 release notes -=========================== -Bug fix: - better error management on non standard file systems (e.g. s3 or hdfs) - the results directory is correctly build in predictor evaluation on non standard file systems -Khiops 10.1.2 release notes -=========================== -Bug fix: +Version 10.1.2 +============== +Bug fix: - the results path is correctly build in Khiops-coclustering when the directory is located on non standard file systems (e.g. s3 or hdfs) -Khiops 10.1.1 release notes -=========================== +Version 10.1.1 +============== Bug fixes: -- in the sorting algorithm : in case where the field separator in the output file was different - from the input file, with the input file having fields surrounded by double-quotes and - containing the input field separator -- in the construction of trees: in an edge case with a single tree and categorical fields - with very large number of values +- in the sorting algorithm : in case where the field separator in the output file was different from + the input file, with the input file having fields surrounded by double-quotes and containing the + input field separator +- in the construction of trees: in an edge case with a single tree and categorical fields with very + large number of values - in a multiple-machine cloud environment: fixed the file path management with URI -- in a multiple-machine cloud environment: fixed management of specialized temporary directories per machine +- in a multiple-machine cloud environment: fixed management of specialized temporary directories per + machine Improvements: -- better dimensionning of the deployment task in case of multi-table schema with a large number of orphan secondary records +- better dimensioning of the deployment task in case of multi-table schema with a large number of + orphan secondary records - improved detection and diagnostics related to JAVA runtime in Khiops scripts on Windows -Khiops 10.1 release notes -========================= -Khiops 10.1 is a minor release, with few new features, but many optimization and reliability improvements, -to better perform in cloud environments and better integrate Khiops within information systems. +Version 10.1 +============ +Khiops 10.1 is a minor release, with few new features, but many optimization and reliability +improvements, to better perform in cloud environments and better integrate Khiops within information +systems. Main new features - Visualization tools: - Khiops visualization: new panel "Tree preparation" to visualize the trees. - - Khiops covisualization: new tool, replacing the previous one based on the obsolete Flex framework. + - Khiops covisualization: new tool, replacing the previous one based on the obsolete Flex + framework. - Data Table Dictionaries: - A new type TimestampTZ: A timestamp with timezone: - it uses the ISO 8601 standard (see the Khiops Guide for more details). - it is detected automatically in the "Build dictionary from data table" feature. - new derivation rules for this type: - - CopyTSTZ, FormatTimestampTZ, AsTimestampTZ, UtcTimestamp, LocalTimestamp, SetTimeZoneMinutes, - GetTimeZoneMinutes, DiffTimestampTZ, AddSecondsTSTZ, IsTimestampTZValid, BuildTimestampTZ, GetValueTSTZ. + - CopyTSTZ, FormatTimestampTZ, AsTimestampTZ, UtcTimestamp, LocalTimestamp, + SetTimeZoneMinutes, GetTimeZoneMinutes, DiffTimestampTZ, AddSecondsTSTZ, IsTimestampTZValid, + BuildTimestampTZ, GetValueTSTZ. - new automatic construction rule in "Variable construction parameters": - LocalTimestamp, to obtain a local Timestamp from a TimestampTZ - Timestamp type now accepts a format with the character 'T' as separator between date and time. @@ -87,67 +107,65 @@ Main performance improvements Many minor corrections, mainly for edge-case bugs. -Khiops 10.0.4 release notes -=========================== -- bug fix in sort algorithm : the field separator in the output file was not correct - for files with a huge number of identical lines. +Version 10.0.4 +============== +- bug fix in sort algorithm : the field separator in the output file was not correct for files with + a huge number of identical lines. -Khiops 10.0.3 release notes -=========================== -- fix an edge-case bug in multi-table schemas, in case of a root table of moderate size - and several subtables, some of them very small and some very large, and duplicate records - in the root table +Version 10.0.3 +============== +- fix an edge-case bug in multi-table schemas, in case of a root table of moderate size and several + subtables, some of them very small and some very large, and duplicate records in the root table -- fix a problem of wrong line numbers reported in case or warning or errors occuring - with very large data files +- fix a problem of wrong line numbers reported in case or warning or errors occuring with very large + data files - fix a bug in json reports for trees - the file format detector is now more resilient to empty lines in the analyzed data files -Khiops 10.0.2 release notes -=========================== -- fix a bug for file systems with URI schemes (s3 or hdfs) for correct managment - of the "result files directory" +Version 10.0.2 +============== +- fix a bug for file systems with URI schemes (s3 or hdfs) for correct managment of the "result + files directory" -Khiops 10.0.1 release notes -=========================== +Version 10.0.1 +============== Improvements: -- better handling of database encodings (ascii, ansi, utf8) for json report files, - to make it easier to manipulate reports from pykhiops: +- better handling of database encodings (ascii, ansi, utf8) for json report files, to make it easier + to manipulate reports from pykhiops: cf. "Character encodings" section in the Khiops guide -- the "Detect file format" feature now displays a message in the log window - with the recognized format: used header line and field sepatator +- the "Detect file format" feature now displays a message in the log window with the recognized + format: used header line and field separator -- the "Build dictionary" function now proposes a categorical format for fields - that only contain the values "", "0", or "1" +- the "Build dictionary" function now proposes a categorical format for fields that only contain the + values "", "0", or "1" -- in modeling dictionaries, the target variable is now set as "Unused" by default - to facilitate the deployment of predictors in the case of deployment databases - where the target variable is missing +- in modeling dictionaries, the target variable is now set as "Unused" by default to facilitate the + deployment of predictors in the case of deployment databases where the target variable is missing -- the Accidents sample database is now translated into English, with interpretable - variable names and values; a simpler version called AccidentsSummary is available +- the Accidents sample database is now translated into English, with interpretable variable names + and values; a simpler version called AccidentsSummary is available -- the khiops and khiops_coclustering shell commands now exploit a common shell command - khiops_env which defines all env variables required by Khiops. - This new command is self-documented and can be used from a wrapper, such as pykhiops +- the khiops and khiops_coclustering shell commands now exploit a common shell command khiops_env + which defines all env variables required by Khiops. This new command is self-documented and can + be used from a wrapper, such as pykhiops -- better messages and documentation in case of unsupported data formats, such as the - "classic" Mac OS line endings, deprecated since Max OS X in 1998, or a UTF-8 file - with BOM (byte order mark) start characters +- better messages and documentation in case of unsupported data formats, such as the "classic" Mac + OS line endings, deprecated since Max OS X in 1998, or a UTF-8 file with BOM (byte order mark) + start characters -- slight improvement of the level criterion for the preparation of univariate and - bivariate data in some edge cases +- slight improvement of the level criterion for the preparation of univariate and bivariate data in + some edge cases - the "Build coclustering" button is renamed to "Train coclustering" in the Khiops coclustering tool -- the environment variables for managing external resources are now KHIOPS_MEMORY_LIMIT and KHIOPS_TMP_DIR, - instead of the now obsolete KhiopsTmpDir. +- the environment variables for managing external resources are now KHIOPS_MEMORY_LIMIT and + KHIOPS_TMP_DIR, instead of the now obsolete KhiopsTmpDir. - AUC is now 0 in the case of an empty test database. @@ -159,25 +177,29 @@ Improvements: Issues: - fix a bug in the "Extract keys" function, when the output file is specified without a header line -- fix an overestimation of the memory requirement for building the trees in the case of large databases +- fix an overestimation of the memory requirement for building the trees in the case of large + databases - fix a edge case bug that freezes parallel processes when learning a multi-table scheme -- fix a edge case bug in the SNB classifier, in the case of a very large matrix instances x variables beyond two billion values +- fix a edge case bug in the SNB classifier, in the case of a very large matrix instances x + variables beyond two billion values -- fix a edge case bug in the sorting functionality, when the input files contain fields between double quotes with internal quotes - double quotes and/or an input field separator, and when the output field separator is different from the input one +- fix a edge case bug in the sorting functionality, when the input files contain fields between + double quotes with internal quotes double quotes and/or an input field separator, and when the + output field separator is different from the input one -- fix a bug in te user interface, when the "Inspect dictionary" action could be called twice simultaneously, resulting in a crash +- fix a bug in te user interface, when the "Inspect dictionary" action could be called twice + simultaneously, resulting in a crash -- fix several resource management issues in the case of a cluster with several heteregeneous machines +- fix several resource management issues in the case of a cluster with several heteregeneous + machines - Other minor corrections -Khiops 10.0 - what 's new -========================= - (c) 2021 Orange Labs - All rights reserved. +Version 10.0 +============ Khiops is a fully automatic tool for mining large multi-table databases, winner of several data mining challenges. @@ -344,7 +366,7 @@ User interface - Variable construction pane: removed - new helper button "Detect file format" in each database pane, to detect whether there is a header line and what the field separator is - - new menu Help, with documentation, licence management and about sub-menus + - new menu Help, with documentation, license management and about sub-menus - removed options - Pane Parameters/Predictors - MAP Naive Bayes and Naive Bayes predictors are removed diff --git a/packaging/common/khiops/install.txt b/packaging/common/khiops/install.txt deleted file mode 100644 index 14f727bb2..000000000 --- a/packaging/common/khiops/install.txt +++ /dev/null @@ -1,95 +0,0 @@ -Khiops 10.1 -=========== - (c) 2022 Orange Labs - All rights reserved. - www.khiops.com - -1 Windows users -1.1 Installation process on Windows -1.2 Known problems on Windows -2 Linux users -2.1 Important Warnings for Linux users -2.2 Installation Process on Linux -2.3 Known problems on Linux - - - -1 Windows users ---------------- - -1.1 Installation process on Windows ----------------------------------- - -The steps to download and use Khiops are summarized below. - -Step 1 - On www.khiops.com -. Go to the "Login" page and log in - -Step 2 - On www.khiops.com -. Go to the "Install" page -. Download the Khiops version that you need (Windows or Linux) - -Step 3 - On your computer: install Khiops in administrator mode - -1.2 Known problems on Windows ------------------------------ -The Khiops installer relies on embedded installers for Java and MPI. - - Windows Defender or any other antivirus software may remove excutable files (.exe, .jar) during installation. - In this case, you should add exceptions to your antivirus or disable it during installation. - - The java installer results in a system reboot on some systems (eg. on Windows Server 2008) - - The MPI installer is Microsoft MPI 10, which is not compliant with too old Windows OS. - If necessary, the khiops.cmd command file can be edited to start Khiops without MPI - (see khiops_coclustering.cmd) - - - -2 Linux Users -------------- - -Khiops comes with three packages: khiops-core, khiops and khiops-samples. khiops-core is a lightweight package without GUI, -documentation or samples. It is intended to be used on servers and dockers. The khiops package requires -khiops-core and contains the full version of Khiops: GUI, documentation. The khiops-samples contains several datasets used in -Khiops tutorial. These samples are located in /opt/khiops/samples. This directory is write protected, therefore, -in order to work with it, it is recommended to copy it to your home directory (or /tmp). - -In the same way, KNI comes with two packages: kni and kni-doc. kni contains only the header and the shared -library of Khiops native interface. And kni-doc contains the documentation and samples. - -2.1 Important Warnings for Linux users ---------------------------------------- -With khiops-core or on remote machines without X tunneling, khiops and khiops_coclustering must -be executed with the "-b" option. Otherwise, Khiops tries to launch a Java GUI, causing a Java error -("fatal error : Java GUI : No GUI (X server) available under current environment"). - -2.2 Installation process on Linux ----------------------------------- -The installation process is the same as on Windows (see section 1.1). There are nevertheless some -differences. If you are using a linux repository, the installation of the khiops package will -automatically install khiops-core and khiops-samples packages. It is more complicated if you download the packages: -you have to install khiops-core before khiops. - -On debian : - -sudo dpkg -i khiops-core_10.1-0+focal_amd64.deb -sudo dpkg -i khiops-samples_10.1-0+focal_amd64.deb -sudo dpkg -i khiops_10.1-0+focal_amd64.deb -sudo apt-get -f install - -On redhat : - -sudo yum localinstall khiops-core-10.1-0.el7.x86_64.rpm -sudo yum localinstall khiops-samples-10.1-0.el7.x86_64.rpm -sudo yum localinstall khiops-10.1-0.el7.x86_64.rpm - -2.3 Known problems on Linux ---------------------------- - - A bug on openjdk on Ubuntu 18.04 causes a java exception. - To fix this problem, you have to edit the file - /etc/java-11-openjdk/accessibility.properties and comment the line - "assistive_technologies=org.GNOME.Accessibility.AtkWrapper" - - When there is a problem resolving localhost, khiops fails with an MPICH error endind with : - ckpt_restart(379)..................: gethostbyname failed, YOUR_LOCAL_HOST_NAME (errno 1) - This issue appears when the command "localhost" and the file /etc/hosts are not consistent - To solve this issue, type "sudo hostnamectl set-hostname NEW-NAME" where NEW-NAME is - the hostname of /etc/hosts - - On some Raspbian release, the java GUI is freezing. However, you can use Khiops in - batch mode (khiops -b) or with the python library. \ No newline at end of file diff --git a/packaging/conda/bld.bat b/packaging/conda/bld.bat index caa8cfa35..0a1f27ffe 100644 --- a/packaging/conda/bld.bat +++ b/packaging/conda/bld.bat @@ -1,2 +1,2 @@ -cmake --preset windows-msvc-release -DBUILD_JARS=OFF -DTESTING=OFF +cmake --preset windows-msvc-release cmake --build --preset windows-msvc-release --parallel --target MODL MODL_Coclustering diff --git a/packaging/conda/build.sh b/packaging/conda/build.sh index 943b48c18..e41eb2bac 100644 --- a/packaging/conda/build.sh +++ b/packaging/conda/build.sh @@ -4,9 +4,9 @@ # ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Applications/Xcode_14.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd' for architecture x86_64 if [ "$(uname)" == "Darwin" ] then - cmake --preset macos-clang-release -DBUILD_JARS=OFF -DTESTING=OFF -DCMAKE_CXX_COMPILER=/usr/bin/clang++ + cmake --preset macos-clang-release -DCMAKE_CXX_COMPILER=/usr/bin/clang++ cmake --build --preset macos-clang-release --parallel --target MODL MODL_Coclustering else - cmake --preset linux-gcc-release -DBUILD_JARS=OFF -DTESTING=OFF + cmake --preset linux-gcc-release cmake --build --preset linux-gcc-release --parallel --target MODL MODL_Coclustering fi diff --git a/packaging/dockerfiles/Dockerfile.rocky8 b/packaging/dockerfiles/Dockerfile.rocky8 index 2d500fd06..d32f9471e 100644 --- a/packaging/dockerfiles/Dockerfile.rocky8 +++ b/packaging/dockerfiles/Dockerfile.rocky8 @@ -1,5 +1,5 @@ FROM rockylinux:8 -LABEL maintainer="bruno.guerraz@orange.com" +LABEL maintainer="khiops.team@orange.com" LABEL description="Container with the dependencies to build and package Khiops" RUN true \ diff --git a/packaging/dockerfiles/Dockerfile.rocky9 b/packaging/dockerfiles/Dockerfile.rocky9 index 23a7291a3..3f4b49451 100644 --- a/packaging/dockerfiles/Dockerfile.rocky9 +++ b/packaging/dockerfiles/Dockerfile.rocky9 @@ -1,5 +1,5 @@ FROM rockylinux:9 -LABEL maintainer="bruno.guerraz@orange.com" +LABEL maintainer="khiops.team@orange.com" LABEL description="Container with the dependencies to build and package Khiops" RUN true \ diff --git a/packaging/dockerfiles/Dockerfile.ubuntu18.04 b/packaging/dockerfiles/Dockerfile.ubuntu18.04 index 65f503b71..f67263f00 100644 --- a/packaging/dockerfiles/Dockerfile.ubuntu18.04 +++ b/packaging/dockerfiles/Dockerfile.ubuntu18.04 @@ -1,5 +1,5 @@ FROM ubuntu:18.04 -LABEL maintainer="bruno.guerraz@orange.com" +LABEL maintainer="khiops.team@orange.com" LABEL description="Container with the dependencies to build and package Khiops" ENV DEBIAN_FRONTEND=noninteractive diff --git a/packaging/dockerfiles/Dockerfile.ubuntu20.04 b/packaging/dockerfiles/Dockerfile.ubuntu20.04 index c1d232eca..41d3d527b 100644 --- a/packaging/dockerfiles/Dockerfile.ubuntu20.04 +++ b/packaging/dockerfiles/Dockerfile.ubuntu20.04 @@ -1,5 +1,5 @@ FROM ubuntu:20.04 -LABEL maintainer="bruno.guerraz@orange.com" +LABEL maintainer="khiops.team@orange.com" LABEL description="Container with the dependencies to build and package Khiops" ENV DEBIAN_FRONTEND=noninteractive diff --git a/packaging/dockerfiles/Dockerfile.ubuntu22.04 b/packaging/dockerfiles/Dockerfile.ubuntu22.04 index b3464225c..cc8d2ba26 100644 --- a/packaging/dockerfiles/Dockerfile.ubuntu22.04 +++ b/packaging/dockerfiles/Dockerfile.ubuntu22.04 @@ -1,5 +1,5 @@ FROM ubuntu:22.04 -LABEL maintainer="bruno.guerraz@orange.com" +LABEL maintainer="khiops.team@orange.com" LABEL description="Container with the dependencies to build and package Khiops" ENV DEBIAN_FRONTEND=noninteractive diff --git a/packaging/install.cmake b/packaging/install.cmake index 6598290d1..bf5983a20 100644 --- a/packaging/install.cmake +++ b/packaging/install.cmake @@ -99,7 +99,7 @@ install( COMPONENT KHIOPS_CORE) install( - FILES ${PROJECT_SOURCE_DIR}/packaging/common/khiops/whatsnewV10.1.txt + FILES ${PROJECT_SOURCE_DIR}/packaging/common/khiops/WHATSNEW.txt ${PROJECT_SOURCE_DIR}/packaging/common/khiops/README.txt DESTINATION usr/share/doc/khiops COMPONENT KHIOPS) diff --git a/packaging/packaging.cmake b/packaging/packaging.cmake index eb7fea001..2ffa8830a 100644 --- a/packaging/packaging.cmake +++ b/packaging/packaging.cmake @@ -1,9 +1,9 @@ set(CPACK_PACKAGE_VENDOR Orange) -set(CPACK_PACKAGE_HOMEPAGE_URL khiops.com) +set(CPACK_PACKAGE_HOMEPAGE_URL https://khiops.org) set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/packaging/common/images/khiops.png") set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VENDOR "Orange") -set(CPACK_PACKAGE_CONTACT "Bruno Guerraz ") +set(CPACK_PACKAGE_CONTACT "Khiops Team ") set(CPACK_SOURCE_IGNORE_FILES .git) set(CPACK_COMPONENT_KHIOPS_DESCRIPTION diff --git a/packaging/windows/nsis/CreateKhiopsCmdFileFunc.nsh b/packaging/windows/nsis/CreateKhiopsCmdFileFunc.nsh new file mode 100644 index 000000000..3fce501e9 --- /dev/null +++ b/packaging/windows/nsis/CreateKhiopsCmdFileFunc.nsh @@ -0,0 +1,119 @@ +!include "FileFunc.nsh" +!include "x64.nsh" + +# Macro to create the khiops.cmd script +# Example: +# ${CreateKhiopsCmdFile} "$INSTDIR\khiops.cmd" "MODL" "" "$INSTDIR" "scenario._kh" "log.txt" "1" +# +!define CreateKhiopsCmdFile "!insertmacro CreateKhiopsCmdFile" +!macro CreateKhiopsCmdFile FileName ToolName BinSuffix KhiopsHome ScenarioFileName LogFileName ParallelMode + Push "${ParallelMode}" + Push "${LogFileName}" + Push "${ScenarioFileName}" + Push "${KhiopsHome}" + Push "${BinSuffix}" + Push "${ToolName}" + Push "${FileName}" + Call CreateKhiopsCmdFile +!macroend + + +Function CreateKhiopsCmdFile + # Function parameters + Var /GLOBAL _FileName + Var /GLOBAL _ToolName + Var /GLOBAL _BinSuffix + Var /GLOBAL _KhiopsHome + Var /GLOBAL _ScenarioFileName + Var /GLOBAL _LogFileName + Var /GLOBAL _ParallelMode + + # Retrieve parameters from stack + Pop $_FileName + Pop $_ToolName + Pop $_BinSuffix + Pop $_KhiopsHome + Pop $_ScenarioFileName + Pop $_LogFileName + Pop $_ParallelMode + + # Open file to create + FileOpen $0 "$_FileName" w + + # Write file + FileWrite $0 `@echo off$\r$\n` + FileWrite $0 `setlocal$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM ========================================================$\r$\n` + FileWrite $0 `REM See the khiops_env script for full documentation on the$\r$\n` + FileWrite $0 `REM environment variables used by Khiops$\r$\n` + FileWrite $0 `REM ========================================================$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM ========================================================$\r$\n` + FileWrite $0 `REM Initialization of the installation directory of Khiops$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Test is Khiops environment already set up$\r$\n` + FileWrite $0 `if "%KHIOPS_HOME%".=="". set KHIOPS_HOME=$_KhiopsHome$\r$\n` + FileWrite $0 `if not exist "%KHIOPS_HOME%\bin$_BinSuffix\$_ToolName.exe" goto ERR_PATH$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Test if batch mode from parameters$\r$\n` + FileWrite $0 `set _KHIOPS_BATCH_MODE=$\r$\n` + FileWrite $0 `for %%i in (%*) do if %%i.==-b. set _KHIOPS_BATCH_MODE=true$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Initialize Khiops env variables$\r$\n` + FileWrite $0 `call "%KHIOPS_HOME%\bin\khiops_env" --env > NUL$\r$\n` + FileWrite $0 `if not %_KHIOPS_BATCH_MODE%.==true. if not exist "%KHIOPS_JAVA_PATH%\jvm.dll" goto ERR_JAVA$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Set path$\r$\n` + FileWrite $0 `set path=%KHIOPS_PATH%;%KHIOPS_JAVA_PATH%;%path%$\r$\n` + FileWrite $0 `set classpath=%KHIOPS_CLASSPATH%;%classpath%$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM ========================================================$\r$\n` + FileWrite $0 `REM Start Khiops (with or without parameteres)$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `if %1.==. goto NOPARAMS$\r$\n` + FileWrite $0 `if not %1.==. goto PARAMS$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Start without parameters$\r$\n` + FileWrite $0 `:NOPARAMS$\r$\n` + FileWrite $0 `if not exist "%KHIOPS_LAST_RUN_DIR%" md "%KHIOPS_LAST_RUN_DIR%"$\r$\n` + FileWrite $0 `if not exist "%KHIOPS_LAST_RUN_DIR%" goto PARAMS$\r$\n` + ${If} $_ParallelMode == "0" + FileWrite $0 `"%KHIOPS_PATH%$_BinSuffix\$_ToolName" -o "%KHIOPS_LAST_RUN_DIR%\$_ScenarioFileName" -e "%KHIOPS_LAST_RUN_DIR%\$_LogFileName"$\r$\n` + ${Else} + FileWrite $0 `%KHIOPS_MPI_COMMAND% "%KHIOPS_PATH%$_BinSuffix\$_ToolName" -o "%KHIOPS_LAST_RUN_DIR%\$_ScenarioFileName" -e "%KHIOPS_LAST_RUN_DIR%\$_LogFileName"$\r$\n` + ${EndIf} + FileWrite $0 `goto END$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Start with parameters$\r$\n` + FileWrite $0 `:PARAMS$\r$\n` + ${If} $_ParallelMode == "0" + FileWrite $0 `"%KHIOPS_PATH%$_BinSuffix\$_ToolName" %*$\r$\n` + ${Else} + FileWrite $0 `%KHIOPS_MPI_COMMAND% "%KHIOPS_PATH%$_BinSuffix\$_ToolName" %*$\r$\n` + ${EndIf} + FileWrite $0 `goto END$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM ========================================================$\r$\n` + FileWrite $0 `REM Error messages$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:ERR_PATH$\r$\n` + FileWrite $0 `start "KHIOPS CONFIG PROBLEM" echo ERROR Incorrect installation directory for Khiops (File $_ToolName.exe not found in directory %KHIOPS_PATH%$_BinSuffix)$\r$\n` + FileWrite $0 `exit /b 1$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:ERR_JAVA$\r$\n` + FileWrite $0 `start "KHIOPS CONFIG PROBLEM" echo ERROR Java not correctly installed, jvm.dll not found under java directory tree %_KHIOPS_JAVA_HOME% (%_KHIOPS_JAVA_HOME_ORIGIN%): see khiops_env.cmd file in %KHIOPS_HOME%\bin, after line 'Set user Java Home'$\r$\n` + FileWrite $0 `exit /b 1$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:END$\r$\n` + FileWrite $0 `endlocal$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Return 1 if fatal error, 2 if error(s), 0 otherwise$\r$\n` + FileWrite $0 `exit /b %errorlevel%$\r$\n` + + # Close file + FileClose $0 +FunctionEnd diff --git a/packaging/windows/nsis/CreateKhiopsEnvCmdFileFunc.nsh b/packaging/windows/nsis/CreateKhiopsEnvCmdFileFunc.nsh new file mode 100644 index 000000000..26d4e0877 --- /dev/null +++ b/packaging/windows/nsis/CreateKhiopsEnvCmdFileFunc.nsh @@ -0,0 +1,195 @@ +!include "FileFunc.nsh" +!include "x64.nsh" + +# Macro to create the khiops_env.cmd script +# Example: +# ${CreateKhiopsEnvCmdFile} "$INSTDIR\khiops_env.cmd" "$INSTDIR" "4" +# +!define CreateKhiopsEnvCmdFile "!insertmacro CreateKhiopsEnvCmdFile" +!macro CreateKhiopsEnvCmdFile FileName KhiopsHome PhysicalCoresNumber + Push "${PhysicalCoresNumber}" + Push "${KhiopsHome}" + Push "${FileName}" + Call CreateKhiopsEnvCmdFile +!macroend + +# Function to be used with the macro defined above +Function CreateKhiopsEnvCmdFile + # Define function parameters + Var /GLOBAL _EnvFileName + Var /GLOBAL _EnvKhiopsHome + Var /GLOBAL _EnvProcessNumber + + # Retrieve parameters from stack + Pop $_EnvFileName + Pop $_EnvKhiopsHome + Pop $_EnvProcessNumber + + # Open the file to create + FileOpen $0 "$_EnvFileName" w + + # Write file contents + FileWrite $0 `@echo off$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `if %1.==--env. goto SET_ENV$\r$\n` + FileWrite $0 `goto HELP$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:HELP$\r$\n` + FileWrite $0 `echo Usage: khiops-env [-h] [--env]$\r$\n` + FileWrite $0 `echo khiops-env is an internal script intended to be used by Khiops tool and Khiops'$\r$\n` + FileWrite $0 `echo wrappers only.$\r$\n` + FileWrite $0 `echo If the --env flag is used, the environment list is printed on the standard output$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo The following variables are used to set the path and classpath$\r$\n` + FileWrite $0 `echo for the prerequisite of Khiops.$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo KHIOPS_HOME: home directory of Khiops, on Windows only$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo KHIOPS_PATH: path of Khiops' executable, to add in path$\r$\n` + FileWrite $0 `echo KHIOPS_MPI_COMMAND: MPI command to call the Khiops tool$\r$\n` + FileWrite $0 `echo KHIOPS_MPI_LIB: MPI library path used by the Khiops tool$\r$\n` + FileWrite $0 `echo KHIOPS_JAVA_PATH: path of Java tool, to add in path$\r$\n` + FileWrite $0 `echo KHIOPS_CLASSPATH: Khiops java libraries, to add in classpath$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo If they are not already defined, the following variables used by$\r$\n` + FileWrite $0 `echo Khiops are set :$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo KHIOPS_LAST_RUN_DIR: directory where Khiops writes output command$\r$\n` + FileWrite $0 `echo file and log (when not defined with -e and -o)$\r$\n` + FileWrite $0 `echo KHIOPS_PROC_NUMBER: processes number launched by Khiops (it's$\r$\n` + FileWrite $0 `echo default value corresponds to the number of physical cores of$\r$\n` + FileWrite $0 `echo the computer plus one)$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo The following variables are not defined by default and can be used to$\r$\n` + FileWrite $0 `echo change some default properties of Khiops:$\r$\n` + FileWrite $0 `echo.$\r$\n` + FileWrite $0 `echo KHIOPS_TMP_DIR: Khiops' temporary directory location (default : the$\r$\n` + FileWrite $0 `echo system's default) This location can be modified from the tool as well$\r$\n` + FileWrite $0 `echo KHIOPS_MEMORY_LIMIT: Khiops' memory limit (default : the system's$\r$\n` + FileWrite $0 `echo memory limit). This setting is ignored if it is above the system's$\r$\n` + FileWrite $0 `echo memory limit. It can only be reduced from the tool$\r$\n` + FileWrite $0 `echo KHIOPS_API_MODE: standard or api mode for the management of output result files created by Khiops$\r$\n` + FileWrite $0 `echo In standard mode, the result files are stored in the train database directory,$\r$\n` + FileWrite $0 `echo unless an absolute path is specified, and the file extension is forced if necessary.$\r$\n` + FileWrite $0 `echo In api mode, the result files are stored in the current working directory, using the specified results as is.$\r$\n` + FileWrite $0 `echo . default behavior if not set: standard mode$\r$\n` + FileWrite $0 `echo . set to 'true' to force standard mode$\r$\n` + FileWrite $0 `echo . set to 'false' to force api mode$\r$\n` + FileWrite $0 `echo KHIOPS_RAW_GUI: graphical user interface for file name selection$\r$\n` + FileWrite $0 `echo . default behavior if not set: depending on the file drivers available for Khiops$\r$\n` + FileWrite $0 `echo . set to 'true' to allow file name selection with uri schemas$\r$\n` + FileWrite $0 `echo . set to 'false' to allow local file name selection only with a file selection dialog$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `if not %2.==. exit /b 1$\r$\n` + FileWrite $0 `if %1.==-h. exit /b 0$\r$\n` + FileWrite $0 `exit /b 1$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Set Khiops env variables$\r$\n` + FileWrite $0 `:SET_ENV$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Test if Khiops environment already set up$\r$\n` + FileWrite $0 `if "%KHIOPS_HOME%".=="". set KHIOPS_HOME=$_EnvKhiopsHome$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM KHIOPS_PATH$\r$\n` + FileWrite $0 `set KHIOPS_PATH=%KHIOPS_HOME%\bin$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM KHIOPS_CLASSPATH$\r$\n` + FileWrite $0 `set KHIOPS_CLASSPATH=%KHIOPS_HOME%\bin\norm.jar$\r$\n` + FileWrite $0 `set KHIOPS_CLASSPATH=%KHIOPS_HOME%\bin\khiops.jar;%KHIOPS_CLASSPATH%$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM KHIOPS_LAST_RUN_DIR$\r$\n` + FileWrite $0 `if "%KHIOPS_LAST_RUN_DIR%".=="". set KHIOPS_LAST_RUN_DIR=%USERPROFILE%\khiops_data\lastrun$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM KHIOPS_PROC_NUMBER$\r$\n` + FileWrite $0 `if "%KHIOPS_PROC_NUMBER%".=="". set KHIOPS_PROC_NUMBER=$_EnvProcessNumber$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM KHIOPS_MPI_COMMAND$\r$\n` + FileWrite $0 `REM Priority$\r$\n` + FileWrite $0 `REM 0: Idle$\r$\n` + FileWrite $0 `REM 1: Below normal$\r$\n` + FileWrite $0 `REM 2: Normal$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `set KHIOPS_MPI_COMMAND="%MSMPI_BIN%mpiexec" -al spr:P -n %KHIOPS_PROC_NUMBER% /priority 1$\r$\n` + FileWrite $0 `if %KHIOPS_PROC_NUMBER%==1 set KHIOPS_MPI_COMMAND=$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM KHIOPS_JAVA_PATH$\r$\n` + FileWrite $0 `REM May not work in case of a recent new installation of Java on the PC$\r$\n` + FileWrite $0 `set KHIOPS_JAVA_PATH=$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Set user Java Home$\r$\n` + FileWrite $0 `REM Uncomment the following line your own Java version$\r$\n` + FileWrite $0 `REM set _KHIOPS_JAVA_HOME=C:\Program Files\Java\jre${JavaRequiredFullVersion}$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_HOME_0$\r$\n` + FileWrite $0 `set _KHIOPS_JAVA_HOME_ORIGIN=java home set by user$\r$\n` + FileWrite $0 `REM Search if set by user$\r$\n` + FileWrite $0 `if not "%_KHIOPS_JAVA_HOME%".=="". goto JAVA_HOME_LAST$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_HOME_1$\r$\n` + FileWrite $0 `set _KHIOPS_JAVA_HOME_ORIGIN=found java recent version in registry$\r$\n` + FileWrite $0 `REM Search for a recent version of Java (greater than 8)$\r$\n` + FileWrite $0 `REM Search Java Version from registry and set _KHIOPS_JAVA_VERSION env var$\r$\n` + FileWrite $0 `for /F "tokens=2*" %%f in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE" -v CurrentVersion 2^>nul') do set _KHIOPS_JAVA_VERSION=%%g$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Search Java Home from registry and set _KHIOPS_JAVA_HOME env var$\r$\n` + FileWrite $0 `for /F "tokens=2*" %%f in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\JRE\%_KHIOPS_JAVA_VERSION%" -v JavaHome 2^>nul') do set _KHIOPS_JAVA_HOME=%%g$\r$\n` + FileWrite $0 `if not "%_KHIOPS_JAVA_HOME%".=="". goto JAVA_HOME_LAST$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_HOME_2$\r$\n` + FileWrite $0 `set _KHIOPS_JAVA_HOME_ORIGIN=found java version in registry$\r$\n` + FileWrite $0 `REM Search for a previous version of Java$\r$\n` + FileWrite $0 `REM Search Java Version from registry and set _KHIOPS_JAVA_VERSION env var$\r$\n` + FileWrite $0 `for /F "tokens=2*" %%f in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" -v CurrentVersion 2^>nul') do set _KHIOPS_JAVA_VERSION=%%g$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Search Java Home from registry and set _KHIOPS_JAVA_HOME env var$\r$\n` + FileWrite $0 `for /F "tokens=2*" %%f in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\%_KHIOPS_JAVA_VERSION%" -v JavaHome 2^>nul') do set _KHIOPS_JAVA_HOME=%%g$\r$\n` + FileWrite $0 `if not "%_KHIOPS_JAVA_HOME%".=="". goto JAVA_HOME_LAST$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_HOME_3$\r$\n` + FileWrite $0 `set _KHIOPS_JAVA_HOME_ORIGIN=found in java installation sub dirs$\r$\n` + FileWrite $0 `REM Heuristic search in sub-directories of java installation dir$\r$\n` + FileWrite $0 `if not exist "%programFiles%\java" goto JAVA_HOME_LAST$\r$\n` + # Following instruction surrounding by simple quotes ', to allow internal use of back-quotes ` + FileWrite $0 'FOR /F "usebackq delims=" %%i IN (`where /R "%programFiles%\java" jvm.dll`) DO (set KHIOPS_JAVA_PATH=%%~di%%~pi)$\r$\n' + FileWrite $0 `if exist "%KHIOPS_JAVA_PATH%\jvm.dll" goto JAVA_END$\r$\n` + FileWrite $0 `if not exist "%KHIOPS_JAVA_PATH%\jvm.dll" set KHIOPS_JAVA_PATH=$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_HOME_4$\r$\n` + FileWrite $0 `set _KHIOPS_JAVA_HOME_ORIGIN=default installation settings$\r$\n` + FileWrite $0 `REM Set default Java Home if not found in registry$\r$\n` + FileWrite $0 `if "%_KHIOPS_JAVA_HOME%".=="". set _KHIOPS_JAVA_HOME=C:\Program Files\Java\jre${JavaRequiredFullVersion}$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_HOME_LAST$\r$\n` + FileWrite $0 `REM Add java runtime dir to KHIOPS_JAVA_PATH$\r$\n` + FileWrite $0 `if exist "%_KHIOPS_JAVA_HOME%\bin\client\jvm.dll" set KHIOPS_JAVA_PATH=%_KHIOPS_JAVA_HOME%\bin\client$\r$\n` + FileWrite $0 `if exist "%_KHIOPS_JAVA_HOME%\bin\server\jvm.dll" set KHIOPS_JAVA_PATH=%_KHIOPS_JAVA_HOME%\bin\server$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `:JAVA_END$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `$\r$\n` + FileWrite $0 `REM Print the environment list on the standard output$\r$\n` + FileWrite $0 `echo KHIOPS_HOME %KHIOPS_HOME%$\r$\n` + FileWrite $0 `echo KHIOPS_PATH %KHIOPS_PATH%$\r$\n` + FileWrite $0 `echo KHIOPS_MPI_COMMAND %KHIOPS_MPI_COMMAND%$\r$\n` + FileWrite $0 `echo KHIOPS_MPI_LIB %KHIOPS_MPI_LIB%$\r$\n` + FileWrite $0 `echo KHIOPS_JAVA_PATH %KHIOPS_JAVA_PATH%$\r$\n` + FileWrite $0 `echo KHIOPS_CLASSPATH %KHIOPS_CLASSPATH%$\r$\n` + FileWrite $0 `echo KHIOPS_LAST_RUN_DIR %KHIOPS_LAST_RUN_DIR%$\r$\n` + FileWrite $0 `echo KHIOPS_PROC_NUMBER %KHIOPS_PROC_NUMBER%$\r$\n` + FileWrite $0 `echo KHIOPS_TMP_DIR %KHIOPS_TMP_DIR%$\r$\n` + FileWrite $0 `echo KHIOPS_MEMORY_LIMIT %KHIOPS_MEMORY_LIMIT%$\r$\n` + FileWrite $0 `echo KHIOPS_API_MODE %KHIOPS_API_MODE%$\r$\n` + FileWrite $0 `echo KHIOPS_RAW_GUI %KHIOPS_RAW_GUI%$\r$\n` + FileWrite $0 `exit /b 0$\r$\n` + + # Close file + FileClose $0 +FunctionEnd diff --git a/packaging/windows/nsis/GetCoresCount.nsh b/packaging/windows/nsis/GetCoresCount.nsh new file mode 100644 index 000000000..74822c04e --- /dev/null +++ b/packaging/windows/nsis/GetCoresCount.nsh @@ -0,0 +1,54 @@ +# Copied entirely from +# http://stackoverflow.com/questions/29911549/cpu-features-getcount-return-incorrect-number-for-cpu-cores +!include LogicLib.nsh +!ifndef ERROR_INSUFFICIENT_BUFFER +!define ERROR_INSUFFICIENT_BUFFER 122 +!endif +!define RelationProcessorCore 0 + +!if "${NSIS_PTR_SIZE}" <= 4 +Function GetProcessorPhysCoreCount +System::Store S +StrCpy $9 0 ; 0 if we fail +System::Call 'kernel32::GetLogicalProcessorInformationEx(i${RelationProcessorCore},i,*i0r2)i.r0?e' +Pop $3 +${If} $3 = ${ERROR_INSUFFICIENT_BUFFER} +${AndIf} $2 <> 0 + System::Alloc $2 + System::Call 'kernel32::GetLogicalProcessorInformationEx(i${RelationProcessorCore},isr1,*ir2r2)i.r0' + Push $1 + ${If} $0 <> 0 + loop_7: + IntOp $9 $9 + 1 + System::Call *$1(i,i.r3) + IntOp $1 $1 + $3 + IntOp $2 $2 - $3 + IntCmp $2 0 "" loop_7 loop_7 + ${EndIf} + Pop $1 + System::Free $1 +${Else} + System::Call 'kernel32::GetLogicalProcessorInformation(i,*i0r2)i.r0?e' + Pop $3 + ${If} $3 = ${ERROR_INSUFFICIENT_BUFFER} + System::Alloc $2 + System::Call 'kernel32::GetLogicalProcessorInformation(isr1,*ir2r2)i.r0' + Push $1 + ${If} $0 <> 0 + loop_v: + System::Call *$1(i,i.r3) + ${If} $3 == ${RelationProcessorCore} + IntOp $9 $9 + 1 + ${EndIf} + IntOp $1 $1 + 24 + IntOp $2 $2 - 24 + IntCmp $2 0 "" loop_v loop_v + ${EndIf} + Pop $1 + System::Free $1 + ${EndIf} +${EndIf} +Push $9 +System::Store L +FunctionEnd +!endif diff --git a/packaging/windows/nsis/KhiopsGlobals.nsh b/packaging/windows/nsis/KhiopsGlobals.nsh new file mode 100644 index 000000000..72f5cabbd --- /dev/null +++ b/packaging/windows/nsis/KhiopsGlobals.nsh @@ -0,0 +1,14 @@ +# Global Definitions +# ------------------ + +# Minimal required Java version +!define JavaRequiredVersion "1.8" + +# Minimal required Java update version of the package installer +!define JavaRequiredVersionUpdate "181" + +# Minimal required full Java version (stored in the registry) +!define JavaRequiredFullVersion "1.8.0_181" + +# Minimal required MPI version +!define MPIRequiredVersion "10.0" diff --git a/packaging/windows/nsis/KhiopsPrerequisiteFunc.nsh b/packaging/windows/nsis/KhiopsPrerequisiteFunc.nsh new file mode 100644 index 000000000..45f5832bf --- /dev/null +++ b/packaging/windows/nsis/KhiopsPrerequisiteFunc.nsh @@ -0,0 +1,134 @@ +!include "FileFunc.nsh" +!include "x64.nsh" +!include "WordFunc.nsh" + +# To deactivate the requirements installation define DO_NOT_INSTALL_REQUIREMENTS + +# Detects and loads Java installation path and the JRE version +# - Defines JavaInstalledVersion and JavaInstallationPath +# - If the detection fails JavaInstalledVersion is set to "" +Function DetectAndLoadJavaEnvironment + # Installed version + Var /GLOBAL JavaInstalledVersion + + # Installation path + Var /GLOBAL JavaInstallationPath + + # Set the 64 bit registry to detect the correct version of Java + SetRegView 64 + + # Detection of JRE for Java >= 10 + StrCpy $JavaInstalledVersion "" + StrCpy $JavaInstallationPath "" + StrCpy $1 "SOFTWARE\JavaSoft\JRE" + StrCpy $2 0 + ReadRegStr $2 HKLM "$1" "CurrentVersion" + ${If} $2 != "" + ReadRegStr $3 HKLM "$1\$2" "JavaHome" + ${If} $3 != "" + StrCpy $JavaInstalledVersion $2 + StrCpy $JavaInstallationPath $3 + ${EndIf} + ${EndIf} + + # Debug message + !ifdef DEBUG + Messagebox MB_OK "JRE (>=10.0): required=${JavaRequiredVersion}, installed=$JavaInstalledVersion, path=$JavaInstallationPath" + !endif + + # Detection of JRE for Java < 10.0 + ${If} $JavaInstalledVersion == "" + StrCpy $JavaInstallationPath "" + StrCpy $1 "SOFTWARE\JavaSoft\Java Runtime Environment" + StrCpy $2 0 + ReadRegStr $2 HKLM "$1" "CurrentVersion" + ${If} $2 != "" + ReadRegStr $3 HKLM "$1\$2" "JavaHome" + ${If} $3 != "" + StrCpy $JavaInstallationPath $3 + StrCpy $JavaInstalledVersion $2 + ${EndIf} + ${EndIf} + ${EndIf} + + # Debug message + !ifdef DEBUG + Messagebox MB_OK "JRE (< 10.0): required=${JavaRequiredVersion}, installed=$JavaInstalledVersion, path=$JavaInstallationPath" + !endif + + # Get back to 32 bit registry + SetRegView 32 +FunctionEnd + +# Installs Java +Function InstallJava +!ifndef DO_NOT_INSTALL_REQUIREMENTS + # Write the JRE installer + SetOutPath $TEMP + File ${JRE_INSTALLER_PATH} + + # Execute the JRE installer silently + Var /Global JRE_INSTALLER_FILENAME + ${GetFileName} ${JRE_INSTALLER_PATH} $JRE_INSTALLER_FILENAME + nsexec::Exec '"$TEMP\$JRE_INSTALLER_FILENAME" INSTALL_SILENT=1 REBOOT=0' + Pop $0 + DetailPrint "Installation of Java JRE: $0" + + # Delete JRE installer + Delete "$TEMP\$JRE_INSTALLER_FILENAME" + + # Load the Java Environment + Call DetectAndLoadJavaEnvironment + + # Fail if the required version is newer than installed version + ${VersionCompare} "${JavaRequiredVersion}" "$JavaInstalledVersion" $0 + ${If} $0 == 1 + Messagebox MB_OK "Could not install Java runtime (version ${JavaRequiredVersion}): Khiops will run only in batch mode. Try installing Java JRE directly before installing to Khiops." /SD IDOK + ${EndIf} +!endif +FunctionEnd + + +# Detects MPI and loads its version +# - Defines MPIInstalledVersion +# - If not installed MPIInstalledVersion is equal to 0 +Function DetectAndLoadMPIEnvironment + # Installed version + Var /GLOBAL MPIInstalledVersion + StrCpy $MPIInstalledVersion 0 + + # Look in the registry for the MPI installation + StrCpy $1 "SOFTWARE\Microsoft\MPI" + StrCpy $2 0 + ReadRegStr $2 HKLM "$1" "Version" + StrCpy $MPIInstalledVersion $2 +FunctionEnd + + +# Installs MPI +Function InstallMPI +!ifndef DO_NOT_INSTALL_REQUIREMENTS + # Save MPI installer + SetOutPath $TEMP + File ${MSMPI_INSTALLER_PATH} + + # Execute MPI installer + Var /Global MSMPI_INSTALLER_FILENAME + ${GetFileName} ${MSMPI_INSTALLER_PATH} $MSMPI_INSTALLER_FILENAME + nsexec::Exec '"$TEMP\$MSMPI_INSTALLER_FILENAME" -unattend -force -minimal' + Pop $0 + DetailPrint "Installation of MPI: $0" + + # Delete MSMPI installer + Delete "$TEMP\$MSMPI_INSTALLER_FILENAME" + + # Load MPI environment (MPIInstalledVersion) + Call DetectAndLoadMPIEnvironment + + # Show an error if the required version is newer than installed version + ${VersionCompare} "${MPIRequiredVersion}" "$MPIInstalledVersion" $0 + ${If} $0 == 1 + Messagebox MB_OK "Could not install MPI runtime (version ${MPIRequiredVersion}): Khiops will not run. Try installing Microsoft MPI directly before installing Khiops." /SD IDOK + ${EndIf} +!endif +FunctionEnd diff --git a/packaging/windows/nsis/README.md b/packaging/windows/nsis/README.md new file mode 100644 index 000000000..e05399a25 --- /dev/null +++ b/packaging/windows/nsis/README.md @@ -0,0 +1,77 @@ +# Khiops NSIS packaging +This folder contains the scripts to generate the Khiops Windows installer. It is built with +[NSIS](https://nsis.sourceforge.io/Download). See also the [Release Process wiki +page](https://github.com/KhiopsML/khiops/wiki/Release-Process). + +## What the installer does +Besides installing the Khiops executables, the installer automatically detects the presence of: +- [Microsoft MPI](https://learn.microsoft.com/en-us/message-passing-interface/microsoft-mpi) +- [Java Runtime Environment](https://www.java.com/en/download/manual.jsp) + +and installs them if necessary. + + +It also installs: +- The [Khiops Visualization](https://github.com/khiopsrelease/kv-release/releases/latest) and + [Khiops Covisualization](https://github.com/khiopsrelease/kc-release/releases/latest) apps by + executing their corresponding installers. +- The [sample datasets](https://github.com/KhiopsML/khiops-samples/releases/latest). +- Documentation files: + - PDF Guides . + - README.txt and WHATSNEW.txt (obtained from the sources at (../../common/khiops)) + +## How to obtain the package assets +All the package assets (installers, documentation, etc) are available at the +[`khiops-win-install-assets`](https://github.com/KhiopsML/khiops-win-install-assets/releases/latest) +repository. + +## How to build the installer manually +1) Install NSIS and make sure `makensis` it is available in the `%PATH%`. +2) Download and decompress the package assets to your machine. +3) [Build Khiops in Release mode](https://github.com/KhiopsML/khiops/wiki/Building-Khiops) +4) In a console, go to the `packaging/windows/nsis` directory and execute +```bat +%REM We assume the package assets were downoladed to packaging\windows\nsis\assets +makensis ^ + /DKHIOPS_VERSION=10.2.0-preview ^ + /DKHIOPS_REDUCED_VERSION=10.2.0 ^ + /DKHIOPS_WINDOWS_BUILD_DIR=..\..\..\build\windows-msvc-release ^ + /DJRE_INSTALLER_PATH=.\assets\jre-8u371-windows-x64.exe ^ + /DJRE_VERSION=1.8 ^ + /DMSMPI_INSTALLER_PATH=.\assets\msmpisetup.exe ^ + /DMSMPI_VERSION=10.1.3 ^ + /DKHIOPS_VIZ_INSTALLER_PATH=.\assets\khiops-visualization-Setup-11.0.2.exe ^ + /DKHIOPS_COVIZ_INSTALLER_PATH=.\assets\khiops-covisualization-Setup-10.2.4.exe ^ + /DKHIOPS_SAMPLES_DIR=.\assets\samples ^ + /DKHIOPS_DOC_DIR=.\assets\doc ^ + khiops.nsi +``` + +The resulting installer will be at `packaging/windows/nsis/khiops-10.1.1-setup.exe`. + +_Note 1_: See [below](#build-script-arguments) for the details of the installer builder script arguments. + +_Note 2_: If your are using powershell replace the `^` characters by backticks `` ` `` in the +multi-line command. + + +## Github Workflow +This process is automatized in the [pack-nsis.yml workflow](../../../.github/workflows/pack-nsis.yml). + +## Build script arguments +All the arguments are mandatory except for `DEBUG`, they must be prefixed by `/D` and post fixed by +`=` to specify a value. + +- `DEBUG`: Enables debug messages in the installer. They are "OK" message boxes. +- `KHIOPS_VERSION`: Khiops version for the installer. +- `KHIOPS_REDUCED_VERSION`: Khiops version without suffix and only digits and periods. +- `KHIOPS_WINDOWS_BUILD_DIR`: Build directory for (usually `build\windows-msvc-release` relative to + the project root). +- `JRE_INSTALLER_PATH`: Path to the Java Runtime Environment (JRE) installer. +- `JRE_VERSION`: JRE version. +- `MSMPI_INSTALLER_PATH`: Path to the Microsoft MPI (MS-MPI) installer. +- `MSMPI_MPI_VERSION`: MS-MPI version. +- `KHIOPS_VIZ_INSTALLER_PATH`: Path to the Khiops Visualization installer. +- `KHIOPS_COVIZ_INSTALLER_PATH`: Path to the Khiops Covisualization installer. +- `KHIOPS_SAMPLES_DIR`: Path to the sample datasets directory. +- `KHIOPS_DOC_DIR`: Path to the directory containing the documentation. diff --git a/packaging/windows/nsis/images/headerimage.bmp b/packaging/windows/nsis/images/headerimage.bmp new file mode 100644 index 000000000..16942a3ce Binary files /dev/null and b/packaging/windows/nsis/images/headerimage.bmp differ diff --git a/packaging/windows/nsis/images/installer.ico b/packaging/windows/nsis/images/installer.ico new file mode 100644 index 000000000..95d877710 Binary files /dev/null and b/packaging/windows/nsis/images/installer.ico differ diff --git a/packaging/windows/nsis/images/welcomefinish.bmp b/packaging/windows/nsis/images/welcomefinish.bmp new file mode 100644 index 000000000..def59f3a7 Binary files /dev/null and b/packaging/windows/nsis/images/welcomefinish.bmp differ diff --git a/packaging/windows/nsis/khiops.nsi b/packaging/windows/nsis/khiops.nsi new file mode 100644 index 000000000..8c28d718c --- /dev/null +++ b/packaging/windows/nsis/khiops.nsi @@ -0,0 +1,818 @@ +# Khiops installer builder NSIS script + +# Set Unicode to avoid warning 7998: "ANSI targets are deprecated" +Unicode True + +# Set compresion to LZMA (faster) +SetCompressor /SOLID lzma + +# Include NSIS librairies +!include "LogicLib.nsh" +!include "MUI2.nsh" +!include "FileFunc.nsh" +!include "x64.nsh" +!include "winmessages.nsh" + +# Include Custom libraries +!include "KhiopsGlobals.nsh" +!include "GetCoresCount.nsh" +!include "CreateKhiopsEnvCmdFileFunc.nsh" +!include "CreateKhiopsCmdFileFunc.nsh" +!include "KhiopsPrerequisiteFunc.nsh" + +# Definitions for registry change notification +!define SHCNE_ASSOCCHANGED 0x8000000 +!define SHCNF_IDLIST 0 + +# Get installation folder from registry if available +InstallDirRegKey HKLM Software\khiops "" + +# Request admin privileges +RequestExecutionLevel admin + +# Make it aware of HiDPI screens +ManifestDPIAware true + +# Macro to check input parameter definitions +!macro CheckInputParameter ParameterName + !ifndef ${ParameterName} + !error "${ParameterName} is not defined. Use the flag '-D${ParameterName}=...' to define it." + !endif +!macroend + +# Check the mandatory input definitions +!insertmacro CheckInputParameter KHIOPS_VERSION +!insertmacro CheckInputParameter KHIOPS_REDUCED_VERSION +!insertmacro CheckInputParameter KHIOPS_WINDOWS_BUILD_DIR +!insertmacro CheckInputParameter KHIOPS_VIZ_INSTALLER_PATH +!insertmacro CheckInputParameter KHIOPS_COVIZ_INSTALLER_PATH +!insertmacro CheckInputParameter JRE_INSTALLER_PATH +!insertmacro CheckInputParameter JRE_VERSION +!insertmacro CheckInputParameter MSMPI_INSTALLER_PATH +!insertmacro CheckInputParameter MSMPI_VERSION +!insertmacro CheckInputParameter KHIOPS_SAMPLES_DIR +!insertmacro CheckInputParameter KHIOPS_DOC_DIR + +# Application name and installer file name +Name "Khiops ${KHIOPS_VERSION}" +OutFile "khiops-${KHIOPS_VERSION}-setup.exe" + +######################## +# Variable definitions # +######################## + +# MPI installation flag +Var /GLOBAL IsMPIRequired + +# Requirements installation flags +Var /GLOBAL MPIInstallationNeeded +Var /GLOBAL JavaInstallationNeeded + +# Requirements installation messages +Var /GLOBAL MPIInstallationMessage +Var /GLOBAL JavaInstallationMessage + +# Number of physical cores +Var /GLOBAL PhysicalCoresNumber + +# Number of processes to use +Var /GLOBAL ProcessNumber + +# Previous Uninstaller data +Var /GLOBAL PreviousUninstaller +Var /GLOBAL PreviousVersion + +# %Public%, %AllUsersProfile% (%ProgramData%) and samples directory +Var /GLOBAL WinPublicDir +Var /GLOBAL AllUsersProfileDir +Var /GLOBAL GlobalKhiopsDataDir +Var /GLOBAL SamplesInstallDir + +# Root key for the uninstaller in the windows registry +!define UninstallerKey "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" + +##################################### +# Modern UI Interface Configuration # +##################################### + +# General configuration +!define MUI_HEADERIMAGE +!define MUI_HEADERIMAGE_BITMAP ".\images\headerimage.bmp" +!define MUI_HEADERIMAGE_LEFT +!define MUI_WELCOMEFINISHPAGE_BITMAP ".\images\welcomefinish.bmp" +!define MUI_ABORTWARNING +!define MUI_ICON ".\images\installer.ico" +!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico" +BrandingText "Orange" + +# Welcome page +!define MUI_WELCOMEPAGE_TITLE "Welcome to the Khiops ${KHIOPS_VERSION} Setup Wizard" +!define MUI_WELCOMEPAGE_TEXT \ + "Khiops is a data mining tool includes data preparation and scoring, visualization, coclustering and covisualization.$\r$\n$\r$\n$\r$\n$\r$\n$(MUI_${MUI_PAGE_UNINSTALLER_PREFIX}TEXT_WELCOME_INFO_TEXT)" +!insertmacro MUI_PAGE_WELCOME + +# Licence page +!insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE" + +# Custom page for requirements software +Page custom RequirementsPageShow RequirementsPageLeave + +# Install directory choice page +!insertmacro MUI_PAGE_DIRECTORY + +# Install files choice page +!insertmacro MUI_PAGE_INSTFILES + +# Final page +!define MUI_FINISHPAGE_RUN +!define MUI_FINISHPAGE_RUN_TEXT "Create desktop shortcut" +!define MUI_FINISHPAGE_RUN_FUNCTION "CreateDesktopShortcuts" +!define MUI_FINISHPAGE_TEXT "$\r$\n$\r$\nThank you for installing Khiops." +!define MUI_FINISHPAGE_LINK "khiops.org" +!define MUI_FINISHPAGE_LINK_LOCATION "https://khiops.org" +!insertmacro MUI_PAGE_FINISH + +# Uninstaller pages +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES + +# Language (must be defined after uninstaller) +!insertmacro MUI_LANGUAGE "English" + +####################### +# Version Information # +####################### + +VIProductVersion "${KHIOPS_REDUCED_VERSION}.0" +VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Khiops" +VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Orange" +VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright (c) 2023 Orange" +VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Khiops Installer" +VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${KHIOPS_VERSION}" + +###################### +# Installer Sections # +###################### + +Section "Install" SecInstall + # In order to have shortcuts and documents for all users + SetShellVarContext all + + # Detect Java + Call RequirementsDetection + + # Install java if needed + ${If} $JavaInstallationNeeded == "1" + Call InstallJava + ${EndIf} + + # MPI installation is always required, because Khiops is linked with MPI DLL + ${If} $MPIInstallationNeeded == "1" + Call InstallMPI + ${EndIf} + + # Activate file overwrite + SetOverwrite on + + # Install executables and java libraries + SetOutPath "$INSTDIR\bin" + File "${KHIOPS_WINDOWS_BUILD_DIR}\bin\MODL.exe" + File "${KHIOPS_WINDOWS_BUILD_DIR}\bin\MODL_Coclustering.exe" + File "${KHIOPS_WINDOWS_BUILD_DIR}\jars\norm.jar" + File "${KHIOPS_WINDOWS_BUILD_DIR}\jars\khiops.jar" + + # Install Docs + SetOutPath "$INSTDIR" + File "/oname=LICENSE.txt" "..\..\..\LICENSE" + File "..\..\common\khiops\README.txt" + File "..\..\common\khiops\WHATSNEW.txt" + SetOutPath "$INSTDIR\doc" + File /nonfatal /a /r "${KHIOPS_DOC_DIR}\" + + # Install icons + SetOutPath "$INSTDIR\bin\icons" + File ".\images\installer.ico" + File "..\..\common\images\khiops.ico" + File "..\..\common\images\khiops_coclustering.ico" + + # Set the samples directory to be located either within %PUBLIC% or %ALLUSERSPROFILE% as fallback + ReadEnvStr $WinPublicDir PUBLIC + ReadEnvStr $AllUsersProfileDir ALLUSERSPROFILE + ${If} $WinPublicDir != "" + StrCpy $GlobalKhiopsDataDir "$WinPublicDir\khiops_data" + ${ElseIf} $AllUsersProfileDir != "" + StrCpy $GlobalKhiopsDataDir "$AllUsersProfileDir\khiops_data" + ${Else} + StrCpy $GlobalKhiopsDataDir "" + ${EndIf} + + # Debug message + !ifdef DEBUG + ${If} $GlobalKhiopsDataDir == "" + Messagebox MB_OK "Could find PUBLIC nor ALLUSERSPROFILE directories. Samples not installed." + ${Else} + Messagebox MB_OK "Samples will be installed at $GlobalKhiopsDataDir\samples." + ${EndIf} + !endif + + # Install samples only if the directory is defined + ${If} $GlobalKhiopsDataDir != "" + StrCpy $SamplesInstallDir "$GlobalKhiopsDataDir\samples" + SetOutPath "$SamplesInstallDir" + File "/oname=README.txt" "${KHIOPS_SAMPLES_DIR}\README.md" + SetOutPath "$SamplesInstallDir\Adult" + File "${KHIOPS_SAMPLES_DIR}\Adult\Adult.kdic" + File "${KHIOPS_SAMPLES_DIR}\Adult\Adult.txt" + SetOutPath "$SamplesInstallDir\Iris" + File "${KHIOPS_SAMPLES_DIR}\Iris\Iris.kdic" + File "${KHIOPS_SAMPLES_DIR}\Iris\Iris.txt" + SetOutPath "$SamplesInstallDir\Mushroom" + File "${KHIOPS_SAMPLES_DIR}\Mushroom\Mushroom.kdic" + File "${KHIOPS_SAMPLES_DIR}\Mushroom\Mushroom.txt" + SetOutPath "$SamplesInstallDir\Letter" + File "${KHIOPS_SAMPLES_DIR}\Letter\Letter.kdic" + File "${KHIOPS_SAMPLES_DIR}\Letter\Letter.txt" + SetOutPath "$SamplesInstallDir\SpliceJunction" + File "${KHIOPS_SAMPLES_DIR}\SpliceJunction\SpliceJunction.kdic" + File "${KHIOPS_SAMPLES_DIR}\SpliceJunction\SpliceJunction.txt" + File "${KHIOPS_SAMPLES_DIR}\SpliceJunction\SpliceJunctionDNA.txt" + SetOutPath "$SamplesInstallDir\Accidents" + File "${KHIOPS_SAMPLES_DIR}\Accidents\Accidents.kdic" + File "${KHIOPS_SAMPLES_DIR}\Accidents\Accidents.txt" + File "${KHIOPS_SAMPLES_DIR}\Accidents\Places.txt" + File "${KHIOPS_SAMPLES_DIR}\Accidents\Users.txt" + File "${KHIOPS_SAMPLES_DIR}\Accidents\Vehicles.txt" + File "${KHIOPS_SAMPLES_DIR}\Accidents\train.py" + File "/oname=README.txt" "${KHIOPS_SAMPLES_DIR}\Accidents\README.md" + SetOutPath "$SamplesInstallDir\Accidents\raw" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\AccidentsPreprocess.kdic" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\Description_BD_ONISR.pdf" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\Licence_Ouverte.pdf" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\caracteristiques-2018.csv" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\lieux-2018.csv" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\usagers-2018.csv" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\vehicules-2018.csv" + File "${KHIOPS_SAMPLES_DIR}\Accidents\raw\preprocess.py" + File "/oname=README.txt" "${KHIOPS_SAMPLES_DIR}\Accidents\raw\README.md" + SetOutPath "$SamplesInstallDir\AccidentsSummary" + File "${KHIOPS_SAMPLES_DIR}\AccidentsSummary\Accidents.kdic" + File "${KHIOPS_SAMPLES_DIR}\AccidentsSummary\Accidents.txt" + File "${KHIOPS_SAMPLES_DIR}\AccidentsSummary\Vehicles.txt" + File "/oname=README.txt" "${KHIOPS_SAMPLES_DIR}\AccidentsSummary\README.md" + SetOutPath "$SamplesInstallDir\Customer" + File "${KHIOPS_SAMPLES_DIR}\Customer\Customer.kdic" + File "${KHIOPS_SAMPLES_DIR}\Customer\CustomerRecoded.kdic" + File "${KHIOPS_SAMPLES_DIR}\Customer\Customer.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\Address.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\Service.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\Usage.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\sort_and_recode_customer.py" + File "/oname=README.txt" "${KHIOPS_SAMPLES_DIR}\Customer\README.md" + SetOutPath "$SamplesInstallDir\Customer\unsorted" + File "${KHIOPS_SAMPLES_DIR}\Customer\unsorted\Customer-unsorted.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\unsorted\Address-unsorted.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\unsorted\Service-unsorted.txt" + File "${KHIOPS_SAMPLES_DIR}\Customer\unsorted\Usage-unsorted.txt" + SetOutPath "$SamplesInstallDir\CustomerExtended" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Customer.kdic" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\CustomerRecoded.kdic" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Customer.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Address.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Service.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Usage.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\City.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Country.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\Product.txt" + File "${KHIOPS_SAMPLES_DIR}\CustomerExtended\recode_customer.py" + File "/oname=README.txt" "${KHIOPS_SAMPLES_DIR}\CustomerExtended\README.md" + ${EndIf} + + + # Install Khiops Visualization App + + # Add the installer file + SetOutPath $TEMP + File ${KHIOPS_VIZ_INSTALLER_PATH} + + # Execute Khiops visualization installer: + # - It is not executed with silent mode so the user can customize the install + # - It is executed with "cmd /C" so it opens the installer options window + Var /Global KHIOPS_VIZ_INSTALLER_FILENAME + ${GetFileName} ${KHIOPS_VIZ_INSTALLER_PATH} $KHIOPS_VIZ_INSTALLER_FILENAME + ${If} ${Silent} + nsexec::Exec 'cmd /C "$KHIOPS_VIZ_INSTALLER_FILENAME /S"' + ${Else} + nsexec::Exec 'cmd /C "$KHIOPS_VIZ_INSTALLER_FILENAME"' + ${EndIf} + Pop $0 + DetailPrint "Installation of Khiops visualization: $0" + + # Delete the installer + Delete "$TEMP\KHIOPS_VIZ_INSTALLER_FILENAME" + + + # Execute Khiops covisualization installer: + # Same rules as above with the visualization + + # Files to install in installer directory + File ${KHIOPS_COVIZ_INSTALLER_PATH} + + Var /Global KHIOPS_COVIZ_INSTALLER_FILENAME + ${GetFileName} ${KHIOPS_COVIZ_INSTALLER_PATH} $KHIOPS_COVIZ_INSTALLER_FILENAME + ${If} ${Silent} + nsexec::Exec 'cmd /C "$TEMP\$KHIOPS_COVIZ_INSTALLER_FILENAME /S"' + ${Else} + nsexec::Exec 'cmd /C "$TEMP\$KHIOPS_COVIZ_INSTALLER_FILENAME"' + ${EndIf} + Pop $0 + DetailPrint "Installation of Khiops covisualization: $0" + + # Delete the installer + Delete "$TEMP\$KHIOPS_COVIZ_INSTALLER_FILENAME" + + + ############################# + # Finalize the installation # + ############################# + + + # Creation of Khiops cmd files for Khiops et Khiops Coclustering + StrCpy $ProcessNumber $PhysicalCoresNumber + ${If} $PhysicalCoresNumber >= 2 + IntOp $ProcessNumber $PhysicalCoresNumber + 1 + ${EndIf} + ${CreateKhiopsEnvCmdFile} "$INSTDIR\bin\khiops_env.cmd" "$INSTDIR" $ProcessNumber + ${CreateKhiopsCmdFile} "$INSTDIR\bin\khiops.cmd" "MODL" "" "$INSTDIR" "scenario._kh" "log.txt" $IsMPIRequired + ${CreateKhiopsCmdFile} "$INSTDIR\bin\khiops_coclustering.cmd" "MODL_Coclustering" "" "$INSTDIR" "scenario._khc" "logc.txt" "0" + + # Create the Khiops shell + FileOpen $0 "$INSTDIR\bin\shell_khiops.cmd" w + FileWrite $0 '@echo off$\r$\n' + FileWrite $0 'REM Open a shell session with access to Khiops$\r$\n' + FileWrite $0 `if "%KHIOPS_HOME%".=="". set KHIOPS_HOME=$INSTDIR$\r$\n` + FileWrite $0 'set path=%KHIOPS_HOME%\bin;%path%$\r$\n' + FileWrite $0 'title Shell Khiops$\r$\n' + FileWrite $0 '%comspec% /K "echo Welcome to Khiops scripting mode & echo Type khiops -h or khiops_coclustering -h to get help' + FileClose $0 + + # Create the uninstaller + WriteUninstaller "$INSTDIR\uninstall-khiops.exe" + + + ##################################### + # Windows environment customization # + # ################################### + + + # Write registry keys to add Khiops in the Add/Remove Programs pane + WriteRegStr HKLM "Software\Khiops" "" $INSTDIR + WriteRegStr HKLM "${UninstallerKey}\Khiops" "UninstallString" '"$INSTDIR\uninstall-khiops.exe"' + WriteRegStr HKLM "${UninstallerKey}\Khiops" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "${UninstallerKey}\Khiops" "DisplayName" "Khiops" + WriteRegStr HKLM "${UninstallerKey}\Khiops" "Publisher" "Orange" + WriteRegStr HKLM "${UninstallerKey}\Khiops" "DisplayIcon" "$INSTDIR\bin\icons\installer.ico" + WriteRegStr HKLM "${UninstallerKey}\Khiops" "DisplayVersion" "${KHIOPS_VERSION}" + WriteRegStr HKLM "${UninstallerKey}\Khiops" "URLInfoAbout" "http://khiops.org" + WriteRegDWORD HKLM "${UninstallerKey}\Khiops" "NoModify" "1" + WriteRegDWORD HKLM "${UninstallerKey}\Khiops" "NoRepair" "1" + + # Set as the startup dir for all executable shortcuts (yes it is done with SetOutPath!) + ${If} $GlobalKhiopsDataDir != "" + SetOutPath $GlobalKhiopsDataDir + ${Else} + SetOutPath $INSTDIR + ${EndIf} + + # Create application shortcuts in the installation directory + DetailPrint "Installing Start menu Shortcut..." + CreateShortCut "$INSTDIR\Khiops.lnk" "$INSTDIR\bin\khiops.cmd" "" "$INSTDIR\bin\icons\khiops.ico" 0 SW_SHOWMINIMIZED + CreateShortCut "$INSTDIR\Khiops Coclustering.lnk" "$INSTDIR\bin\khiops_coclustering.cmd" "" "$INSTDIR\bin\icons\khiops_coclustering.ico" 0 SW_SHOWMINIMIZED + ExpandEnvStrings $R0 "%COMSPEC%" + CreateShortCut "$INSTDIR\Shell Khiops.lnk" "$INSTDIR\bin\shell_khiops.cmd" "" "$R0" + + # Create start menu shortcuts for the executables and documentation + DetailPrint "Installing Start menu Shortcut..." + CreateDirectory "$SMPROGRAMS\Khiops" + CreateShortCut "$SMPROGRAMS\Khiops\Khiops.lnk" "$INSTDIR\bin\khiops.cmd" "" "$INSTDIR\bin\icons\khiops.ico" 0 SW_SHOWMINIMIZED + CreateShortCut "$SMPROGRAMS\Khiops\Khiops Coclustering.lnk" "$INSTDIR\bin\khiops_coclustering.cmd" "" "$INSTDIR\bin\icons\khiops_coclustering.ico" 0 SW_SHOWMINIMIZED + ExpandEnvStrings $R0 "%COMSPEC%" + CreateShortCut "$SMPROGRAMS\Khiops\Shell Khiops.lnk" "$INSTDIR\bin\shell_khiops.cmd" "" "$R0" + CreateShortCut "$SMPROGRAMS\Khiops\Uninstall.lnk" "$INSTDIR\uninstall-khiops.exe" + CreateDirectory "$SMPROGRAMS\Khiops\doc" + CreateShortCut "$SMPROGRAMS\Khiops\doc\Tutorial.lnk" "$INSTDIR\doc\KhiopsTutorial.pdf" + CreateShortCut "$SMPROGRAMS\Khiops\doc\Khiops.lnk" "$INSTDIR\doc\KhiopsGuide.pdf" + CreateShortCut "$SMPROGRAMS\Khiops\doc\Khiops Coclustering.lnk" "$INSTDIR\doc\KhiopsCoclusteringGuide.pdf" + CreateShortCut "$SMPROGRAMS\Khiops\doc\Khiops Visualization.lnk" "$INSTDIR\doc\KhiopsVisualizationGuide.pdf" + CreateShortCut "$SMPROGRAMS\Khiops\doc\Khiops Covisualization.lnk" "$INSTDIR\doc\KhiopsCovisualizationGuide.pdf" + SetOutPath "$INSTDIR" + + # Define aliases for the following registry keys (also used in the uninstaller section) + # - HKLM (all users) + # - HKCU (current user) + !define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"' + !define env_hkcu 'HKCU "Environment"' + + # Set KHIOPS_HOME for the local machine and current user + WriteRegExpandStr ${env_hklm} "KHIOPS_HOME" "$INSTDIR" + WriteRegExpandStr ${env_hkcu} "KHIOPS_HOME" "$INSTDIR" + + # Make sure windows knows about the change + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + # Register file association for Khiops visualisation tools # + # inspired from examples\makensis.nsi + + # Khiops dictionary file extension + ReadRegStr $R0 HKCR ".kdic" "" + ${if} $R0 == "Khiops.Dictionary.File" + DeleteRegKey HKCR "Khiops.Dictionary.File" + ${EndIf} + WriteRegStr HKCR ".kdic" "" "Khiops.Dictionary.File" + WriteRegStr HKCR "Khiops.Dictionary.File" "" "Khiops Dictionary File" + ReadRegStr $R0 HKCR "Khiops.Dictionary.File\shell\open\command" "" + ${If} $R0 == "" + WriteRegStr HKCR "Khiops.Dictionary.File\shell" "" "open" + WriteRegStr HKCR "Khiops.Dictionary.File\shell\open\command" "" 'notepad.exe "%1"' + ${EndIf} + + # Khiops scenario file + ReadRegStr $R0 HKCR "._kh" "" + ${if} $R0 == "Khiops.File" + DeleteRegKey HKCR "Khiops.File" + ${EndIf} + WriteRegStr HKCR "._kh" "" "Khiops.File" + WriteRegStr HKCR "Khiops.File" "" "Khiops File" + WriteRegStr HKCR "Khiops.File\DefaultIcon" "" "$INSTDIR\bin\icons\khiops.ico" + ReadRegStr $R0 HKCR "Khiops.File\shell\open\command" "" + ${If} $R0 == "" + WriteRegStr HKCR "Khiops.File\shell" "" "open" + WriteRegStr HKCR "Khiops.File\shell\open\command" "" 'notepad.exe "%1"' + ${EndIf} + WriteRegStr HKCR "Khiops.File\shell\compile" "" "Execute Khiops Script" + WriteRegStr HKCR "Khiops.File\shell\compile\command" "" '"$INSTDIR\bin\khiops.cmd" -i "%1"' + + # Khiops coclustering scenario file + ReadRegStr $R0 HKCR "._khc" "" + ${if} $R0 == "Khiops.Coclustering.File" + DeleteRegKey HKCR "Khiops.Coclustering.File" + ${EndIf} + WriteRegStr HKCR "._khc" "" "Khiops.Coclustering.File" + WriteRegStr HKCR "Khiops.Coclustering.File" "" "Khiops Coclustering File" + WriteRegStr HKCR "Khiops.Coclustering.File\DefaultIcon" "" "$INSTDIR\bin\icons\khiops_coclustering.ico" + ReadRegStr $R0 HKCR "Khiops.Coclustering.File\shell\open\command" "" + ${If} $R0 == "" + WriteRegStr HKCR "Khiops.Coclustering.File\shell" "" "open" + WriteRegStr HKCR "Khiops.Coclustering.File\shell\open\command" "" 'notepad.exe "%1"' + ${EndIf} + WriteRegStr HKCR "Khiops.Coclustering.File\shell\compile" "" "Execute Khiops Coclustering Script" + WriteRegStr HKCR "Khiops.Coclustering.File\shell\compile\command" "" '"$INSTDIR\bin\khiops_coclustering.cmd" -i "%1"' + + # Notify the file extension changes + System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' + + # Debug message + !ifdef DEBUG + Messagebox MB_OK "Installation finished!" + !endif + +SectionEnd + + +############### +# Uninstaller # +############### + +Section "Uninstall" + # In order to have shortcuts and documents for all users + SetShellVarContext all + + # Restore Registry # + # Unregister file associations + DetailPrint "Uninstalling Khiops Shell Extensions..." + + # Unregister Khiops dictionary file extension + ${If} $R0 == "Khiops.Dictionary.File" + DeleteRegKey HKCR ".kdic" + ${EndIf} + DeleteRegKey HKCR "Khiops.Dictionary.File" + + # Unregister Khiops file extension + ${If} $R0 == "Khiops.File" + DeleteRegKey HKCR "._kh" + ${EndIf} + DeleteRegKey HKCR "Khiops.File" + + # Unregister Khiops coclustering file extension + ${If} $R0 == "Khiops.Coclustering.File" + DeleteRegKey HKCR "._khc" + ${EndIf} + DeleteRegKey HKCR "Khiops.Coclustering.File" + + # Notify file extension changes + System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, i 0, i 0)' + + # Delete installation folder key + DeleteRegKey HKLM "${UninstallerKey}\Khiops" + DeleteRegKey HKLM "Software\Khiops" + + # Delete environement variable KHIOPS_HOME + DeleteRegValue ${env_hklm} "KHIOPS_HOME" + DeleteRegValue ${env_hkcu} "KHIOPS_HOME" + + # Delete deprecated environment variable KhiopsHome + DeleteRegValue ${env_hklm} "KhiopsHome" + DeleteRegValue ${env_hkcu} "KhiopsHome" + + # Make sure windows knows about the changes in the environment + SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000 + + # Delete files # + # Note: Some directories are removed only if they are completely empty (no "/r" RMDir flag) + DetailPrint "Deleting Files ..." + + # Delete docs + Delete "$INSTDIR\LICENSE.txt" + Delete "$INSTDIR\README.txt" + Delete "$INSTDIR\WHATSNEW.txt" + RMDir /r "$INSTDIR\doc" + + # Delete icons + RMDir /r "$INSTDIR\bin\icons" + + # Delete executables and scripts + Delete "$INSTDIR\bin\khiops_env.cmd" + Delete "$INSTDIR\bin\khiops.cmd" + Delete "$INSTDIR\bin\khiops_coclustering.cmd" + Delete "$INSTDIR\bin\MODL.exe" + Delete "$INSTDIR\bin\MODL_Coclustering.exe" + Delete "$INSTDIR\bin\norm.jar" + Delete "$INSTDIR\bin\khiops.jar" + Delete "$INSTDIR\bin\shell_khiops.cmd" + RMDir "$INSTDIR\bin" + + # Delete shortcuts from install dir + Delete "$INSTDIR\Khiops.lnk" + Delete "$INSTDIR\Khiops Coclustering.lnk" + Delete "$INSTDIR\Shell Khiops.lnk" + + # Delete the installer + Delete "$INSTDIR\uninstall-khiops.exe" + + # Remove install directory + RMDir "$INSTDIR" + + # Delete desktop shortcuts + Delete "$DESKTOP\Khiops.lnk" + Delete "$DESKTOP\Khiops Coclustering.lnk" + Delete "$DESKTOP\Shell Khiops.lnk" + + # Delete Start Menu Shortcuts + RMDir /r "$SMPROGRAMS\Khiops" + + # Set the samples directory to be located either within %PUBLIC% or %ALLUSERSPROFILE% as fallback + ReadEnvStr $WinPublicDir PUBLIC + ReadEnvStr $AllUsersProfileDir ALLUSERSPROFILE + ${If} $WinPublicDir != "" + StrCpy $GlobalKhiopsDataDir "$WinPublicDir\khiops_data" + ${ElseIf} $AllUsersProfileDir != "" + StrCpy $GlobalKhiopsDataDir "$AllUsersProfileDir\khiops_data" + ${Else} + StrCpy $GlobalKhiopsDataDir "" + ${EndIf} + + # Delete sample datasets + # We do not remove the whole directory to save the users results from Khiops' analyses + ${If} $GlobalKhiopsDataDir != "" + StrCpy $SamplesInstallDir "$GlobalKhiopsDataDir\samples" + Delete "$SamplesInstallDir\AccidentsSummary\Accidents.kdic" + Delete "$SamplesInstallDir\AccidentsSummary\Accidents.txt" + Delete "$SamplesInstallDir\AccidentsSummary\README.txt" + Delete "$SamplesInstallDir\AccidentsSummary\Vehicles.txt" + Delete "$SamplesInstallDir\Accidents\Accidents.kdic" + Delete "$SamplesInstallDir\Accidents\Accidents.txt" + Delete "$SamplesInstallDir\Accidents\Places.txt" + Delete "$SamplesInstallDir\Accidents\README.txt" + Delete "$SamplesInstallDir\Accidents\Users.txt" + Delete "$SamplesInstallDir\Accidents\Vehicles.txt" + Delete "$SamplesInstallDir\Accidents\raw\AccidentsPreprocess.kdic" + Delete "$SamplesInstallDir\Accidents\raw\Description_BD_ONISR.pdf" + Delete "$SamplesInstallDir\Accidents\raw\Licence_Ouverte.pdf" + Delete "$SamplesInstallDir\Accidents\raw\README.txt" + Delete "$SamplesInstallDir\Accidents\raw\caracteristiques-2018.csv" + Delete "$SamplesInstallDir\Accidents\raw\lieux-2018.csv" + Delete "$SamplesInstallDir\Accidents\raw\preprocess.py" + Delete "$SamplesInstallDir\Accidents\raw\usagers-2018.csv" + Delete "$SamplesInstallDir\Accidents\raw\vehicules-2018.csv" + Delete "$SamplesInstallDir\Accidents\train.py" + Delete "$SamplesInstallDir\Adult\Adult.kdic" + Delete "$SamplesInstallDir\Adult\Adult.txt" + Delete "$SamplesInstallDir\CustomerExtended\Address.txt" + Delete "$SamplesInstallDir\CustomerExtended\City.txt" + Delete "$SamplesInstallDir\CustomerExtended\Country.txt" + Delete "$SamplesInstallDir\CustomerExtended\Customer.kdic" + Delete "$SamplesInstallDir\CustomerExtended\Customer.txt" + Delete "$SamplesInstallDir\CustomerExtended\CustomerRecoded.kdic" + Delete "$SamplesInstallDir\CustomerExtended\Product.txt" + Delete "$SamplesInstallDir\CustomerExtended\README.txt" + Delete "$SamplesInstallDir\CustomerExtended\Service.txt" + Delete "$SamplesInstallDir\CustomerExtended\Usage.txt" + Delete "$SamplesInstallDir\CustomerExtended\recode_customer.py" + Delete "$SamplesInstallDir\Customer\Address.txt" + Delete "$SamplesInstallDir\Customer\Customer.kdic" + Delete "$SamplesInstallDir\Customer\Customer.txt" + Delete "$SamplesInstallDir\Customer\CustomerRecoded.kdic" + Delete "$SamplesInstallDir\Customer\README.txt" + Delete "$SamplesInstallDir\Customer\Service.txt" + Delete "$SamplesInstallDir\Customer\Usage.txt" + Delete "$SamplesInstallDir\Customer\sort_and_recode_customer.py" + Delete "$SamplesInstallDir\Customer\unsorted\Address-unsorted.txt" + Delete "$SamplesInstallDir\Customer\unsorted\Customer-unsorted.txt" + Delete "$SamplesInstallDir\Customer\unsorted\Service-unsorted.txt" + Delete "$SamplesInstallDir\Customer\unsorted\Usage-unsorted.txt" + Delete "$SamplesInstallDir\Iris\Iris.kdic" + Delete "$SamplesInstallDir\Iris\Iris.txt" + Delete "$SamplesInstallDir\Letter\Letter.kdic" + Delete "$SamplesInstallDir\Letter\Letter.txt" + Delete "$SamplesInstallDir\Mushroom\Mushroom.kdic" + Delete "$SamplesInstallDir\Mushroom\Mushroom.txt" + Delete "$SamplesInstallDir\README.txt" + Delete "$SamplesInstallDir\SpliceJunction\SpliceJunction.kdic" + Delete "$SamplesInstallDir\SpliceJunction\SpliceJunction.txt" + Delete "$SamplesInstallDir\SpliceJunction\SpliceJunctionDNA.txt" + RMDir "$SamplesInstallDir\AccidentsSummary\" + RMDir "$SamplesInstallDir\Accidents\raw\" + RMDir "$SamplesInstallDir\Accidents\" + RMDir "$SamplesInstallDir\Adult\" + RMDir "$SamplesInstallDir\CustomerExtended\" + RMDir "$SamplesInstallDir\Customer\unsorted\" + RMDir "$SamplesInstallDir\Customer\" + RMDir "$SamplesInstallDir\Iris\" + RMDir "$SamplesInstallDir\Letter\" + RMDir "$SamplesInstallDir\Mushroom\" + RMDir "$SamplesInstallDir\SpliceJunction\" + RMDir "$SamplesInstallDir" + ${EndIf} +SectionEnd + + +####################### +# Installer Functions # +####################### + +Function "CreateDesktopShortcuts" + # Set as the startup dir for all executable shortcuts (yes it is done with SetOutPath!) + ${If} $GlobalKhiopsDataDir != "" + SetOutPath $GlobalKhiopsDataDir + ${Else} + SetOutPath $INSTDIR + ${EndIf} + + # Create the shortcuts + DetailPrint "Installing Desktop Shortcut..." + CreateShortCut "$DESKTOP\Khiops.lnk" "$INSTDIR\bin\khiops.cmd" "" "$INSTDIR\bin\icons\khiops.ico" 0 SW_SHOWMINIMIZED + CreateShortCut "$DESKTOP\Khiops Coclustering.lnk" "$INSTDIR\bin\khiops_coclustering.cmd" "" "$INSTDIR\bin\icons\khiops_coclustering.ico" 0 SW_SHOWMINIMIZED +FunctionEnd + +# Predefined initialization install function +Function .onInit + + # Read location of the uninstaller + ReadRegStr $PreviousUninstaller HKLM "${UninstallerKey}\Khiops" "UninstallString" + ReadRegStr $PreviousVersion HKLM "${UninstallerKey}\Khiops" "DisplayVersion" + + # Ask the user to proceed if there was already a previous Khiops version installed + # In silent mode: remove previous version + ${If} $PreviousUninstaller != "" + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ + "Khiops $PreviousVersion is already installed. $\n$\nClick OK to remove the \ + previous version $\n$\nor Cancel to cancel this upgrade." \ + /SD IDOK IDOK uninst + Abort + + # Run the uninstaller + uninst: + ClearErrors + ExecWait '$PreviousUninstaller /S _?=$INSTDIR' + + # Run again the uninstaller to delete the uninstaller itself and the root dir (without waiting) + # Must not be used in silent mode (may delete files from silent following installation) + ${IfNot} ${Silent} + ExecWait '$PreviousUninstaller /S' + ${EndIf} + ${EndIf} + + # Choice of default installation directory, for windows 32 or 64 + ${If} $INSTDIR == "" + ${If} ${RunningX64} + StrCpy $INSTDIR "$PROGRAMFILES64\khiops" + # No 32-bit install + ${EndIf} + ${EndIf} +FunctionEnd + + +# Function to show the page for requirements +Function RequirementsPageShow + # Detect requirements + Call RequirementsDetection + + # Creation of page, with title and subtitle + nsDialogs::Create 1018 + !insertmacro MUI_HEADER_TEXT "Check software requirements" "Check Microsoft MPI and Java Runtime Environment" + + # Message to show for the Microsoft MPI installation + ${NSD_CreateLabel} 0 20u 100% 10u $MPIInstallationMessage + + # Message to show for the JRE installation + ${NSD_CreateLabel} 0 50u 100% 10u $JavaInstallationMessage + + # Show page + nsDialogs::Show +FunctionEnd + + +# Requirements detection +# - Detects if the system architecture is 64-bit +# - Detects whether Java JRE and MPI are installed and their versions +Function RequirementsDetection + # Abort installation if the machine does not have 64-bit architecture + ${IfNot} ${RunningX64} + Messagebox MB_OK "Khiops works only on Windows 64 bits: installation will be terminated." /SD IDOK + Quit + ${EndIf} + + # Decide if MPI is required by detecting the number of cores + StrCpy $PhysicalCoresNumber "0" + Call GetProcessorPhysCoreCount + Pop $0 + StrCpy $PhysicalCoresNumber $0 + ${If} $PhysicalCoresNumber > 1 + StrCpy $IsMPIRequired "1" + ${Else} + StrCpy $IsMPIRequired "0" + ${EndIf} + ${If} $IsMPIRequired == "1" + # Note: This call defines MPIInstalledVersion + Call DetectAndLoadMPIEnvironment + ${EndIf} + + # Try to install MPI if it is required + StrCpy $MPIInstallationNeeded "0" + StrCpy $MPIInstallationMessage "" + ${If} $IsMPIRequired == "1" + # If it is not installed install it + ${If} $MPIInstalledVersion == "0" + StrCpy $MPIInstallationMessage "Microsoft MPI version ${MSMPI_VERSION} will be installed" + StrCpy $MPIInstallationNeeded "1" + # Otherwise install only if the required version is newer than the installed one + ${Else} + ${VersionCompare} "${MPIRequiredVersion}" "$MPIInstalledVersion" $0 + ${If} $0 == 1 + StrCpy $MPIInstallationMessage "Microsoft MPI will be upgraded to version ${MSMPI_VERSION}" + StrCpy $MPIInstallationNeeded "1" + ${Else} + StrCpy $MPIInstallationMessage "Microsoft MPI version already installed" + ${EndIf} + ${EndIf} + # Otherwise just inform that MPI is not required + ${Else} + StrCpy $MPIInstallationMessage "Microsoft MPI installation not required" + ${EndIf} + + # Show debug information + !ifdef DEBUG + Messagebox MB_OK "MS-MPI: needed=$MPIInstallationNeeded required=${MPIRequiredVersion} installed=$MPIInstalledVersion" + !endif + + # Detect and load Java Environment + Call DetectAndLoadJavaEnvironment + + # Message to install Java + StrCpy $JavaInstallationNeeded "0" + StrCpy $JavaInstallationMessage "" + ${If} $JavaInstallationPath == "" + StrCpy $JavaInstallationMessage "Java Runtime Environment version ${JRE_VERSION} will be installed" + StrCpy $JavaInstallationNeeded "1" + # If Java allready installed + ${Else} + # We use JavaRequiredVersion and not JavaRequiredFullVersion because of a bug + ${VersionCompare} "${JavaRequiredVersion}" "$JavaInstalledVersion" $0 + # Required version is newer than installed version + ${If} $0 == 1 + StrCpy $JavaInstallationMessage "New Java runtime version 1.${JRE_VERSION} will be installed" + StrCpy $JavaInstallationNeeded "1" + # Require version is equal or older than installed version + ${Else} + StrCpy $JavaInstallationMessage "Java runtime already installed" + ${EndIf} + ${EndIf} + + # Debug message + !ifdef DEBUG + Messagebox MB_OK "Java runtime: isNeeded=$JavaInstallationNeeded reqVersion=${JavaRequiredVersion} installedVersion=$JavaInstalledVersion" + !endif +FunctionEnd + +# No leave page for required software +Function RequirementsPageLeave +FunctionEnd diff --git a/scripts/khiops-package-version b/scripts/khiops-package-version new file mode 100755 index 000000000..eedbe59c4 --- /dev/null +++ b/scripts/khiops-package-version @@ -0,0 +1,51 @@ +#! /usr/bin/env bash +# Creates a "package-version" of Khiops +# - if the commit is tagged: +# - if the matches the in the sources: +# - package-version = +# - otherwise: +# - warn +# - package-version = -preview- +# - otherwise: +# - package-version = -preview- + +# Common safeguards +set -euo pipefail + +# Save this script's directory +SCRIPT_DIR="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)" + +main () { + # The ref_name it should be either a hash or a tag + declare ref_name="$1" + + # Obtain the khiops version from the source + local script_dir + local khiops_version + khiops_version="$("$SCRIPT_DIR/khiops-version")" + + # See the header of the script to understand this part + local khiops_package_version + + # Case of a tag + if git describe --tags --exact-match "$ref_name" 1> /dev/null 2> /dev/null + then + if [[ "$ref_name" == "v${khiops_version}" ]] + then + khiops_package_version="$khiops_version" + else + khiops_package_version="$khiops_version-preview-$ref_name" + echo "::warning: Tag '$ref_name' doesn't match the Khiops source version '$khiops_version'" 1>&2 + echo "::warning: Creating preview package version string '$khiops_package_version'" 1>&2 + fi + # Case of another reference name (branch name or sha) + else + short_hash="$(git rev-parse --short --verify "$ref_name" | cut -d' ' -f1)" + khiops_package_version="$khiops_version-preview-$short_hash" + echo "::warning: Ref name '$ref_name' is not a tag" 1>&2 + echo "::warning: Creating preview package version string '$khiops_package_version'" 1>&2 + fi + echo "$khiops_package_version" +} + +main "$@" diff --git a/scripts/khiops-version b/scripts/khiops-version new file mode 100755 index 000000000..bb28bebda --- /dev/null +++ b/scripts/khiops-version @@ -0,0 +1,17 @@ +#! /usr/bin/env bash + +# Obtains the khiops version stored in the sources + +set -euo pipefail + +# Obtain the khiops repo location +SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) +KHIOPS_REPO_DIR=$(dirname "$SCRIPT_DIR") + +# Get the version +# - Get the version definition line in the KWKhiopsVersion.h file +# - Get the third token, it should be something like str(10.1.1) +# - Extract the version +grep "KHIOPS_VERSION" "$KHIOPS_REPO_DIR"/src/Learning/KWUtils/KWKhiopsVersion.h \ + | cut -d' ' -f3 \ + | sed 's/str(\(.*\))/\1/' diff --git a/src/Learning/CMakeLists.txt b/src/Learning/CMakeLists.txt index 1f9a6d117..e6b7e170b 100644 --- a/src/Learning/CMakeLists.txt +++ b/src/Learning/CMakeLists.txt @@ -22,26 +22,18 @@ add_subdirectory(MODL) add_subdirectory(MODL_Coclustering) add_subdirectory(SNBPredictor) -# build norm.jar +# Add khiops.jar (CMake names the target khiops_jar) if(BUILD_JARS) - include(UseJava) - add_jar( - khiops_jar - OUTPUT_NAME - khiops - RESOURCES - NAMESPACE - "" - ../../packaging/common/images/khiops_coclustering_about.gif - ../../packaging/common/images/khiops_coclustering.gif - ../../packaging/common/images/khiops_about.gif - ../../packaging/common/images/khiops.gif - OUTPUT_DIR ${CMAKE_BINARY_DIR}) - message(STATUS "build khiops.jar in ${CMAKE_BINARY_DIR}") - install_jar( - khiops_jar - DESTINATION usr/share/khiops - COMPONENT KHIOPS) + add_khiops_jar( + NAME + "khiops" + NAMESPACE + "images" + IMAGES + "../../packaging/common/images/khiops_coclustering_about.gif" + "../../packaging/common/images/khiops_coclustering.gif" + "../../packaging/common/images/khiops_about.gif" + "../../packaging/common/images/khiops.gif") endif() include(install) diff --git a/src/Learning/KNITransfer/KNIRecodeFile.cpp b/src/Learning/KNITransfer/KNIRecodeFile.cpp index 2b0e7458b..c59c6e787 100644 --- a/src/Learning/KNITransfer/KNIRecodeFile.cpp +++ b/src/Learning/KNITransfer/KNIRecodeFile.cpp @@ -2,11 +2,6 @@ // This software is distributed under the BSD 3-Clause-clear License, the text of which is available // at https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file for more details. -/****************************************************************************** - * Khiops Native Interface (KNI) - * Copyright (c) 2022 Orange Labs. All rights reserved. - *****************************************************************************/ - #ifdef _MSC_VER // To disable fopen warnings (Visual C++ deprecated method) #define _CRT_SECURE_NO_WARNINGS diff --git a/src/Learning/KNITransfer/KNIRecodeFile.h b/src/Learning/KNITransfer/KNIRecodeFile.h index 8c1468c70..c9f40e347 100644 --- a/src/Learning/KNITransfer/KNIRecodeFile.h +++ b/src/Learning/KNITransfer/KNIRecodeFile.h @@ -3,11 +3,6 @@ // at https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file for more details. #pragma once -/****************************************************************************** - * Khiops Native Interface (KNI) - * Copyright (c) 2022 Orange Labs. All rights reserved. - *****************************************************************************/ - /* * Recode an input file to an output file, using a Khiops dictionary from a dictionary file * The input file must have a header line, describing the structure of all its instances diff --git a/src/Learning/KNITransfer/KNIRecodeMTFiles.cpp b/src/Learning/KNITransfer/KNIRecodeMTFiles.cpp index 392d6f84b..bf0a24f86 100644 --- a/src/Learning/KNITransfer/KNIRecodeMTFiles.cpp +++ b/src/Learning/KNITransfer/KNIRecodeMTFiles.cpp @@ -2,11 +2,6 @@ // This software is distributed under the BSD 3-Clause-clear License, the text of which is available // at https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file for more details. -/****************************************************************************** - * Khiops Native Interface (KNI) - * Copyright (c) 2022 Orange Labs. All rights reserved. - *****************************************************************************/ - #ifdef _MSC_VER // To disable fopen warnings (Visual C++ deprecated method) #define _CRT_SECURE_NO_WARNINGS diff --git a/src/Learning/KNITransfer/KNIRecodeMTFiles.h b/src/Learning/KNITransfer/KNIRecodeMTFiles.h index ace7b9310..df350bb1d 100644 --- a/src/Learning/KNITransfer/KNIRecodeMTFiles.h +++ b/src/Learning/KNITransfer/KNIRecodeMTFiles.h @@ -3,11 +3,6 @@ // at https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file for more details. #pragma once -/****************************************************************************** - * Khiops Native Interface (KNI) - * Copyright (c) 2022 Orange Labs. All rights reserved. - *****************************************************************************/ - /* * Recode a set of multi-tables input files to an output file. * See main function mainKNIRecodeMTFiles(argc, argv). diff --git a/src/Learning/KWLearningProblem/KWLearningProblemHelpCard.cpp b/src/Learning/KWLearningProblem/KWLearningProblemHelpCard.cpp index 152d10164..0529f7c03 100644 --- a/src/Learning/KWLearningProblem/KWLearningProblemHelpCard.cpp +++ b/src/Learning/KWLearningProblem/KWLearningProblemHelpCard.cpp @@ -43,35 +43,38 @@ KWLearningProblemHelpCard::~KWLearningProblemHelpCard() {} void KWLearningProblemHelpCard::ShowDocumentation() { UICard documentationCard; + ALString sDocumentationHeader; require(GetFieldNumber() == 0); - // Titre + // Parametrage basique de la carte documentationCard.SetIdentifier("Documentation"); documentationCard.SetLabel("Documentation " + GetLearningFullApplicationName()); - // Affichage - if (sDocumentationText != "") + // Entete + sDocumentationHeader = "

" + GetLearningFullApplicationName() + "

" + sDocumentationHeader += + "

Khiops is an AutoML suite for supervised and unsupervised learning

"; + if (GetLearningWebSite() != "") { - documentationCard.AddStringField("Information", "", sDocumentationText); - documentationCard.GetFieldAt("Information")->SetStyle("FormattedLabel"); + sDocumentationHeader += "

Official website: "; + sDocumentationHeader += "" + GetLearningWebSite() + "

"; } - - // Site web + documentationCard.AddStringField("Header", "", "" + sDocumentationHeader + ""); if (GetLearningWebSite() != "") { - // Saut de ligne - documentationCard.AddStringField("NewLine", "", ""); - documentationCard.GetFieldAt("NewLine")->SetStyle("FormattedLabel"); - - // Site web - documentationCard.AddStringField("WebSite", "Web site", - " " + GetLearningWebSite() + " "); - documentationCard.GetFieldAt("WebSite")->SetStyle("UriLabel"); - documentationCard.GetFieldAt("WebSite")->SetParameters(GetLearningWebSite()); + documentationCard.GetFieldAt("Header")->SetStyle("UriLabel"); + documentationCard.GetFieldAt("Header")->SetParameters(GetLearningWebSite()); + } + else + { + documentationCard.GetFieldAt("Header")->SetStyle("FormattedLabel"); } - // Affichage + // Contenus + documentationCard.AddStringField("Body", "", "" + sDocumentationText + ""); + documentationCard.GetFieldAt("Body")->SetStyle("FormattedLabel"); + + // Affichage du widget documentationCard.Open(); } diff --git a/src/Learning/KWUtils/KWKhiopsVersion.h b/src/Learning/KWUtils/KWKhiopsVersion.h index 7e538fb8a..6aeba98c3 100644 --- a/src/Learning/KWUtils/KWKhiopsVersion.h +++ b/src/Learning/KWUtils/KWKhiopsVersion.h @@ -13,4 +13,4 @@ #define KHIOPS_VERSION str(10.1.5) // Copyright -#define KHIOPS_COPYRIGHT_LABEL str((c)2023 Orange Labs - All rights reserved.) +#define KHIOPS_COPYRIGHT_LABEL str((c)2023 Orange - All rights reserved.) diff --git a/src/Learning/KhiopsNativeInterface/KhiopsNativeInterface.h b/src/Learning/KhiopsNativeInterface/KhiopsNativeInterface.h index c85b4ca56..6a53d99bf 100644 --- a/src/Learning/KhiopsNativeInterface/KhiopsNativeInterface.h +++ b/src/Learning/KhiopsNativeInterface/KhiopsNativeInterface.h @@ -3,10 +3,6 @@ // at https://spdx.org/licenses/BSD-3-Clause-Clear.html or see the "LICENSE" file for more details. #pragma once -/****************************************************************************** - * Khiops Native Interface (KNI) - * Copyright (c) 2022 Orange Labs. All rights reserved. - *****************************************************************************/ /* Use of C linkage from C++ */ #ifdef __cplusplus diff --git a/src/Learning/MODL/CMakeLists.txt b/src/Learning/MODL/CMakeLists.txt index 7cb733f32..8389cf023 100644 --- a/src/Learning/MODL/CMakeLists.txt +++ b/src/Learning/MODL/CMakeLists.txt @@ -1,24 +1,22 @@ -# on fedora, binaries built with mpi must ended by _mpich suffix file(GLOB cppfiles ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp) -add_executable(MODL${MPI_SUFFIX} ${cppfiles} MODL.rc) +# MODL executable On Fedora, binaries built with mpi must be suffixed by _mpich (in stored ${MPI_SUFFIX}) +add_executable(MODL${MPI_SUFFIX} ${cppfiles} MODL.rc) target_link_libraries(MODL${MPI_SUFFIX} PUBLIC DTForest KMDRRuleLibrary KWLearningProblem) - set_khiops_options(MODL${MPI_SUFFIX}) +if(MPI) + target_link_libraries(MODL${MPI_SUFFIX} PUBLIC PLMPI) +endif() +# MODL_SO (shared library) add_library(MODL_SO SHARED ${cppfiles}) - target_link_libraries(MODL_SO PUBLIC DTForest KMDRRuleLibrary KWLearningProblem) - if(MPI) - target_link_libraries(MODL PUBLIC PLMPI) target_link_libraries(MODL_SO PUBLIC PLMPI) endif() - set_target_properties( MODL_SO PROPERTIES PUBLIC_HEADER MODL_dll.h SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION}) - set_khiops_options(MODL_SO) diff --git a/src/Learning/MODL/MDKhiopsLearningProject.cpp b/src/Learning/MODL/MDKhiopsLearningProject.cpp index bc25eb646..83c2df817 100644 --- a/src/Learning/MODL/MDKhiopsLearningProject.cpp +++ b/src/Learning/MODL/MDKhiopsLearningProject.cpp @@ -27,49 +27,53 @@ void MDKhiopsLearningProject::OpenLearningEnvironnement() KWGrouper::RegisterGrouper(new DTGrouperMODL); // Parametrage de l'icone de l'application - UIObject::SetIconImage("khiops.gif"); + UIObject::SetIconImage("images/khiops.gif"); // Parametrage du menu about - SetLearningAboutImage("khiops_about.gif"); - SetLearningWebSite("www.khiops.com"); - - // Parametrage de la fenetre de documentation - sDocumentation = " "; - sDocumentation += "

" + GetLearningFullApplicationName() + "

"; + SetLearningAboutImage("images/khiops_about.gif"); + SetLearningWebSite("https://khiops.org"); // Documentation - sDocumentation += "

Reference guide and tutorial

"; + sDocumentation += "

Reference Guide and Tutorial

" #ifdef _WIN32 - sDocumentation += "

In the 'doc' sub-directory of the installation directory

"; -#elif defined __linux__ - sDocumentation += "

In the '/usr/share/doc/khiops' directory

"; + "

In the 'doc' sub-directory of the installation directory

"; +#elif defined __linux_or_apple__ + "

In the '/usr/share/doc/khiops' directory

"; #endif - // Examples - sDocumentation += "

Sample data sets

"; + // Sample datasets + sDocumentation += "

Sample Datasets

" + "

See the 'samples' directory " #ifdef _WIN32 - sDocumentation += "

In the 'samples' sub-directory of the installation directory

"; -#elif defined __linux__ - sDocumentation += "

In the '/usr/share/doc/khiops/samples' directory

"; + "in the 'Public' directory, usually C:\\Users\\Public\\khiops_data\\samples

"; +#elif defined __linux_or_apple__ + "in $HOME/khiops_data/samples

"; #endif - // Autre resources - sDocumentation += "

Dictionaries and modeling results under the json format

"; + // JSON Files sDocumentation += - "

The modeling results of Khiops (.khj) and Khiops coclustrering (.khcj) are stored using

" - "

the json format. Dictionaries (.kdic) can also be exported under the json format (.kdicj).

" - "

All these json files can be exploited from external tools, like pykhiops.

"; - sDocumentation += "

Visualization tools

"; - sDocumentation += "

All modeling results can be visualized using the Khiops visualization or Khiops " - "covisualization tools.

"; - sDocumentation += "

Scripting libraries

"; - sDocumentation += "

Full API to run the tool and to inspect its modeling results

"; - sDocumentation += "

pykhiops: python library

"; - sDocumentation += "

KNI: Khiops Native Interface

"; - sDocumentation += "

DLL for online deployment of models

"; - sDocumentation += "

Web site

"; - sDocumentation += "

Documentation and other resources are available for download

"; - sDocumentation += ""; + "

JSON Dictionary and Modeling Results Files

" + "

The modeling results of Khiops (.khj) and Khiops Coclustering (.khcj) are stored using

" + "

the JSON format. Dictionaries files (.kdic) may also be exported to JSON format (.kdicj).

" + "

These JSON files may be used with the Khiops Python library,

" + "

the Khiops Visualization tools (see below) or other custom external tools.

"; + + // Outils de visualisation + sDocumentation += "

Visualization Tools

" + "

The modeling result files (.khj and .khcj) can be visualized

" + "

using the Khiops Visualization or Khiops Covisualization tools.

"; + + // Librairie Python + sDocumentation += "

Khiops Python Library

" + "

This library allows to automatize the tool execution and to access

" + "

its analysis result files. More information at the Khiops website.

"; + + // Khiops Native Interface DLL + sDocumentation += "

KNI: Khiops Native Interface

" + "

DLL for online model deployment/prediction.

" + "

More information at the Khiops website.

"; + + // Parametrage de la documentation KWLearningProblemHelpCard::SetDocumentationText(sDocumentation); } diff --git a/src/Learning/MODL_Coclustering/CCLearningProject.cpp b/src/Learning/MODL_Coclustering/CCLearningProject.cpp index a7650dc6f..232469e99 100644 --- a/src/Learning/MODL_Coclustering/CCLearningProject.cpp +++ b/src/Learning/MODL_Coclustering/CCLearningProject.cpp @@ -23,28 +23,49 @@ void CCLearningProject::OpenLearningEnvironnement() SetLearningModuleName("Coclustering"); // Parametrage de l'icone de l'application - UIObject::SetIconImage("khiops_coclustering.gif"); + UIObject::SetIconImage("images/khiops_coclustering.gif"); // Parametrage du menu about - SetLearningAboutImage("khiops_coclustering_about.gif"); - SetLearningWebSite("www.khiops.com"); - - // Parametrage de la fenetre de documentation - sDocumentation = " "; - sDocumentation += "

" + GetLearningFullApplicationName() + "

"; - sDocumentation += "

Documentation and other resources are available in the installation directory and on " - "the web site

"; - sDocumentation += "

Reference guide and tutorial

"; - sDocumentation += "

In the 'doc' sub-directory of the installation directory

"; - sDocumentation += "

KhiopsCoclusteringGuide.pdf

"; - sDocumentation += "

KhiopsCoclusteringVisualizationGuide.pdf

"; - sDocumentation += "

KhiopsTutorial.pdf

"; - sDocumentation += "

Sample data sets

"; - sDocumentation += "

In the 'samples' sub-directory of the installation directory

"; - sDocumentation += "

pykhiops

"; - sDocumentation += "

In the 'python' sub-directory of the installation directory

"; - sDocumentation += "

Full python library to run the tool and to inspect its results from python

"; - sDocumentation += ""; + SetLearningAboutImage("images/khiops_coclustering_about.gif"); + SetLearningWebSite("https://khiops.org"); + + // Documentation + sDocumentation += "

Reference Guide and Tutorial

" +#ifdef _WIN32 + "

In the 'doc' sub-directory of the installation directory

"; +#elif defined __linux_or_apple__ + "

In the '/usr/share/doc/khiops' directory

"; +#endif + + // Sample datasets + sDocumentation += "

Sample Datasets

" + "

See the 'samples' directory " +#ifdef _WIN32 + "in the 'Public' directory,

" + "

usually C:\\Users\\Public\\khiops_data\\samples

"; +#elif defined __linux_or_apple__ + "in $HOME/khiops_data/samples

"; +#endif + + // JSON Files + sDocumentation += + "

JSON Dictionary and Modeling Results Files

" + "

The modeling results of Khiops (.khj) and Khiops Coclustering (.khcj) are stored using

" + "

the JSON format. Dictionaries files (.kdic) may also be exported to JSON format (.kdicj).

" + "

These JSON files may be used with the Khiops Python library,

" + "

the Khiops Visualization tools (see below) or other custom external tools.

"; + + // Outils de visualisation + sDocumentation += "

Visualization Tools

" + "

The modeling result files (.khj and .khcj) can be visualized

" + "

using the Khiops Visualization or Khiops Covisualization tools.

"; + + // Librairie Python + sDocumentation += "

Khiops Python Library

" + "

This library allows to automatize the tool execution and to access

" + "

its analysis result files. More information at the Khiops website.

"; + + // Parametrage de la documentation KWLearningProblemHelpCard::SetDocumentationText(sDocumentation); } diff --git a/src/Learning/genum/Version.h b/src/Learning/genum/Version.h index 0180427eb..e2ba10087 100644 --- a/src/Learning/genum/Version.h +++ b/src/Learning/genum/Version.h @@ -13,4 +13,4 @@ #define GENUM_VERSION str(1.0) // Copyright -#define GENUM_COPYRIGHT_LABEL str((c)2022 Orange Labs.) +#define GENUM_COPYRIGHT_LABEL str((c)2023 Orange.) diff --git a/src/Learning/genumfp/Version.h b/src/Learning/genumfp/Version.h index 1c4d6ea70..db4fc29a8 100644 --- a/src/Learning/genumfp/Version.h +++ b/src/Learning/genumfp/Version.h @@ -13,4 +13,4 @@ #define GENUMFP_VERSION str(1.0) // Copyright -#define GENUMFP_COPYRIGHT_LABEL str((c)2022 Orange Labs.) +#define GENUMFP_COPYRIGHT_LABEL str((c)2023 Orange.) diff --git a/src/Norm/CMakeLists.txt b/src/Norm/CMakeLists.txt index 7b29fc5d6..580b6c667 100644 --- a/src/Norm/CMakeLists.txt +++ b/src/Norm/CMakeLists.txt @@ -7,31 +7,19 @@ add_subdirectory(genere) add_subdirectory(basetest) add_subdirectory(generetest) -# build norm.jar +# Add norm.jar (CMake names the target norm_jar) if(BUILD_JARS) - # we recommend to use java 1.8 to ensure that the jar is compatible with all java versions (from 1.8 to the most - # recent ones) find_package(Java 1.8 EXACT REQUIRED COMPONENTS Development) - find_package(Java REQUIRED COMPONENTS Development) - - include(UseJava) - file(GLOB_RECURSE javafiles NormGUI/*.java) - add_jar( - norm_jar ${javafiles} - OUTPUT_NAME norm - ENTRY_POINT - normGUI.engine.GUIObject - RESOURCES - NAMESPACE - "images" - NormGUI/images/sample.png - NormGUI/images/sample.jpg - NormGUI/images/sample.gif - NormGUI/images/sample2.png - OUTPUT_DIR ${CMAKE_BINARY_DIR}) - message(STATUS "build norm.jar in ${CMAKE_BINARY_DIR}") - install_jar( - norm_jar - DESTINATION usr/share/khiops - COMPONENT KHIOPS) - + file(GLOB_RECURSE norm_java_files NormGUI/*.java) + add_khiops_jar( + NAME + "norm" + JAVA_FILES + ${norm_java_files} + NAMESPACE + "images" + IMAGES + "NormGUI/images/sample.png" + "NormGUI/images/sample.jpg" + "NormGUI/images/sample.gif" + "NormGUI/images/sample2.png") endif() diff --git a/src/Norm/basetest/UITest.cpp b/src/Norm/basetest/UITest.cpp index 664d343bf..6c32ae709 100644 --- a/src/Norm/basetest/UITest.cpp +++ b/src/Norm/basetest/UITest.cpp @@ -223,7 +223,7 @@ void FormattedLabelCard::Test() "
  • Tutorial: KhiopsTutorial.pdf\n" "\n" "

    See doc directory under Khiops installation directory.

    \n" - "Khiops (c) Orange Labs software for data mining \n" + "Khiops (c) Orange software for data mining \n" ""; // Parametrage de la boite et ouverture @@ -259,7 +259,7 @@ LabelCard::LabelCard() // Chaine de caracteres dans UriLabel AddStringField("FourthText", "", ""); GetFieldAt("FourthText")->SetStyle("UriLabel"); - GetFieldAt("FourthText")->SetParameters("www.khiops.com"); + GetFieldAt("FourthText")->SetParameters("khiops.org"); } LabelCard::~LabelCard() {} @@ -279,7 +279,7 @@ void LabelCard::Test() "

  • Tutorial: KhiopsTutorial.pdf\n" "\n" "

    See doc directory under Khiops installation directory.

    \n" - "Khiops (c) Orange Labs software for data mining \n"; + "Khiops (c) Orange software for data mining \n"; // Parametrage de la boite et ouverture UIObject::SetUIMode(UIObject::Graphic);